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: 

iLogic pattern

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
tds_301
285 Views, 5 Replies

iLogic pattern

tds_301
Explorer
Explorer

I am working on an assembly of plates. I only have two kind of plates. Every 5th plate is different, so it would look like this:

xxxxKxxxxKxxxxKxxxx...

 

I though i was going to solve this by using pattern for the first four X plates and then mate one K plate on top. And then make a new pattern of X plates. After that i planned to use iLogic to hide all plates not relevant. But this would result in me first making a lot of patterns and mating a tall stack. 

 

I would appreciate if someone could please help me by pointing me in a direction to solve this.

 

 

 

0 Likes

iLogic pattern

I am working on an assembly of plates. I only have two kind of plates. Every 5th plate is different, so it would look like this:

xxxxKxxxxKxxxxKxxxx...

 

I though i was going to solve this by using pattern for the first four X plates and then mate one K plate on top. And then make a new pattern of X plates. After that i planned to use iLogic to hide all plates not relevant. But this would result in me first making a lot of patterns and mating a tall stack. 

 

I would appreciate if someone could please help me by pointing me in a direction to solve this.

 

 

 

5 REPLIES 5
Message 2 of 6
AndrewHumiston
in reply to: tds_301

AndrewHumiston
Advocate
Advocate

Are you asking for an ilogic rule to set up the pattern? then be able to suppress specific instances you don't want to see?

0 Likes

Are you asking for an ilogic rule to set up the pattern? then be able to suppress specific instances you don't want to see?

Message 3 of 6
tds_301
in reply to: tds_301

tds_301
Explorer
Explorer

Sort of. In the end I would like to just enter a number, lett say 7. That could generated 7 X and then deleted X number 5 and replaced it with a K. 

0 Likes

Sort of. In the end I would like to just enter a number, lett say 7. That could generated 7 X and then deleted X number 5 and replaced it with a K. 

Message 4 of 6
AndrewHumiston
in reply to: tds_301

AndrewHumiston
Advocate
Advocate

Would you send me two sample part files, and spacing parameters. i think i under stand what you are asking, but it might require configuriing the parts to have the right planes to make the swapping easier.

0 Likes

Would you send me two sample part files, and spacing parameters. i think i under stand what you are asking, but it might require configuriing the parts to have the right planes to make the swapping easier.

Message 5 of 6
Curtis_Waguespack
in reply to: tds_301

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@tds_301 

 

See the attached Inventor 2023 files and code below, for an example using logic to place and constrain as a pattern, vs using an Inventor feature pattern.

 

Dim oCount As Integer

'get user input
Try
	oCount = InputBox("Enter # of plates", "iLogic", Parameter("PlateCount"))
	Parameter("PlateCount") = oCount
Catch
	Exit Sub
End Try

oPrefix = "Plate"

ThisAssembly.BeginManage("Plate Group")

If oCount = 0 then exit sub

pad = "0"

'add the first plate and ground it
Dim oComp1 As String = oPrefix & pad & 1
Components.Add(oComp1, "Plate_X.ipt“, , True)
oOffset = Parameter(oComp1, "Thickness")

'add each remaining plate and costrain it to the assembly origin planes
For i = 2 To oCount

	If i > 9 Then pad = ""
	Dim oCompName As String = oPrefix & pad & i

	If i Mod 5 <> 0 Then 'if not divisible by 5
		Components.Add(oCompName, "Plate_X.ipt")
	Else
		Components.Add(oCompName, "Plate_K.ipt")
	End If

	'constrain the plate
	Constraints.AddMate("", "", "XY Plane", oCompName, "XY Plane")
	Constraints.AddMate("", "", "YZ Plane", oCompName, "YZ Plane")
	Constraints.AddFlush("", "", "XZ Plane", oCompName, "XZ Plane", offset := oOffset)

	oOffset = oOffset + Parameter(oCompName, "Thickness") 'update offset to include this plate
Next
ThisAssembly.EndManage("Plate Group")
ThisApplication.ActiveView.fit 

 

@tds_301 

 

See the attached Inventor 2023 files and code below, for an example using logic to place and constrain as a pattern, vs using an Inventor feature pattern.

 

Dim oCount As Integer

'get user input
Try
	oCount = InputBox("Enter # of plates", "iLogic", Parameter("PlateCount"))
	Parameter("PlateCount") = oCount
Catch
	Exit Sub
End Try

oPrefix = "Plate"

ThisAssembly.BeginManage("Plate Group")

If oCount = 0 then exit sub

pad = "0"

'add the first plate and ground it
Dim oComp1 As String = oPrefix & pad & 1
Components.Add(oComp1, "Plate_X.ipt“, , True)
oOffset = Parameter(oComp1, "Thickness")

'add each remaining plate and costrain it to the assembly origin planes
For i = 2 To oCount

	If i > 9 Then pad = ""
	Dim oCompName As String = oPrefix & pad & i

	If i Mod 5 <> 0 Then 'if not divisible by 5
		Components.Add(oCompName, "Plate_X.ipt")
	Else
		Components.Add(oCompName, "Plate_K.ipt")
	End If

	'constrain the plate
	Constraints.AddMate("", "", "XY Plane", oCompName, "XY Plane")
	Constraints.AddMate("", "", "YZ Plane", oCompName, "YZ Plane")
	Constraints.AddFlush("", "", "XZ Plane", oCompName, "XZ Plane", offset := oOffset)

	oOffset = oOffset + Parameter(oCompName, "Thickness") 'update offset to include this plate
Next
ThisAssembly.EndManage("Plate Group")
ThisApplication.ActiveView.fit 

 

Message 6 of 6
tds_301
in reply to: tds_301

tds_301
Explorer
Explorer

Exactly what I had in mind! In the version 2 of the file you have also read my mind. 

 

Thank you for your knowledge and time.

Exactly what I had in mind! In the version 2 of the file you have also read my mind. 

 

Thank you for your knowledge and time.

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

Post to forums  

Autodesk Design & Make Report