inventor 2013 ilogic length based part suppression /component parameter change

inventor 2013 ilogic length based part suppression /component parameter change

Anonymous
Not applicable
1,790 Views
28 Replies
Message 1 of 29

inventor 2013 ilogic length based part suppression /component parameter change

Anonymous
Not applicable

Let me start by saying I just started using ilogic yeseterday. My company makes transtation crane systems and wants to create automated assemblies. I am the only inventor user here and have been assigned this task. I have started with trying to create a bridge that will adjust lengths and support types based on my entry form. I've created an entry form where you can enter and combination of feet & inches between 5 feet and 34 feet.

 

For lengths 8ft and under, I need to supress the support tube & struts. For lengths between 8'-1" and 20'-0", I need the struts suppressed, the tube attached directly to the track, and the tube to 22" shorter than the track on each side.For lengths 20'-1" to 28'-0", I need the struts turned on, the tube offset by 5" (which drives the length of the struts), & the tube still 22" shorter than the track on each side. For 28'1" and up, it's the same as the previous excepts the tube now needs to be 22.5" shorter than the track on each side.

 

The struts are working and supressing perfectly using if statements. The tube offset is also working great.

 

My problems are changing the tube length equation automatically over a certain length and suppressing the tube for lengths 8'-0" and under.

Also, even though I've selected every possible trigger and put update rules, I still have to hit save before the strut pattern updates.

 

I've being trying using if statements for the tube supression and length eqaution changes but I keep getting errors. I know I'm probably entering it wrong, could someone please help?

 

What I've been trying is variations of the below:

I

If Parameter("LENGTH") <= 96 Then Component.IsActive("TUBE:1") = False
If Parameter("LENGTH") >96 And <= 336 Then Parameter("TUBE:1", "LENGTH") = LENGTH-44
If Parameter("LENGTH") > 336 Then Parameter("TUBE:1", "LENGTH") = LENGTH-45
End If

Here's some pics of different lengths:

Capture1.JPG

Capture2.JPGCapture3.JPG

0 Likes
Accepted solutions (4)
1,791 Views
28 Replies
Replies (28)
Message 21 of 29

Anonymous
Not applicable

here you go...

0 Likes
Message 22 of 29

Anonymous
Not applicable
Accepted solution

So I realized that I can't save and send this back to you since I'm in a later version of inventor.

 

I did, however, get the rule to work. Do yourself a solid and suppress all the rules you currently have in that document. All of them. And remove them from the iTrigger lists as well. Create a new rule and name it however you like, then copy and paste this text into it and give it a read. I've put some explaination within the rule to describe the process.

 

'Get this LOD stuff out of the way...
Dim doc as AssemblyDocument = ThisDoc.Document  
Dim oLOD As LevelOfDetailRepresentation  
Dim oAsmCompDef As ComponentDefinition  
oAsmCompDef = doc.ComponentDefinition 
Try 
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("iLogic").Activate(True)
Catch
Dim nLOD As LevelOfDetailRepresentation
nLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("iLogic")
oLOD = nLOD
Finally
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("iLogic").Activate(True)
End Try

'NUMBER OF STRUTS rule
'I'm going to 'suppress' this portion of the rule because I've determined that I want to
'dictate the number of middle struts elsewhere in the rule.
'NUMBER_OF_MIDDLE_STRUTS = Ceil(LENGTH_STRUT_PATTERN/30)

'LENGTH BETWEEN STRUTS rule.
'I moved this as well.
'LENGTH_BETWEEN_STRUTS = LENGTH_STRUT_PATTERN/NUMBER_OF_MIDDLE_STRUTS

'LENGTH FOR STRUT PATTERN rule.
'I moved this as well.
'LENGTH_STRUT_PATTERN = Measure.MinimumDistance("INNER STRUT:1", "INNER STRUT:2")

'BRIDGE LENGTH rule
LENGTH = (FEET+INCHES)
Parameter("LT-500 TRACK:1", "LENGTH") = LENGTH

'tube length rule
If LENGTH <= 96 Then
	Component.IsActive("TUBE:1") = False
Else If LENGTH > 336 Then
	Component.IsActive("TUBE:1") = True
	Parameter("TUBE:1","LENGTH") = LENGTH - 45
Else
	Component.IsActive("TUBE:1") = True
	Parameter("TUBE:1","LENGTH") = LENGTH - 44
End If

'I believe STRUT LENGTH is the rule in which we can solve the issue. The reason your pattern was throwing
'an error is because you can't pattern something by zero occurances. Therein lies the error. So instead
'of trying to suppress or set the pattern to zero in the instances I need no struts, I'm going to suppress
'the features at the part level (so that no actual part is present) then set the number of occurances to 1.
'This should give the desired result.

If LENGTH <= 240 Then 

	Parameter("OUTTER STRUT:1", "LENGTH") = 1
	Parameter("OUTTER STRUT:2", "LENGTH") = 1
	Parameter("INNER STRUT:1", "LENGTH") = 1
	Parameter("INNER STRUT:2", "LENGTH") = 1

	TUBE_OFFSET = 0

	Constraint.IsActive("Mate:10") = False
	Constraint.IsActive("Mate:9") = False
	Constraint.IsActive("Mate:5") = False
	Constraint.IsActive("Mate:7") = False

	Feature.IsActive("OUTTER STRUT:1", "Extrusion1") = False
	Feature.IsActive("OUTTER STRUT:2", "Extrusion1") = False
	Feature.IsActive("INNER STRUT:2", "Extrusion1") = False
	
	NUMBER_OF_MIDDLE_STRUTS = 1
	LENGTH_STRUT_PATTERN = 1
	LENGTH_BETWEEN_STRUTS = 1
	

Else

	TUBE_OFFSET = 5

	Parameter("OUTTER STRUT:1", "LENGTH") = TUBE_OFFSET
	Parameter("OUTTER STRUT:2", "LENGTH") = TUBE_OFFSET
	Parameter("INNER STRUT:1", "LENGTH") = TUBE_OFFSET
	Parameter("INNER STRUT:2", "LENGTH") = TUBE_OFFSET

	Feature.IsActive("OUTTER STRUT:1", "Extrusion1") = True
	Feature.IsActive("OUTTER STRUT:2", "Extrusion1") = True
	Feature.IsActive("INNER STRUT:2", "Extrusion1") = True

	Constraint.IsActive("Mate:10") = True
	Constraint.IsActive("Mate:9") = True
	Constraint.IsActive("Mate:5") = True
	Constraint.IsActive("Mate:7") = True
	
	LENGTH_STRUT_PATTERN = Measure.MinimumDistance("INNER STRUT:1", "INNER STRUT:2")
	NUMBER_OF_MIDDLE_STRUTS = Ceil(LENGTH_STRUT_PATTERN/30)
	LENGTH_BETWEEN_STRUTS = LENGTH_STRUT_PATTERN/NUMBER_OF_MIDDLE_STRUTS
	
End If

'I think the magic lies in this last line of code and the order that it is in. Part of the problem
'was that an error would occur becuase MIDDLE STRUTS:1 was trying to run with an occurance value of
'zero. And it wouldn't update because the error would 'stop the rule in it's tracks' so to speak. At
'least that's what I'm assuming... anyway... this works.

iLogicVb.UpdateWhenDone = True

 

 Hope this helps.

 

0 Likes
Message 23 of 29

Anonymous
Not applicable

Ok, I did everything you said, but I got this error:

 

Capture7.JPG

0 Likes
Message 24 of 29

Anonymous
Not applicable
Accepted solution

Lol that is quite ironic. All I did was copy the code from the "LOD" rule and paste it into that location. The only thing I can think of is if you do the same. Maybe somehow inventor updated some portion of that code since I'm in a later version? I have no idea.

 

I'd just delete out the portion of the code related to the level of detail and replace it with what you currently have in your LOD rule. If that still fails, then I would consider getting rid of the LOD portion of the rule all together. If this is the assembly you always intend to use this rule in, then you'll always know that there is an "iLogic" level of detail and thus, no need to check for it and create one if it is absent.

 

Let me know 🙂

0 Likes
Message 25 of 29

Anonymous
Not applicable
It worked!!!!! Thank you so much!!!! 😄

I'll hit up if I run into anymore more issues.

You're the best! ❤️
0 Likes
Message 26 of 29

Anonymous
Not applicable

I have another question, if you dont mind.

 

How do I write a rule that looks at two different circumstances and then changes a parameter?

 

I want to add to my form an option to selecting "Festooning" or "No Festooning". If false is selected, the distace to one of the holes on the track should be 1.5. If true is selected, then the hole distance to the edge of the track varies depending on length.

 

I need something along the lines of:

 

If FESTOONING = False Then
Parameter("LT-500 TRACK:1", "hole2_distance") = 1.5 in
End If

If FESTOONING = True  And If  LENGTH <= 120 Then
Then
Parameter("LT-500 TRACK:1", "hole2_distance") = 6 in

Else If FESTOONING = True  And If LENGTH > 241 Then
    Parameter("LT-500 TRACK:1", "hole2_distance") = 20 in
Else
    Parameter("LT-500 TRACK:1", "hole2_distance") = 16.5 in
End If

 

How do I use the "and" properly?

0 Likes
Message 27 of 29

Anonymous
Not applicable
Accepted solution

@Anonymous wrote:

...

 

If FESTOONING = False Then
Parameter("LT-500 TRACK:1", "hole2_distance") = 1.5 in
End If

If FESTOONING = True  And If  LENGTH <= 120 Then
Then
Parameter("LT-500 TRACK:1", "hole2_distance") = 6 in

Else If FESTOONING = True  And If LENGTH > 241 Then
    Parameter("LT-500 TRACK:1", "hole2_distance") = 20 in
Else
    Parameter("LT-500 TRACK:1", "hole2_distance") = 16.5 in
End If

 

How do I use the "and" properly?


Well the function achieved by "And" can be done a couple of different ways. Often times, in the interest of simplicity of train of thought, I like to "stack" If statments. If I were to write what you have here in a stacked if form, it would look like:

'

If FESTOONING = False then

     Parameter("LT-500 TRACK:1","hole2_distance") = 1.5

Else

     If LENGTH <= 120 then

          Parameter("LT-500 TRACK:1","hole2_distance") = 6

     Else if LENGTH > 241 then

          Parameter("LT-500 TRACK:1","hole2_distance") = 20

     Else

          Parameter("LT-500 TRACK:1","hole2_distance") = 16.5

     End If

End If

'

 

OR using "And"

 

'

If FESTOONING = False Then
     Parameter("LT-500 TRACK:1", "hole2_distance") = 1.5 in
Else If FESTOONING = True  And LENGTH <= 120 Then
     Parameter("LT-500 TRACK:1", "hole2_distance") = 6 in
Else If FESTOONING = True  And LENGTH > 241 Then
    Parameter("LT-500 TRACK:1", "hole2_distance") = 20 in
Else If FESTOONING = True Then
    Parameter("LT-500 TRACK:1", "hole2_distance") = 16.5 in
End If

'

 

I'm 99% sure that the 1st version would work (I can't test it, but I can think of no reason it wouldn't work) and I'm 95% sure the second one would work. The only reason I say so much less about the second one is that the last condition in which FESTOONING is true doesn't also have a LENGTH condition as well... which I don't think would be an issue but like I said, I tend to stack IF's so I have less experience using AND.

0 Likes
Message 28 of 29

Anonymous
Not applicable
Ooooh ok! I didn't realize that you could stack them.

They both work perfectly, thanks again so much! 😄
0 Likes
Message 29 of 29

Anonymous
Not applicable

hey, so I tried putting this assembly into another assembly. I noticed that it brought up my form when I first inserted it. Then When I put in a 2nd occurance it didnt bring up my form again (as an option to have one occurance be a different size than the other). Then when I clicked on my form again it was all grayed out....

 

is it possible to have two different versions of the same assembly in an upper level assembly?

0 Likes