- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
with much help from this forum and the AU, I'm delevoping an iLogic rule that creates dimensions between points on a idw.
I read the points from an excel table and run thru the Occurence of my Assembly to find the Points and add a linear dimension to those points.
However, this is working if all the points are found in my model. But if Points doesn't exists the rule throws me an Object or with block variable not set Error.
I use this Function to find the points in the Occurences and return the Occurence if a Point is found:
Private Function FindPoints(oView As DrawingView, dimPoint As String)
Dim oAssyDoc As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim occ As Object
Dim oDef As Document = Nothing
For Each oOcc As ComponentOccurrence In oAssyDoc.ComponentDefinition.Occurrences
oDef = oOcc.Definition.Document
For Each oWorkPoint As WorkPoint In oDef.ComponentDefinition.WorkPoints
If oWorkPoint.Name = dimPoint Then
occ = oOcc
Else
' It crashes here, when the point I'm looking for is not present in the model, I would just like the function to go on 'and check for the next point without throwing the error and stopping the rule
Exit For
End If
Next
Next
Return occ
End Function
I would appreciate your help and any advice that points me to the solution.
Thanks
Sebastian
Solved! Go to Solution.