Community
Dears,
I'm trying working with DrawingViewHatchRegion to return the SolidBody.
Could you help me how to highlight the body that include a cross hatch. I'm working with these code:
Sub Main()
Dim _InventorApp As Application = ThisApplication
Dim oDOC As DrawingDocument = _InventorApp.ActiveDocument
Dim oSelectSet As SelectSet = oDOC.SelectSet
oSelectSet.Clear()
Dim oView As DrawingView = _InventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a View to Edit.")
If oView Is Nothing Then Exit Sub
If oView.ViewType = DrawingViewTypeEnum.kSectionDrawingViewType Then
Dim oSecView As SectionDrawingView = oView
If oSecView.HatchRegions.Count() > 0 Then
For Each oHR As DrawingViewHatchRegion In oSecView.HatchRegions
Dim oSB As SurfaceBody = oHR.SurfaceBody
MsgBox(oSB.Name)
'NEED CODE THAT CAN HIGHLIGHT EACH BODY HAS GOT HATCH REGION
oSelectSet.Select(oSB) 'NOT WORKING....
Next
End If
End If
End Sub
Thanks,
Solved! Go to Solution.
Solved by Michael.Navara. Go to Solution.
You need to select DrawingCurveSegments in drawing view. Try this code modification
Sub Main
Dim _InventorApp As Application = ThisApplication
Dim oDOC As DrawingDocument = _InventorApp.ActiveDocument
Dim oSelectSet As SelectSet = oDOC.SelectSet
oSelectSet.Clear()
Dim oView As DrawingView = _InventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a View to Edit.")
If oView Is Nothing Then Exit Sub
If oView.ViewType = DrawingViewTypeEnum.kSectionDrawingViewType Then
Dim oSecView As SectionDrawingView = oView
If oSecView.HatchRegions.Count() > 0 Then
For Each oHR As DrawingViewHatchRegion In oSecView.HatchRegions
Dim oSB As SurfaceBody = oHR.SurfaceBody
MsgBox(oSB.Name)
'NEED CODE THAT CAN HIGHLIGHT EACH BODY HAS GOT HATCH REGION
'oSelectSet.Select(oSB) 'NOT WORKING....
Dim coll As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each curve As DrawingCurve In oView.DrawingCurves(oSB)
For Each seg As DrawingCurveSegment In curve.Segments
coll.Add(seg)
Next
Next
oSelectSet.SelectMultiple(coll)
Next
End If
End If
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.