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.