How do change the Maximum Limit of Angle constarint using ILogic

How do change the Maximum Limit of Angle constarint using ILogic

Anonymous
Not applicable
551 Views
2 Replies
Message 1 of 3

How do change the Maximum Limit of Angle constarint using ILogic

Anonymous
Not applicable

Hi All,

I'm Working on creating Angle constraint by using ILogic. I'm using below functional code to create new Angle constraint. I want to change the maximum limit once the angle constraint got created. Please give your suggestions. 

 

Existing Function code I'm Using now:

 

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"
If oAConstraint.HealthStatus = oAConstraint.HealthStatus.kInconsistentHealth Then
oAConstraint.Delete
oAxis1 = oAsmCompDef.WorkAxes.Item("Y Axis")
oAxis2 = comp.Definition.WorkAxes("Z 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"
If oAConstraint.HealthStatus = oAConstraint.HealthStatus.kInconsistentHealth Then
oAConstraint.Delete
oAxis1 = oAsmCompDef.WorkAxes.Item("Y Axis")
oAxis2 = comp.Definition.WorkAxes("X 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)
552 Views
2 Replies
Replies (2)
Message 2 of 3

HermJan.Otterman
Advisor
Advisor

Hello, can you share your (example) assembly?

 

is it realy necessary to create a new angle constraint?

maybe it is more easy to create some sort of skeleton model with the angle constrain already in it.

 

could you explane in more detail what your goal is?

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

@HermJan.Otterman 

 

Hi Sir,

I have changed the Maximum Limit by using below Functional code.

 

oAConstraint.ConstraintLimits.MaximumEnabled = True
oAConstraint.ConstraintLimits.Maximum.Expression = "45 deg"
oAConstraint.ConstraintLimits.MinimumEnabled = True
oAConstraint.ConstraintLimits.Minimum.Expression = "0 deg"
oAConstraint.ConstraintLimits.MaximumEnabled = False
oAConstraint.ConstraintLimits.Maximum.Expression = "0 deg"
oAConstraint.ConstraintLimits.MaximumEnabled = True

 

Thanks & Regards,

Manoj Sampath