The question is to to hide the first element of a circular pattern feature of a boundary patch using the API. The first element is the original boundary patch. There are two ways to hide it:
way1:
BoundaryPatchFeature.SurfaceBody.Visible = False
way2:
BoundaryPatchFeature.SurfaceBody.Parent.Visible = False
with way1, before Inventor 2012, the first element is hidden
but if the file is closed and re-opened the first element is visible again. So we have to use way2.
Following is the code demo.
Sub test() Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application") InvApp = System.Runtime.InteropServices.Marshal. GetActiveObject("Inventor.Application") Dim oDoc As PartDocument oDoc = InvApp.ActiveDocument Dim oBoundPatchFeature As BoundaryPatchFeature oBoundPatchFeature = oDoc.ComponentDefinition.Features. CircularPatternFeatures(1).ParentFeatures(1) ' way 1: ' before Inventor 2012, The first element is hidden ' but if the file is closed and re-opened the first ' element is visible. 'oBoundPatchFeature.SurfaceBody.Visible = False 'way 2: Dim oWorkSurface As WorkSurface = oBoundPatchFeature.SurfaceBody.Parent oWorkSurface.Visible = False End Sub

Leave a Reply