Hello,
I was wondering if anyone knows how to change the Design View Reps of the members of a pattern using iLogic or A.P.I. code.
I have been working on a rule to do this, but the best I've been able to do is get the pattern members Design View reps to change to "Master".
I need them to be set to "Default".
Also, the number of members in the pattern varies and that is why I cannot manually change the Design View Representation to "Default" and check the Assocciative checkbox. When the number in the pattern changes, the Design View Reps are reset to Master.
Can anyone help with this?
Hi,
I may need to get your assembly to test this. Below is the VBA code I used with my simple assembly and it is changing the active view rep of pattern elements.
In the assembly I am testing with, "View1" has a component that is not visible. When I run the code the component displays if one of these lines is uncommented.
' oCC.SetDesignViewRepresentation ("Default")
'oCC.SetDesignViewRepresentation ("Master")
Public Sub occPatternRep_Test()
Dim occPats As OccurrencePatterns
Set occPats = ThisApplication.ActiveDocument.ComponentDefinition.OccurrencePatterns
Dim occPat As OccurrencePattern
Set occPat = occPats.Item(1)
Dim circOctPat As CircularOccurrencePattern
Set circOctPat = occPat
Dim occPatElem As OccurrencePatternElement
Dim oCC As ComponentOccurrence
For Each occPatElem In circOctPat.OccurrencePatternElements
' Get the component used by OccurrencePatternElement
Set oCC = occPatElem.Components(1)
'Change the design view
' oCC.SetDesignViewRepresentation ("Default")
oCC.SetDesignViewRepresentation ("View1")
'oCC.SetDesignViewRepresentation ("Master")
Next
End Sub
Thanks,
Wayne
Hello Wayne,
My assembly has multiple patterns.
How can I have the code locate the specific pattern name in the tree, count the number of members in the pattern and then switch their design view reps to "Default"?
Len
Hi Len,
You can use the name property of the OccurrencePattern in a for loop to find the pattern. The
OccurrencePatternElements.Count property will get the number of OccurrencePatternElement. Here is a VBA example I tested.
Public Sub occPatternRep_Test2()
Dim occPats As OccurrencePatterns
Set occPats = ThisApplication.ActiveDocument.ComponentDefinition.OccurrencePatterns
Dim occPat As OccurrencePattern
Dim occPatElem As OccurrencePatternElement
Dim oCC As ComponentOccurrence
For Each occPat In occPats
' Finding the pattern using the name
' If occPat.Name = "Component Pattern 2:1" Then
If occPat.Name = "Component Pattern 3:1" Then
'If occPat.OccurrencePatternElements.Count = 4 Then
If occPat.OccurrencePatternElements.Count = 2 Then
For Each occPatElem In occPat.OccurrencePatternElements
' Get the component used by OccurrencePatternElement
Set oCC = occPatElem.Components(1)
'Change the design view
oCC.SetDesignViewRepresentation ("Default")
' oCC.SetDesignViewRepresentation ("View1")
Next occPatElem
End If
Exit For
End If
Next occPat
End Sub
Thanks,
Wayne