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: 

Multi-Value, table or key in iAssembly

7 REPLIES 7
Reply
Message 1 of 8
jcox150
431 Views, 7 Replies

Multi-Value, table or key in iAssembly

I have created several iAssemblies for work, Pipe Guides and Achors that change design slightly by the size of Pipe that it will be supporting. I need to set up a independant Key/Table/Multi-Value that can be selected when inserting the iAssembly into the main assembly depending on the size of Cylinder that the Pipe Guides will mount to. This will allow the radius to be cut and size of other components. 

 

Is there anyway to set up multiple tables or independant key functions...

example.. insert into main assembly.

 

select 6" tandem Pipe guide.

and also select a 42" Stack (or whatever size it is from 16"-72") for the cut out.

 

Thanks,

Joel Cox

 

7 REPLIES 7
Message 2 of 8
16101972
in reply to: jcox150

Hi Joel,

 

According to my oppinion it is impossible with "Place" command, but you can solve it through iLogic. Do you have experience with iLogic?

 

Regards,

Nedeljko.

 

Message 3 of 8
jcox150
in reply to: 16101972

I do, but unfortunately the people im creating the assemblies for does not, and they cant seem to unsderstand how much better life can be if they would at least try to work with it. Is there a way to use an ilogic rule with the iassembly when you insert it into another assembly?

 

I originally was going to make this as a ilogic assembly, i have created a few ilogic assemblies that have worked well, but here, they need parts and assemblies to keep a designated part number... when using "place ilogic part" it just randomizes the part number. (there may be a way, but i couldnt figure out how to make that work)

Message 4 of 8
16101972
in reply to: jcox150

Hi,

 

Unfortunately I did not solve you problem using iLogic. I couldn't get user friendly interface. Only normally solution it can be get using macros. I need trigger event "Before insert new compenent" nad there is no command to insert new iAssembly. If macro is acceptable for you I can send you my solution for inserting iAssemblies.

 

Regards,

Nedeljko.

Message 5 of 8
jcox150
in reply to: jcox150

It's worth a shot. Send it over and I can try it. I'm not too familiar with macros. Will the macro be built into the assembly or will it need to be local? Please send any instructions of use as well. Thanks.
Message 6 of 8
16101972
in reply to: jcox150

Hi,

 

Finally I finished.

 

I am not full satisfied because of combination of iLogic and VBA but it is the simpliest not the smartest. In VBA code and Ilogic program are comments, if you have some questions send me on e-mail sovljaned@gmail.com. If you vary only two paramemters we can use excel table.

And, one more thing. I presume you have pipe guide with some diameters and lenght. For example D=100 and L=120 exist, but D=120 and L=120 don't. In iLogic there is no protection for that case.Because of that users have to be careful when make a choice.

 

regards,

 

Nedeljko.

Message 7 of 8
jcox150
in reply to: 16101972

I should have added, Im using 2013.

Message 8 of 8
16101972
in reply to: jcox150

You are using 2013 and that's mean you can not open the files.

OK.

1. you need to create new assembly.

2. copy following code into modile1 section in DocumentProject in VBA

Sub InsertModel()

Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oOccs As ComponentOccurrences
Set oOccs = oDoc.ComponentDefinition.Occurrences

Dim oPos As Matrix
Set oPos = ThisApplication.TransientGeometry.CreateMatrix

' Add an occurrence based on Index parameter (Parameter(3)) which is calculatd in iLogic.
Dim oRow As Integer
oRow = oDoc.ComponentDefinition.Parameters(3).Value

' Add a translation along X axis
Dim oX, oY, oZ As Double
oX = 1
oY = 0
oZ = 0
oPos.SetTranslation ThisApplication.TransientGeometry.CreateVector(oX, oY, oZ)

' you have to your path to the document in AddiAssemblyMember command
Dim oOcc As ComponentOccurrence
Set oOcc = oOccs.AddiAssemblyMember("C:\Users\biro\Documents\Test iAssembly\Assembly1.iam", oPos, oRow)

End Sub

3. Create tree user parameters in Assembly2. Diametar, Lenght, Index. They have to multi-valued parameter. 

Pic1.png

4. Create new form by Add Form in iLogic menu.

5. Put two controls for Diameter nad lenght parameters on the Form.

Pic2.png

6. Create new rule in iLogic and past following code.

iLogicForm.Show("Form 1", FormMode.Modal)

' Diametar, Length and Index are User Parameters in Assembly2 document.
'you have to determine index (row number of assembly in iAssembly)
If Diameter=100 Then aIn=0
If Diameter=125 Then aIn=1
If Length=120 Then bIn=1
If Length=150 Then bIn=2
If Length=180 Then bIn=3
If Length=210 Then bIn=4
If Length=240 Then bIn=5

' For example: D=100 and L=120 =>Index=1
' if you look at iAssembly table you will find the first element is with Diametar 100 and Lenght 120mm, and so on.

Index=aIn*5+bIn

InventorVb.RunMacro("DocumentProject", "Module1", "InsertModel")
iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate()

 7. Now you need to create Assembly1 with ten members.

 

 

IMPORTANT: You have to enter correct path in VBA code. Find red text at the end of code and change it.

 

Run Rule0

 

 

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

Post to forums  

Autodesk Design & Make Report