jmarkus
Mechanical
- Jul 11, 2001
- 377
I have a VB.NET journal which is gathering all the entities on a layer and putting them into a list of NXObject.
I want to loop through the list and remove the objects that are not not visible on the active drawing sheet. There are other drawing sheets in the part file and I don't want to include any objects on those sheets. I'm guessing I need to convert the NXObjects to Displayable objects and then check if the entity is visible since if they are not visible they must reside on the other sheets. I don't know how to check that.
Any suggestions?
Thanks,
Jeff
I want to loop through the list and remove the objects that are not not visible on the active drawing sheet. There are other drawing sheets in the part file and I don't want to include any objects on those sheets. I'm guessing I need to convert the NXObjects to Displayable objects and then check if the entity is visible since if they are not visible they must reside on the other sheets. I don't know how to check that.
Code:
Dim theObjects As New List(Of NXObject)
Dim VisObj As DisplayableObject
theObjects.AddRange(workPart.Layers.GetAllObjectsOnLayer(253))
For Each obj As NXObject In theObjects
[indent]try[/indent]
[indent][indent]VisObj=CType(obj, DisplayableObject)[/indent][/indent]
[indent][indent]'If VisObj is not visible then[/indent][/indent]
[indent][indent][indent]theObjects.Remove(obj)[/indent][/indent][/indent]
[indent][indent]End If[/indent][/indent]
[indent]end try[/indent]
Next
Any suggestions?
Thanks,
Jeff