inventor 2013 ilogic length based part suppression /component parameter change

inventor 2013 ilogic length based part suppression /component parameter change

Anonymous
Not applicable
1,778 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,779 Views
28 Replies
Replies (28)
Message 2 of 29

mdavis22569
Mentor
Mentor

Try the Inventor Customization board ... a lot of Ilogic people over there ...

 

 

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 3 of 29

Anonymous
Not applicable
Ok I'll post there as well. Thanks.
0 Likes
Message 4 of 29

Anonymous
Not applicable

Just to make sure that the problem isn't this: You are using "Else If" right? Not just IF?

 

Because if you are simply using "IF", then it is stacking and that is why your rule is not functioning properly. Think of it as layering IF statements

 

IF Layer1 = True then

 

Condition

 

         IF Layer1 = False then

 

          Condition

      

          End IF

 

End IF

 

In the above scenario, the false possibility and conditions therefrom are never visited UNLESS Layer1=True. Then the possibility of it being false is checked which (obviously) wouldn't implement because it has to be true to get there.

 

IF Layer1 = True then

 

Condition

 

Else If Layer1 = False then

 

Condition

 

End if

 

This scenario will check both possibilities and apply the condition accordingly.

 

I'm surprised it doesn't have you put End IF after each one. I know later Inventor versions force you to End all IFs. Maybe this is was different for 2013? Or maybe I've misunderstood the issue at hand?

0 Likes
Message 5 of 29

Anonymous
Not applicable

I've tried it so many different ways. That's just one example. It gives me errors about the "end if" whether it's there or not. When I put it in, it tells me there needs to be a preceding "if", even thought there is. When I take it out, it says end of statement expected. 

I've tried the "else if" too and I still got errors. I just don't get it cause it works on my other rule for the struts. I know I must be doing it wrong, I'm just really new at this.


Looking at what I have, can you tell me how you would rewrite it?

0 Likes
Message 6 of 29

Anonymous
Not applicable
Accepted solution

 

@Anonymous wrote:

 

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:


 


 

I would write this as:

 

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

 

ilogicvb.updatewhendone = true

 

 

EDIT: I edited it and put my edits in bold. Almost forgot something...

Message 7 of 29

Anonymous
Not applicable
 
0 Likes
Message 8 of 29

Anonymous
Not applicable
Thank you so much, it worked!!!!

Even with the update code and triggers turned on though I still have to hit save to get the strut pattern to update. Is there any solution to that?
0 Likes
Message 9 of 29

Anonymous
Not applicable

When I change it to the lower lengths I'm also getting a red cross that says my pattern failed (even though it's supressed - when I right click the pattern the check mark is next to supressed, even though there isnt a line going thru it and it's not grayed out).

 

Capture4.JPG

0 Likes
Message 10 of 29

Anonymous
Not applicable

Kind of depends on how you're going about suppressing the Pattern.

 

I'm inclined to say that it is an order of operations problem. If you handle all of your suppressions through ilogic, this should remedy the problem. I'm assuming that somehow, the part is being suppressed before the pattern and thus, an error is thrown before the pattern is actually suppressed. This is, however, my asumption and I'm not able to replicate or test the theory. If that were the case though, all you would have to do is suppress the pattern before suppressing the part in your ilogic code:

 

IF LENGTH <= 96 Then

 

Feature.Isactive("Rectangular Pattern:1") = False

'note that this occurs before suppressing the part and that I assumed the name of the feature in question (yours may not say Rectangular Pattern:1)

Component.IsActive("TUBE:1") = False

 

Else IF LENGTH > 336 Then

 

Component.IsActive("TUBE:1") = True 

Feature.Isactive("Rectangular Pattern:1") = True

'note that when reactivating it, the pattern is unsuppressed after unsuppressing the part

Parameter("TUBE:1","LENGTH") = LENGTH - 45

 

Else

 

Component.IsActive("TUBE:1") = True

Feature.Isactive("Rectangular Pattern:1") = True

Parameter("TUBE:1","LENGTH") = LENGTH - 44

 

End IF

 

ilogicvb.updatewhendone = true

 

 

 

Does that solve it?

0 Likes
Message 11 of 29

Anonymous
Not applicable

@Anonymous wrote:
...

Even with the update code and triggers turned on though I still have to hit save to get the strut pattern to update. Is there any solution to that?

This is likely because despite the various conditions autodesk offers as triggers, there is not one for "Custom Parameter Change". Which is very likely the type of parameter you're manipulating. The reason it is updating on save is only because you have the On Save Document (or however it's described) trigger set as well as the others. Ideally, you can plan on using a model parameter at some point and having the code directly effect that parameter. If it does, then you can set the iTrigger On Model Parameter Change. and that should work.

 

Since you are doing this in the assembly environment and there is not likely a model parameter to manipulate as described above, there's a chance you could force the update by putting a small line of code and the iTrigger at the TUBE:1 part file level.

 

In other words, open up TUBE:1 and write a new rule as follows:

'

ilogicvb.updatewhendone = true

'

and set that to the iTrigger Any Model Parameter Change and if LENGTH (when passed down to the part level) is a model parameter, it should update. I can't guarantee that this will work but it'd be worth a shot.

0 Likes
Message 12 of 29

Anonymous
Not applicable

I copied & pasted your code, except I changed "rectangular pattern:1" to "middle struts:1"

when I clicked ok, it said the feature could not be found....

 

If LENGTH <= 96 Then

Feature.IsActive("MIDDLE STRUTS:1") = False

Component.IsActive("TUBE:1") = False

Else If LENGTH > 336 Then


Component.IsActive("TUBE:1") = True

Feature.IsActive("MIDDLE STRUTS:1") = True

Parameter("TUBE:1","LENGTH") = LENGTH - 45


Else


Component.IsActive("TUBE:1") = True

Feature.IsActive("MIDDLE STRUTS:1") = True

Parameter("TUBE:1","LENGTH") = LENGTH - 44


End If

iLogicVb.UpdateWhenDone = True

 

 

Capture5.JPG

0 Likes
Message 13 of 29

Anonymous
Not applicable

Lol, yeah, some times it's behaviours lack a logical explanation. I'm inclined to think that something in the coding makes it not recognize component patterns as a feature.

 

An alternative would be not suppressing the part nor the pattern, but instead suppressing the extrusion in the part file. This would mean that your constraints would need to NOT be geometrically dependent (since suppressing the feature will temporarily remove the geometry), but I'm certain it would work. Then your pattern can do whatever it wants so long as the part it is patterning doesn't have any active features.

 

You'd do this by removing the suppression part of the rule from the assembly level rule and creating a part level rule that handles the suppression of the feature(s). Does this make sense?

0 Likes
Message 14 of 29

Anonymous
Not applicable

So first I changed "Feature.IsActive("MIDDLE STRUTS:1) = False" to Component.IsActive("MIDDLE STRUTS:1") = False" and it stopped giving me that error message about "cannot find feature", however, there was still a red cross & pattern failure error symbol.

 

So then I did what you said and removed the supression of the parts and pattern in the rule and in it's place, created part level, extrusion supression rules instead:

 

If LENGTH <= 240 Then
Feature.IsActive("OUTTER STRUT:1", "Extrusion1") = False
Feature.IsActive("OUTTER STRUT:2", "Extrusion1") = False
Feature.IsActive("INNER STRUT:1", "Extrusion1") = False
Feature.IsActive("INNER STRUT:2", "Extrusion1") = False
Parameter("TUBE_OFFSET") = 0
End If

If LENGTH > 240 Then
Feature.IsActive("OUTTER STRUT:1", "Extrusion1") = True
Feature.IsActive("OUTTER STRUT:2", "Extrusion1") = True
Feature.IsActive("INNER STRUT:1", "Extrusion1") = True
Feature.IsActive("INNER STRUT:2", "Extrusion1") = True
Parameter("TUBE_OFFSET") = 5
End If

 

It's the same thing tho....it works psysically but there's still a red cross and the pattern still shows an error symbol...

 

Capture6.JPG

 

0 Likes
Message 15 of 29

Anonymous
Not applicable

Hm. Perhaps... what edges are you using for your pattern? If the "direction" for the pattern happens to be an edge that ends up being suppressed, that would throw an error. In case you are using a model edge (even if it is not the reason for this error), I'd recommend always using your origin axis for directing patterns if you can. They're the most reliable because they are always there no matter what changes occur in the model.

 

Let me know if that was it.

 

Also, just to clarify, I was thinking more along the lines of creating a new rule in the part file that determines whether or not the features are suppressed. However... I see no reason why you couldn't do it the way that you have...

0 Likes
Message 16 of 29

Anonymous
Not applicable

It was set on the track, I changed it to the origin axis but still the error is there....there's also mate errors for where the strut mate to the track.

0 Likes
Message 17 of 29

Anonymous
Not applicable

@Anonymous wrote:

@Anonymous wrote:
...

Even with the update code and triggers turned on though I still have to hit save to get the strut pattern to update. Is there any solution to that?

This is likely because despite the various conditions autodesk offers as triggers, there is not one for "Custom Parameter Change". Which is very likely the type of parameter you're manipulating. The reason it is updating on save is only because you have the On Save Document (or however it's described) trigger set as well as the others. Ideally, you can plan on using a model parameter at some point and having the code directly effect that parameter. If it does, then you can set the iTrigger On Model Parameter Change. and that should work.

 

Since you are doing this in the assembly environment and there is not likely a model parameter to manipulate as described above, there's a chance you could force the update by putting a small line of code and the iTrigger at the TUBE:1 part file level.

 

In other words, open up TUBE:1 and write a new rule as follows:

'

ilogicvb.updatewhendone = true

'

and set that to the iTrigger Any Model Parameter Change and if LENGTH (when passed down to the part level) is a model parameter, it should update. I can't guarantee that this will work but it'd be worth a shot.


By the way I just tried this too, but I still have to hit save (sometimes a couple of times) to get the part to update 😞

0 Likes
Message 18 of 29

Anonymous
Not applicable
I set rules to suppress the constraints but I can't figure out how to solve the pattern error still.
0 Likes
Message 19 of 29

Anonymous
Not applicable

update:


I set a rule to suppress the pattern again and this time the error went away.

So the last thing I need to figure out is just how to get the strut pattern to update without me hitting save, update, save every time.

0 Likes
Message 20 of 29

Anonymous
Not applicable

Well, I'm glad you got it working. I would be able to help much more if I could open the assembly...

 

Are you able to zip it and attach it?

0 Likes