- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I'm looking for a code, that will work in a drawing view. I need to hide all solids in all parts in the assembly and subassemblies in that view, that have a "-" in the name (-hole). So it should go through all the parts and all assemblies in that model view and turn off visibility of any solid that have a "-" in the name (or probably easier exact name "-hole").
I did find a code, that kind of works for single part, but I dont know how to make it for assembly and all parts in it. And also the list of solid names is not necessary for me. Here is that code from WCrihfield:
Dim oDDoc As DrawingDocument = ThisDoc.Document Dim oView As DrawingView = oDDoc.ActiveSheet.DrawingViews.Item(1) Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument If oModel.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Dim oPDoc As PartDocument = oModel If oPDoc.ComponentDefinition.HasMultipleSolidBodies = False Then Exit Sub Dim oBodies As SurfaceBodies = oPDoc.ComponentDefinition.SurfaceBodies Dim oBody3 As SurfaceBody = oBodies.Item(3) Dim oBodyGeomInView As DrawingCurvesEnumerator = oView.DrawingCurves(oBody3) If oBodyGeomInView.Count = 0 Then Exit Sub For Each oDC As DrawingCurve In oBodyGeomInView For Each oDCS As DrawingCurveSegment In oDC.Segments oDCS.Visible = False Next Next End If
Thank you all
Solved! Go to Solution.
Link copied