cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Joints Using API

Experimenter
Experimenter

Hello!

We are having an issue with creating joints using the Process simulate API.

The CreateJoint Function is throwing an exeption:

Source: Implementation

Message: Error in the application

 

My guess is that it has to do with the joint not having a axis upon creation.

How is the createJoint function used?, Is it possible to define Joint axis before creation?.

7 REPLIES

Re: Creating Joints Using API

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Oskar,

 

Check first if the ITxKinematicsModellable object is open for kinematics modeling - IsOpenForKinematicsModeling. I see that you get the last picked object - is that object open for modeling?

 

Best Regards,

Diana

Re: Creating Joints Using API

Experimenter
Experimenter

Thank you for fast reply,

 

selJoint.IsOpenForKinematicsModeling returns true

 

What next?

Re: Creating Joints Using API

Siemens Phenom Siemens Phenom
Siemens Phenom

Can you share the code so I will check it? Which platform are you running - eMServer or Teamcenter or RobotExpert?

 

Best Regards,

Diana

Re: Creating Joints Using API

Experimenter
Experimenter

Hi again.

Here is the complete code, mostly translated to english.

The code is executed from within PS after a model object is set to modeling mode.
The joints is actualy created, but an exeption is thrown .

I am using Process Simulate on eMServer

Betreff: Creating Joints Using API

Valued Contributor
Valued Contributor

Hi oscar,

 

suppose you are right: you need to define a movement axis in order to create a joint. The class TxJointCreationData has method called SetAxisPoints to define the movement axis.

Here is a snippet from code in VB that works fine for me:

 

       Dim sourceComponent as TxComponet

 

       'Create joint

       'Define the data for the joint creation

       Dim jointData As New TxJointCreationData() With {

                   .ParentLink = parentLink,

                   .ChildLink = link,

                   .JointType = TxJoint.TxJointType.Revolute,

                   .Name = sourceComponent.GetUniqueObjectName(Of TxJoint)("joint")

                   }

       If kinematicsInfo.MovementType = MovementType.translate Then

           jointData.JointType = TxJoint.TxJointType.Prismatic

       End If

 

       'Set the movement axis.

       Dim startPoint As New TxVector(kinematicsInfo.Axle.Origin.X, kinematicsInfo.Axle.Origin.Y, kinematicsInfo.Axle.Origin.Z)

       Dim endPoint As New TxVector(kinematicsInfo.Axle.Destination.X, kinematicsInfo.Axle.Destination.Y, kinematicsInfo.Axle.Destination.Z)

       jointData.SetAxisPoints(endPoint, startPoint)

       Dim joint As TxJoint = sourceComponent.CreateJoint(jointData)

Re: Creating Joints Using API

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Oskar,

 

The code is OK. The problem that I found is that the locations(points) of the geometry were calculated wrong, which ended up in exception. 

 

Best Regards,

DianaG

Re: Creating Joints Using API

Experimenter
Experimenter

Hi

 

That could be true. The solution that i found was to move the attachment of geometries to the links after the joints are created and it seems to work. so it could be as you said that the geometries are calculated wrong.

 

Regards Oskar