iLogic Automate Assemblies. Quick guide + snippets

iLogic Automate Assemblies. Quick guide + snippets

Anonymous
Not applicable
1,697 Views
5 Replies
Message 1 of 6

iLogic Automate Assemblies. Quick guide + snippets

Anonymous
Not applicable

Since I got some positive feedback on my last post I desided to update the guide a little bit with adding some descriptions.

 

Also changed snippet 3 to detect any file containing whatever you want to detect in the name and return the occurance name as a string to use in the coding.

 

Containing:

1: Dividing lengths equal with a maximum length

2: Dividing length into standard parts with a variable length

3: For each component with “” in the name

4: Adding parts in a loop

5: Creating and Saving parts with unique part identities based on parameters

6: Main assembly replace unique parts with the created parts in 5

7: Call rules subassembly and parts stand alone

Accepted solutions (1)
1,698 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Accepted solution

Just a reply to accept so people don't get confused.

0 Likes
Message 3 of 6

sam
Advocate
Advocate

Very helpful document. 

Can you please explain rule number 4 (Adding parts in a loop) in a little bit more detail?

Best regards, 

Sam

0 Likes
Message 4 of 6

Anonymous
Not applicable

Ofcourse anything in particular that you don't understand?

 

And thank you for the reply.

Message 5 of 6

Anonymous
Not applicable

So here's a little run down of snippet 4.

 

first of all I used snippet 1 to determine the length and amount of parts i wanted to place. 

Double A will be the amount of parts and B the total length of the parts after this code.

 

Then I used a C for the amount of placed parts through the code. assuming you have always your first part placed, and G for the count of how many relationships i've placed. 

 

After that i put in a repeating loop for when the placed parts are less than the amount of parts calculated.

(Do While C < A)

....

Loop

 

Next used some variables to update the following, and don't forget to turn parameters.quiet to true

D as double for the to be placed part, C is the amount of parts placed so to use it in a loop it should be +1 for the part that's going to be placed down in the loop.

Then E as String = C. This is to use C in the coding for component.and Constrains.AddFlush (will be reverenced as E)

And F as String = D for the same reason.

 

Then I used Test1 for the filepath of the part i want to place (choose your own name = "filepath")

 

After that I used 3 times Constraints.AddFlush to constraint the parts with the plains.

I did this 2 times to line up the parts and 1 time to place the parts away from each other with the calculated length (B) in snippet 1.

 

it starts with Components Add. so it  will each time add a component when C (the amount placed) < A (the amount needed)

Here i reverenced to:

"Test1:" & D (this is for the to be placed partname and reverence for inventor) so each time this will run Test1:1, Test1:2, Test1:3 excetra.

Test1 (reverence to the filepath)

The rest is standard from the snippet in Ilogic

 

The code follows up with a constraint for the distance wich will be B on the XY Plane and 2 constrains to line up the other plaines. (Constrains.AddFlush)

Here's a little rundown of how I did this. and the non moving planes.

"Flush" & G (for the updated flushcount. This will loop infinite.)

"Test1:" & F (This will access the just placed part in the loop)

"Test1:" & E (This will access the previous placed part in the loop)

offset := B (will mean that the constraint will be moved on the planes with the calculated length in snippet 1)

 

After Each constraint I updated G

G = G + 1 (so the constraints get their own identity number)

 

After each loop I updated C

C = C + 1 (To update the amount of parts I placed)

 

Please note:

Test1 is the reverence to the filepath and is brown in the coding.

"Test1:" is the filename of the part.

 

I did my best to explain it in a short way, if you have any further questions about this code feel free to ask.

 

Message 6 of 6

sam
Advocate
Advocate

Dear @Anonymous, 

thanks for explaining the code. I will try and test it on my parts today and will ask you some more questions. I hope you don't mind me keep asking you. 

regards, 

Sam