sum hole - ilogic - fx Parameters

sum hole - ilogic - fx Parameters

ivanildo.b
Advocate Advocate
342 Views
2 Replies
Message 1 of 3

sum hole - ilogic - fx Parameters

ivanildo.b
Advocate
Advocate

03.png
When I perform change, I have more holes or less.
I need to count the number of existing hours.
Is there a way to place the number of holes automatically?  fx parameters04.png

0 Likes
Accepted solutions (2)
343 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @ivanildo.b.  I could not use the part you posted, because it must be a 2023 file, and I am still using 2022.4, but I think I have an iLogic rule that will work for a part like that one.  I customized it to use the user parameter you are showing.  It finds the largest face, then finds all interior, circular edges, and counts them.  Then writes that value to the user parameter named "how_many_holes".

Dim oPDoc As PartDocument = ThisDoc.Document
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oBody As SurfaceBody = oPDef.SurfaceBodies.Item(1)
Dim oFaces As Faces = oBody.Faces
Dim oLargestFace As Face
Dim oLargestArea As Double
For Each oFace As Face In oFaces
	If oFace.Evaluator.Area > oLargestArea Then
		oLargestArea = oFace.Evaluator.Area
		oLargestFace = oFace
	End If
Next
Dim oELs As EdgeLoops = oLargestFace.EdgeLoops
Dim oInteriorCircleEdges As Integer
For Each oEL As EdgeLoop In oELs
	If oEL.IsOuterEdgeLoop Then Continue For
	If oEL.Edges.Count = 1 And _
		oEL.Edges.Item(1).GeometryType = CurveTypeEnum.kCircleCurve Then
		oInteriorCircleEdges = oInteriorCircleEdges + 1
	End If
Next
Logger.Info("Interior Circle Edges Count = " & oInteriorCircleEdges)
Parameter("how_many_holes") = oInteriorCircleEdges

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)

0 Likes
Message 3 of 3

ivanildo.b
Advocate
Advocate
Accepted solution

Wonderful! Thanks!

0 Likes