Hello, good afternoon. I am currently developing an addin for inventor in C# where one part is to obtain a face of a piece, where this face does or does have holes. Then, select a new sketch on the face plane and make a projection of the geometry of the edges of the holes. Currently I can select all edges of faces, but I have not been able to select edges of closed figures present on the face. How could I select edges of closed contours present on the face and apply geometric projection to them? I appreciate any help and good afternoon.
When selecting the contours of the closed holes I would like to iterate between them to make modifications to them one by one. What could be applied there?
pieza inicial:
Logro actual usando ilogic en C#:
lo que se desea:
1)
2)
3)
Solved! Go to Solution.
Solved by Stakin. Go to Solution.
Solved by WCrihfield. Go to Solution.
Solved by davidt162003. Go to Solution.
Im presuming by looking at your model tree you made two cuts using the one extrusion. if you are able to go find the required edges by going through that extrusion.
dim extrusionList as new list(of extrude feature)
For each pEx as extrude feature in compdef.features.extrudefeatures
if pEx.name.contains("HoleCut")then extrusionList.Add(pEx)
next
ive done it as a list/for loop because the easier workflow would be to model on a feature by feature basis. So have 2 extrusions for two holes. then use each extrusion project the faces/edges you need. you may want to do some interrogation and put it in a try catch block so it dose not break for invalid edges.
if you cant do two sketch for each extrusion their are still things you can do by comparing the faces/edges of the single extrusion to separate them out but that gets quite long winded
Hi @a20196216. There is another way to get only the edges that form a closed loop, and only on the interior of a part face. It is by iterating the Face.EdgeLoops collection, and while iterating them, you can check the EdgeLoop.IsOuterEdgeLoop property. When that property is False, you know you have an interior edge loop. Below is a super simple iLogic rule you can test its functionality with. This does not address your need to project geometry, but might help along the way towards your end goal. But if there are multiple interior closed loops, and you only want to select one specific one, then you will have to inspect each of its Edges further to determine what made them.
Dim oPickedFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select a flat face.")
If oPickedFace Is Nothing Then Return
Dim oDoc As Document = oPickedFace.Parent.ComponentDefinition.Document
Dim oHLS As HighlightSet = oDoc.CreateHighlightSet()
For Each oEL As EdgeLoop In oPickedFace.EdgeLoops
If oEL.IsOuterEdgeLoop Then Continue For
For Each oEdge As Edge In oEL.Edges
oHLS.AddItem(oEdge)
Next 'oEdge
Next 'oEL
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
Sub Main
Dim oDoc As PartDocument
oDoc=ThisApplication.ActiveDocument
Dim oSelectSet As SelectSet
oSelectSet = oDoc.SelectSet
oSelectSet.Clear
Dim oFace As Face
oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick a Face")
Dim oSurfaceBody As SurfaceBody
oSurfaceBody = oFace.Parent
Dim oEdgeLoop As EdgeLoop
For Each oEdgeLoop In oFace.EdgeLoops
If Not oEdgeLoop.IsOuterEdgeLoop Then
For Each oEdge As Edge In oEdgeLoop.Edges
oTransientKey=oEdge.TransientKey
For Each oCEdge As Edge In oSurfaceBody.ConvexEdges
Dim oCTransientKey As Long
oCTransientKey=oCEdge.TransientKey
If oCTransientKey=oTransientKey Then
oSelectSet.Select(oEdge)
End If
Next
Next
End If
Next
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.