- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello together,
i need your your help. I like to drive, move and rotate constraints with ilogic. The following code rotates all of the driven constraints. The code shouldt be drive only a constraint named "move1" vertical from 0 to 155 and rotated an other constraint named "rotate1" from 0 to 45 degree. Is that possible?
And another question: The code rotates clockwise from 0 to 45 degree. Is it possible to rotate from 0 to -45?
Thanks in advance
Regards Martin
Sub Main()
Dim assyDoc As AssemblyDocument
assyDoc = ThisApplication.ActiveDocument
Dim oConstraint As AssemblyConstraint
For Each oConstraint In assyDoc.ComponentDefinition.Constraints
If oConstraint.DriveConstraintSettings.IsInitialized Then
With oConstraint.DriveConstraintSettings
.StartValue = 0
.EndValue = 45
.GoToStart
.PlayForward
' .StartValue = 0
' .EndValue = 150
' .GoToEnd
' .PlayReverse
End With
End If
Next
End Sub
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try below iLogic code to move and rotate to drive constraints.
Sub Main()
Dim assyDoc As AssemblyDocument
assyDoc = ThisApplication.ActiveDocument
Dim oConstraint As AssemblyConstraint
For Each oConstraint In assyDoc.ComponentDefinition.Constraints
If oConstraint.Name = "move1" Then
If oConstraint.DriveConstraintSettings.IsInitialized Then
With oConstraint.DriveConstraintSettings
.StartValue = "0"
.EndValue = "155"
.GoToStart
.PlayForward
End With
End If
ElseIf oConstraint.Name = "rotate1" Then
If oConstraint.DriveConstraintSettings.IsInitialized Then
With oConstraint.DriveConstraintSettings
.StartValue = 0
.EndValue = 45
.GoToStart
.PlayForward
End With
End If
End If
Next
End Sub
Is it possible to rotate from 0 to -45?
Try 0 to 315 (360 - 45) to rotate from 0 to -45.
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Chandra,
thank you very much for your help! Great work...
Regards Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report