Message 1 of 8

Not applicable
01-29-2020
12:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm using a fairly simple iLogic code to apply angle constraint to each component in an assembly but it's only applied on the last part in the design tree. Anything I can do to get the constraint to stick to every part/plane?
I wish to constraint each part's YZ plane to the assembly's XZ plane so they're all facing the same direction.
Sub Main() Dim doc As AssemblyDocument doc = ThisApplication.ActiveDocument Dim acd As AssemblyComponentDefinition acd = doc.ComponentDefinition Call ConstraintAngle(acd.Occurrences) End Sub Sub ConstraintAngle(occs As ComponentOccurrences) Dim occ As ComponentOccurrence For Each occ In occs DimOsaPart As String Part = occ.Name Try Constraints.AddAngle("Angle1", Part, "YZ plane", oAsmDoc,"XZ plane", angle := 0.0, solutionType := AngleConstraintSolutionTypeEnum.kDirectedSolution, refVecComponent := Nothing, refEntityName := Nothing, biasPoint1 := Nothing, biasPoint2 := Nothing) Catch End Try Next End Sub
Solved! Go to Solution.