Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Inventor API Boundary patch for Each Inside Edgeloop

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
florian_wenzel
281 Views, 8 Replies

Inventor API Boundary patch for Each Inside Edgeloop

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

florian_wenzel_0-1662033994528.png

 

 

 

Thanks for Any Suggestion

8 REPLIES 8
Message 2 of 9

from a quick glance, looks like you are not clearing your edge collection...

try either deleting it after the patch, or limit it's scope to the For-Loop

Message 3 of 9

Hi Lucas.dolinarVFXZU.

 

Thanks for Solution.

it Works 🙂

florian_wenzel_0-1662039232541.png

 

 

 

Message 4 of 9

🙂

can you tell me what you're doing with that patch?
is it for some calculations?

Message 5 of 9

Hi,

 

exactly what you said before.

oEdgeColl.Clear

 

 

Code:

Imports System.Runtime.InteropServices
Imports Inventor
Imports Microsoft.Win32
Imports System.Collections.Generic
Imports System.Linq
Imports System.IO

Module CommandFunctionButton_14


    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
        Dim oBoundaryPatch As BoundaryPatchFeature


        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


            oBoundaryPatch = oCompDef.Features.BoundaryPatchFeatures.Add(oBoundaryPatchDef)

            oEdgeColl.Clear()

        Next
Message 6 of 9

no, i meant:
why do you need those patches?

does some machine need that? or some other reason?

Message 7 of 9

actualy, to make Holes in other Surface, with ThicknesFeature Symetric,  and then Bool Diference Cut etc...

its a Fragment of a Biger Code

Message 8 of 9

Ah, i see.
professional automation 🙂

 


thx for answering

Message 9 of 9

Hi,
i try my best 🙂
step by step, it's gonna be better someday.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report