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: 

Select only the internal hole edges of a face

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
a20196216
354 Views, 3 Replies

Select only the internal hole edges of a face

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:

a20196216_1-1710199255122.png

 

Logro actual usando ilogic en C#: 

a20196216_2-1710199289028.png

 

lo que se desea: 

1) 

a20196216_3-1710199328625.png

2) 

a20196216_4-1710199345279.png

3)

a20196216_5-1710199363149.png

 

 

3 REPLIES 3
Message 2 of 4
davidt162003
in reply to: a20196216

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 

HII
Message 3 of 4
WCrihfield
in reply to: a20196216

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

EESignature

(Not an Autodesk Employee)

Message 4 of 4
Stakin
in reply to: a20196216

Stakin_0-1710254624312.png

 

Stakin_1-1710254646881.png

 

 

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

Stakin_2-1710254711871.pngStakin_3-1710254756859.png

 

 

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

Post to forums  

Autodesk Design & Make Report