Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic part insertion

56 REPLIES 56
SOLVED
Reply
Message 1 of 57
Anonymous
21317 Views, 56 Replies

ilogic part insertion

I am working on an assembly with lots of parts that are turned on and off (Component.IsActive) using ilogic, depending on which is selected. The model is for a steel door, and the parts we have constrained are all the various options for hardware, such as lock cases and door closers. All the parts are already set up in a library, but are also present in our top level assembly.

 

As the assembly is getting bloated with all the parts and constraints, I was wondering if it was possible to have ilogic automatically insert (and constrain) a part from a library into the active assembly, not just unsuppress a previously inserted part.

 

Does anyone know of a way to do this with ilogic?

 

Inventor 2013 SP1

 

 

56 REPLIES 56
Message 21 of 57
Anonymous
in reply to: Anonymous

Okay, First of all you are not making the hinge with ilogic......

You will use ilogic to control which hinge it is used, the quantity and the position.

 

Sounds like you want to make the Hinge a ipart or iassembly then your 18,22,28,30 and 34" would be members of the factory. This would take care of the number of holes in the hinge

Is the hinge a part or an assembly?

This is where i would start first

Message 22 of 57
Anonymous
in reply to: Anonymous

In the grand scheme of things, I need to be able to type in the size of my door, and iLogic select the appropriate hinge (2 different types) and install them in the correct location , or either the left or the right side of the door. I guess since I already have the door sizing rule working correctly, the next step is ipart right?
Message 23 of 57
Anonymous
in reply to: Anonymous

yes it would appear so
Message 24 of 57
Anonymous
in reply to: Anonymous

Okay. I have my hinge drawn. What do you recommend as my next step? I am going to guess write rules specifing that the 18 in. hinge has 3 holes and they are 6 in. apart and so on. I created it as an iPart and made like 4 more hinges, so are those "rules" already written?

Message 25 of 57
Anonymous
in reply to: Anonymous

Okay. I have my hinge drawn. What do you recommend as my next step? I am going to guess write rules specifing that the 18 in. hinge has 3 holes and they are 6 in. apart and so on. I created it as an iPart and made like 4 more hinges, so are those "rules" already written?

 

No, there are no ilogic rulesto write to specify the number of holes etc

Create your ipart factory with all the features that are required in the members  for example  create it with 4 holes then in each member either suppress or Compute those features in each member.

In the end you will have a number of members which correspond to each of your hinges

no ilogic required

Message 26 of 57
Anonymous
in reply to: Anonymous

Yup, I figured that one out 🙂 So how do I tell the program which form of the hinge should be installed when the door width is within a certain range?

-Jonathon Wood A-101
Message 27 of 57
Anonymous
in reply to: Anonymous

okay..........here goes

 

Assemble your ipart factory component into your assembly...........you will be prompted to select a member, choose one doesnt matter which right now.

Then stabalize the name in the model tree.........lets imagine you rename it to MyHinge

Then you need to decide what "logic" you are going to use to decide which hinge will be used.

 

I am going to make an assumption here

lets say  you have 3 different hinges SMALL, MEDIUM and LARGE

and the width of the door is the deciding factor as to which hinge to use

 

So you would have a parameter with the door width value............lets say its named DOOR_WIDTH

 

There are a few ways the code to swap the hinge member out this is one way

 

Select Case DOOR_WIDTH

 

Case 20 

iPart.ChangeRow("MyHinge","small")

 

Case 30

iPart.ChangeRow("MyHinge","medium")

 

Case 40

iPart.ChangeRow("MyHinge","large")

 

end select

Message 28 of 57
Anonymous
in reply to: Anonymous

What does the case number mean?

-Jonathon Wood A-101
Message 29 of 57
Anonymous
in reply to: Anonymous

Message 30 of 57
Anonymous
in reply to: Anonymous

Ok, I created this hinge yesterday as an ipart and placed it into an assembly. I can select all 5 sizes, but it out puts the same size each time.... what did I do wrong?


-Jonathon Wood A-101
Message 31 of 57
Anonymous
in reply to: Anonymous

Not a lot of information to know what is wrong.

 

Did your ilogic rule for changing out the members run with no errors?

Post your code

What version of Inventor are you using

Message 32 of 57
Anonymous
in reply to: Anonymous

Yes it ran with no errors, I am using 13. Here is my code
If Length = "18" Then
MultiValue.SetList("Space", 5.8125, "6.6875 in", 7.79166666, 8.4375, 9.875)
MultiValue.SetList("holes", "3 ul", 4)
holes = 3 ul
Else If Length = "22" Then
MultiValue.SetList("Space", "5.8125", 6.6875 in, 7.79166666, 8.4375, 9.875)
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul

Else If Length = "28" Then
MultiValue.SetList("Space", 5.8125, 6.6875 in, "7.79166666", 8.4375, 9.875)
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul
Else If Length= "30" Then
MultiValue.SetList("Space", 5.8125, 6.6875 in, 7.79166666, "8.4375", 9.875)
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul
Else If Length = "34" Then
MultiValue.SetList("Space", 5.8125, 6.6875 in, 7.79166666, 8.4375, "9.875")
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul
End If


Thank you all for all of your help!

-Jonathon Wood A-101
Message 33 of 57
Anonymous
in reply to: Anonymous

No part of the code you posted changes the ipart member

Message 34 of 57
Anonymous
in reply to: Anonymous

Oh..... How do I write that?
Message 35 of 57
Anonymous
in reply to: Anonymous

I gave you an example of how to do that in an earlier post
Message 36 of 57
Anonymous
in reply to: Anonymous

Sorry about that, I must have missed that

Is this correct?

Case 1
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-18")
Case 2
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-22")
Case 3
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-28")
Case 4
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-30")
Case 5
iPart.ChangeRow(

-Jonathon Wood A-101
Message 37 of 57
Anonymous
in reply to: Anonymous

almost! you need to add Select Case and End select at the end
Also after Select case add the parameter name you are using. The one that has values 1,2,3,4,5
Message 38 of 57
Anonymous
in reply to: Anonymous

If Length = "18" Then
MultiValue.SetList("Space", 5.8125, "6.6875 in", 7.79166666, 8.4375, 9.875)
MultiValue.SetList("holes", "3 ul", 4)
holes = 3 ul
Else If Length = "22" Then
MultiValue.SetList("Space", "5.8125", 6.6875 in, 7.79166666, 8.4375, 9.875)
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul

Else If Length = "28" Then
MultiValue.SetList("Space", 5.8125, 6.6875 in, "7.79166666", 8.4375, 9.875)
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul
Else If Length= "30" Then
MultiValue.SetList("Space", 5.8125, 6.6875 in, 7.79166666, "8.4375", 9.875)
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul
Else If Length = "34" Then
MultiValue.SetList("Space", 5.8125, 6.6875 in, 7.79166666, 8.4375, "9.875")
MultiValue.SetList("holes", 3 ul, "4 ul")
holes = 4 ul
End If
Select Case "1,2,3,4,5"
Case 1
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-18")
Case 2
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-22")
Case 3
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-28")
Case 4
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-30")
Case 5
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-34")
End Select
Message 39 of 57
Anonymous
in reply to: Anonymous

No that will not work

I think you need this

 

Select Case Length
Case 18
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-18")
Case 22
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-22")
Case 28
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-28")
Case 30
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-30")
Case 34
iPart.ChangeRow("Rolled Barrel Strap Hinge","H-316RB-34")
End Select

 

 

Message 40 of 57
Anonymous
in reply to: Anonymous

Here is the error message I got 😕 I can taste how close this is haha

Error in rule: strap_size, in document: Rolled Barrel Strap Hinge.ipt

Object reference not set to an instance of an object.

-Jonathon Wood A-101

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

Post to forums  

Autodesk Design & Make Report