Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Inventor 2022
API VB.NET Visual Studio
I try to make a BoundaryPatch for Each inside Edgeloop from a Face.
I make only 1 Surrafce. How to do this for each Inside Edgeloop ?
Where is the problem?
This is my Code:
Public Sub CommandFunctionfweButton_13()
Dim oPartDoc As PartDocument = g_inventorApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oTO As TransientObjects = g_inventorApplication.TransientObjects
Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry
Dim oFaceTopBody As Face = CType(g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick a FaceTopBody"), Face)
Dim oEdge As Edge
Dim oEdgeColl As EdgeCollection = oTO.CreateEdgeCollection
If oFaceTopBody IsNot Nothing Then
For Each oEdgeloop As EdgeLoop In oFaceTopBody.EdgeLoops
If Not oEdgeloop.IsOuterEdgeLoop Then
For Each oEdge In oEdgeloop.Edges
oEdgeColl.Add(oEdge)
Next
Dim oBoundaryPatchDef As BoundaryPatchDefinition
oBoundaryPatchDef = oCompDef.Features.BoundaryPatchFeatures.CreateBoundaryPatchDefinition
Call oBoundaryPatchDef.BoundaryPatchLoops.Add(oEdgeColl)
For i = 1 To oEdgeColl.Count
For Each oEdge In oEdgeColl
Call oBoundaryPatchDef.BoundaryPatchLoops.Item(i).SetBoundaryCondition(oEdge, BoundaryPatchConditionEnum.kFreeBoundaryPatchCondition)
Next
Dim oBoundaryPatch As BoundaryPatchFeature
oBoundaryPatch = oCompDef.Features.BoundaryPatchFeatures.Add(oBoundaryPatchDef)
Next
End If
Next
End If
End Sub
Second Code:
Public Sub CommandFunctionfweButton_14()
Dim oPartDoc As PartDocument = g_inventorApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oTO As TransientObjects = g_inventorApplication.TransientObjects
Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry
Dim oFaceTopBody As Face = CType(g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick a FaceTopBody"), Face)
Dim oEdge As Edge
Dim oEdgeColl As EdgeCollection = oTO.CreateEdgeCollection
If oFaceTopBody Is Nothing Then Return
For Each oEdgeloop As EdgeLoop In oFaceTopBody.EdgeLoops
If oEdgeloop.IsOuterEdgeLoop Then Continue For
For Each oEdge In oEdgeloop.Edges
oEdgeColl.Add(oEdge)
Next
Dim oBoundaryPatchDef As BoundaryPatchDefinition
oBoundaryPatchDef = oCompDef.Features.BoundaryPatchFeatures.CreateBoundaryPatchDefinition
Call oBoundaryPatchDef.BoundaryPatchLoops.Add(oEdgeColl)
For Each oEdge In oEdgeColl
Call oBoundaryPatchDef.BoundaryPatchLoops.Item(1).SetBoundaryCondition(oEdge, BoundaryPatchConditionEnum.kFreeBoundaryPatchCondition)
Next
Dim oBoundaryPatch As BoundaryPatchFeature
oBoundaryPatch = oCompDef.Features.BoundaryPatchFeatures.Add(oBoundaryPatchDef)
Next
End Sub
Only 1 Surface
Thanks for Any Suggestion
Solved! Go to Solution.