Not sure what this message means but I expect that it has something to do with the LINQ commands used. Therefore I rewrote the rule to not use LINQ (but way too many nested loops 😉 Give it a go and let me know.
Dim manager As CommandManager = ThisApplication.CommandManager
Dim curveSegment As DrawingCurveSegment = manager.Pick(
SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select a curve")
Dim curve As DrawingCurve = curveSegment.Parent
Dim edge As Edge = curve.ModelGeometry
Dim view As DrawingView = curve.Parent
Dim refDoc As PartDocument = view.ReferencedDocumentDescriptor.ReferencedDocument
Dim patterns = refDoc.ComponentDefinition.Features.RectangularPatternFeatures
For Each pattern As RectangularPatternFeature In patterns
Dim patternFound As Boolean = False
For Each f As Face In pattern.Faces
For Each e As edge In f.Edges
If (E Is edge) Then
patternFound = True
End If
Next
Next
For Each pf As PartFeature In pattern.ParentFeatures
For Each f As Face In pf.Faces
For Each e As edge In f.Edges
If (E Is edge) Then
patternFound = True
End If
Next
Next
Next
If (patternFound) Then
Dim dimension As DrawingDimension = ThisApplication.CommandManager.Pick(
SelectionFilterEnum.kDrawingDimensionFilter, "Select a dimension")
Dim count As Integer = pattern.XCount.Value - 1
dimension.Text.FormattedText = String.Format("{0} x <DimensionValue/>", count)
End If
Next
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com