How do change the Angle Constraint type using ILogic

How do change the Angle Constraint type using ILogic

Anonymous
Not applicable
695 Views
1 Reply
Message 1 of 2

How do change the Angle Constraint type using ILogic

Anonymous
Not applicable

Hi,

I'm creating Angle constraint ( Using 78594 Type) for components by using below Functional code.

As mentioned below  " '78594 refers to the undirected angle constraint solution type. 78593 refers to
'directed (which is default), and 78595 is the referenced vector solution" 

 

Now I want to change the Angle Constraint type from " 78594" to "78593" after the Constraint got created.

Please help me by give your suggestions.

 

Functional Code:

 oAxis1 = oAsmCompDef.WorkAxes.Item ("Y Axis")
oAxis2 = comp.Definition.WorkAxes("Y Axis")
comp.CreateGeometryProxy(oAxis2, oproxyAxis2)
If Not ConstraintExists(comp, ObjectTypeEnum.kAngleConstraintObject, oproxyAxis2, oAxis1) Then
oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78594)
'78594 refers to the undirected angle constraint solution type. 78593 refers to
'directed (which is default), and 78595 is the referenced vector solution
oAConstraint.ConstraintLimits.MaximumEnabled = True
oAConstraint.ConstraintLimits.Maximum.Expression = "45 deg"
oAConstraint.ConstraintLimits.MinimumEnabled = True
oAConstraint.ConstraintLimits.Minimum.Expression = "0 deg"

 

Thanks & Regards,

Manoj Sampath

0 Likes
Accepted solutions (1)
696 Views
1 Reply
Reply (1)
Message 2 of 2

MjDeck
Autodesk
Autodesk
Accepted solution

Hi Manoj,

 The AngleConstraint.SolutionType property is read-only. But I think you can do what you want with the AngleConstraint.ConvertToAngleConstraint method. 

I'm not sure exactly what you're trying to do, but another alternative might be to explictly change the position of one or both components before creating the constraint. Moving it into position will give the system a clue about what you want. To do this, set the ComponentOccurrence.Transformation method, or use the ComponentOccurrence.SetTransformWithoutConstraints method.

It's more clear if you use the enum names instead of numbers in both the rule code and discussion. You can use AngleConstraintSolutionTypeEnum.kDirectedSolution and
AngleConstraintSolutionTypeEnum.kUndirectedSolution.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes