Inventor iLogic - Count all holes in the flat pattern

Inventor iLogic - Count all holes in the flat pattern

ryabinina_olya
Contributor Contributor
2,002 Views
8 Replies
Message 1 of 9

Inventor iLogic - Count all holes in the flat pattern

ryabinina_olya
Contributor
Contributor

Hi all!

I want count all holes of various shapes in flat pattern. And features may be different (like hole, cut, extrude...).

I can't count features, because one feature may containe a number of holes. 

Can someone help me with this?

Olga Ryabinina
Professor Assistant in Voronezh State Technical University
0 Likes
Accepted solutions (1)
2,003 Views
8 Replies
Replies (8)
Message 2 of 9

Sergio.D.Suárez
Mentor
Mentor

Hi, All the holes you want to count are cylindrical or are there other ways like "Slots" for example?

Grettings!


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 9

Sergio.D.Suárez
Mentor
Mentor

If you only want to count cylindrical holes this ilogic rule could serve you in any part file.
Analyze the cylindrical surfaces, and then analyze their edges. If there is a deformed hole in a crease, for example, it will not count.

 

Dim oDoc As PartDocument = ThisDoc.Document
Dim oCD As PartComponentDefinition= oDoc.ComponentDefinition
Dim i As Integer = 0

If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
	If oCD.HasFlatPattern = False Then 
		oCD.Unfold
		oCD.FlatPattern.ExitEdit
	End If
	For Each oSolid As SurfaceBody In oCD.FlatPattern.SurfaceBodies
		For Each oFace As Face In oSolid.Faces
			If oFace.SurfaceType = 5891 Then 'kCylinderSurface
				For Each oEdge As Edge In oFace.Edges
					If oEdge.GeometryType = 5124 Then 'kCircleCurve
						i = i + 1
						Exit For
					End If
				Next	
			End If
		Next
	Next
Else	
	For Each oSolid As SurfaceBody In oCD.SurfaceBodies
		For Each oFace As Face In oSolid.Faces
			If oFace.SurfaceType = 5891 Then 'kCylinderSurface
				For Each oEdge As Edge In oFace.Edges
					If oEdge.GeometryType = 5124 Then 'kCircleCurve
						i = i + 1
						Exit For
					End If
				Next	
			End If
		Next
	Next
End If
MessageBox.Show("Number of Holes: " & i)

 I hope this helps with your problem. Regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 4 of 9

ryabinina_olya
Contributor
Contributor

Hi!

I want to count all cuts (cylindrical, rectangular and others), all shapes. I think I need to find way to count all closed loops, but I don't know how

Olga Ryabinina
Professor Assistant in Voronezh State Technical University
0 Likes
Message 5 of 9

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, if it's a metal sheet part, I think this ilogic rule could work. It will count all closed loops in the flatpattern topFace. Subtract 1 because it is the outer loop of the sheet.

Dim oDoc As PartDocument = ThisDoc.Document

If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then

  Dim oCD As SheetMetalComponentDefinition = oDoc.ComponentDefinition
  If oCD.HasFlatPattern = False Then 
	oCD.Unfold
	oCD.FlatPattern.ExitEdit
  End If

  Dim oFace As Face = oCD.FlatPattern.TopFace
  Dim i As Integer = oFace.EdgeLoops.Count-1

  MessageBox.Show("Number of Holes: " & i)

End If

 I hope this helps with your problem. Regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 6 of 9

ryabinina_olya
Contributor
Contributor

Thank you very much!!! It really works!!

Olga Ryabinina
Professor Assistant in Voronezh State Technical University
0 Likes
Message 7 of 9

maxim.teleguz
Advocate
Advocate

would there be a way to count the number of occurrences of a specific component that touches the part? 


0 Likes
Message 8 of 9

WCrihfield
Mentor
Mentor

Hi @maxim.teleguz.  Are you referring to components within an assembly?  If so, I know we have access to an API method for analyzing interference between assembly components.  But I also know that we have a user interface tool on the Inspect tab called Activate Contact Solver that sound like it would be perfect for what you described.  I have never tried to control it by code before though, and not sure if it is possible at the moment.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 9

maxim.teleguz
Advocate
Advocate

for instance, we have a part place tool that adds hardware based off the circle edges that it counts. 

would there be a way to analyze it this way:

select component 1 (typically would be hardware)
select component that #1 is mated to currently.

ilogic will give you a message box of how many times that component occurrence is mated to that component. 

i would like to then take it a step further and see how many times that component is mated to a specific face. 


0 Likes