Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
360 Views, 1 Reply

Create Circular Pattern in assembly

I'm trying to pattern a component using another components axis in an assembly:

 

 

    Public Sub Pattern()
        Dim oADoc As AssemblyDocument = InvApp.ActiveEditDocument
        Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
        Dim InvPart1 As ComponentOccurrence = oADef.Occurrences.Item(1)
        Dim InvPart2 As ComponentOccurrence = oADef.Occurrences.Item(2)
        Dim oAxis As WorkAxis = InvPart1.Definition.workaxes(1)
        MsgBox("Part1 : " & InvPart1.Name & vbCr & "Part2 : " & InvPart2.Name & vbCr & "Axis : " & oAxis.Name)
        Dim oOccPatterns As OccurrencePatterns = oADef.OccurrencePatterns
        Call oOccPatterns.AddCircularPattern(InvPart2, oAxis, True, "45 deg", 8)
    End Sub

 

The message box proves that it is successfully finding the two compoents and the X Axis of the first component.

It keeps falling over on the last line, when trying to create the pattern, I've tried creating a workaxisproxy but found this made no difference.

 

attached is the assembly file I've been trying it out on

 

Any help with this would be great.