ilogic - find occurence in pattern with name

ilogic - find occurence in pattern with name

mark.almack
Enthusiast Enthusiast
623 Views
1 Reply
Message 1 of 2

ilogic - find occurence in pattern with name

mark.almack
Enthusiast
Enthusiast

I'm wanting to filter out occurences that are in "Rectangular Pattern:1". Something like this:

 

For Each oOcc As ComponentOccurrence In oOcc_s
 If oOcc.IsPatternElement 
  If oOcc.PatternElement.Parent.Name = "Rectangular Pattern:1"
Do stuff here

oOcc.PatternElement.Parent.Name is not  thing though. anyone know how to get the thing?

 

Regards

 

Mark

0 Likes
Accepted solutions (1)
624 Views
1 Reply
Reply (1)
Message 2 of 2

mark.almack
Enthusiast
Enthusiast
Accepted solution

Sussed it if anyone else is interested:

 

Class ThisRule

	Dim oOccList As New ArrayList
	
Sub Main()
    Dim oDoc As Document = ThisApplication.ActiveDocument
    Dim OPS As OccurrencePatternElements = oDoc.ComponentDefinition.OccurrencePatterns.Item("Rectangular Pattern:1").OccurrencePatternElements
    Dim OP As OccurrencePatternElement
    For Each OP In OPS
        SubAsm(OP.Occurrences)
    Next
	
	For i = 0 To oOccList.count - 1
		oText = oText & oOccList(i) & vbCrLf
	Next
    
	MessageBox.Show(oText, "Title")
	
End Sub

Sub SubAsm(oOccs As ComponentOccurrencesEnumerator)
    Dim oOcc As ComponentOccurrence
    For Each oOcc In oOccs
        Dim OcName As String = oOcc.Name
        oOccList.Add(OcName)
    Next
End Sub 


End Class