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: 

Assembly driven by ilogic rules - suppress components no longer needed

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Shag_Bore
436 Views, 8 Replies

Assembly driven by ilogic rules - suppress components no longer needed

I have an assembly that is currently driven by 2 user inputs from a form, one is a length value and the other is whether Panel_B exists or not in the assembly. Panel B will be always be centered if it exists, I created a true or false parameter to drive this.

Panel_A qty's are derived from the length value.

Panel_A and Panel_B  never change in length.

If Panel_B exists in the assembly then Panel_C and Panel_D may exists as well.

If Panel_B doesn't exist then only Panel_C may exist, (Panel_A pattern shifts to Panel_D end to meet Panel_C)

This will make sense once you open the assembly. I can get the ilogic to work when Panel_C and Panel_D exists,  but if the user input length happens to fall on a integer that then makes Panel_C and Panel_D = 0, I need to suppress them. But I can't get that to happen exactly, I get an error in the assembly with the contraints that were used to place those panels initially. The panels disappear because their Length become 0 (parameter equation) which causes this error, I need the rule to enact the suppression before the assembly  tries to maintain the contraints. 

(Canopy_parameters-testing.ipt is an empty part that holds the linked parameters.)

 

The rule in the assembly that I tried is named "NO PANEL B SUPPRESS PANEL C"

If Parameter("PANEL_C:1", "LENGTH")=0 Then
Component.IsActive("PANEL_C:1")=False
Else
Component.IsActive("PANEL_C:1")=True
End If

If Parameter("PANEL_D:1", "LENGTH")=0 Then
Component.IsActive("PANEL_D:1")=False
Else
Component.IsActive("PANEL_D:1")=True
End If
iLogicVb.UpdateWhenDone = True

PS, if you see some items that I can "clean up" in all the rules, much appreciated also. 

 

image.PNG

 

Thanks! 

 

Running inventor 2016

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
8 REPLIES 8
Message 2 of 9
A.Acheson
in reply to: Shag_Bore

Hi Sean,

 

Suppress the constraints before or after the occurrence. See forum post here. You will also have the snippets available in the ilogic editor.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 9
Shag_Bore
in reply to: A.Acheson

Hey @A.Acheson, I started applying the ilogic rules from my simple dummy assembly above into our actual product and it is going well, little more complicated but I am getting through it. While doing so I came across and issue and seemed to have solved it, but I am wondering if you could shed some light on what is happening and why the error occurs.

 

my assembly is comprised of 6 or so unique components. Some parts and some sub-assemblies. There is one empty part that holds linked parameters, to control the length, width and height of those parts and sub-assemblies. This works fine. 

 

My issue came when trying to use parameters from that empty part that holds the linked parameters, I needed to control a pattern in the main assembly using a calculated occurrence value and spacing value. The main assembly accepts them as paramters (they are linked) and the pattern is created. However while testing various length and width parameters I get an error because the empty part parameters are not updated first?

 

I determined this because in the main assembly, I have a different pattern that works perfectly when the length and width parameters are changed. But those patterns are driven from parameters in the assembly not the empty part parameters. So all I need to do for the problematic pattern is re-create those parameters in the assembly level and it should work fine. just curious as to what is exactly happening as far as the sequencing I guess for when the empty file gets updated. 

 

Anyway, thanks for you help, I haven't gotten to the part where I needed help from the previous post. It is coming up after I fix this pattern thing first.

 

 

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
Message 4 of 9
A.Acheson
in reply to: Shag_Bore

Hi Sean,

 

It sounds like you need to do an update of the driving part document. Doc.update when referencing that occurrence in the code. If you study the manual method and replicate what needs to happen theretjat can give a clue tobwhat is needed. I'm not sure it is entirely necessary to use linked parameters as these can be driven directly in the code but maybe your just using the manual methods still. If you could screenshot the browser and circle the files effected and the parameters and then post the code with the steps then I could offer more assistance. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 9
Shag_Bore
in reply to: A.Acheson

hey @A.Acheson,

 

I have already addressed the errors and the only way to replicate them is revert the parameters back, which I don't want to do. 

 

I was thinking about this yesterday and might have come up with a solution. I assumed that any parameters that I wanted to link between all parts and sub assemblies had to come from a part file. I don't recall why I assumed this, maybe because in prior projects, I simply just used am empty part file. But I think (untested), I can store all parameters required to make the top level assembly fully dynamic is to store them in the actual top level assembly.  This would eliminate the empty part file and solve the issue of the pattern occurrences creating an error when trying to update the length and width of the assembly. 

 

I understand this is difficult to visualize without seeing the assembly and parts but I can't share, but going back to the initial dummy assembly in the first post, it might make sense. 

 

I haven't tried your post regarding the suppression of the constraints yet, as I am not there. 

 

Thanks, have a good weekend!

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
Message 6 of 9
Shag_Bore
in reply to: Shag_Bore

Hello, I am stuck at the last hurdle, I can get my rule to work when the Boolean parameter SA_WM=False, but the if then statements are not working for when the SA_WM=True. Specifically the line,

Parameter("d110") = SA_NW_ACM_PA

 

When open my form and change the SA_WM from false to true (checkbox) that d110 parameter is supposed to update to  

Parameter("d110") = SA_WW_PA

 There are 4 conditions that I am trying to get to work with my Form, 

SA_WM=False but length is long to support patterns(suppress all Pattern B's and re-contrain Pattern A's)

SA_WM=False but length is too short to support patterns(suppress Pattern B's and Pattern A's)

SA_WM=True but length is too short to support patterns (suppress some Pattern A' and some Pattern B's)

SA_WM=True, length is long to support all patterns (no suppressed components)

 

I can't seem to figure out why my d110 parameter won't apply the SA_WW_PA user parameter when I make SA_WM=TRUE, it is stuck using the SA_NW_ACM_PA parameter.

 

Thanks!

 

'SIDE A - SUPPRESS 'B' PATTERNS IF NO WORDMARK EXIST
If SA_WM=False And SA_AFT_PA_O_D > 1 And SA_AW_P > 0 And SA_ATA_PA_O_D > 1 And SA_ALED_PA_O_D > 1 Then
Component.IsActive("SA_FT_PA")= True
Component.IsActive("SA_FT_PB")= False
Component.IsActive("SA_ACM_PA")= True
Component.IsActive("SA_ACM_PB")= False
Component.IsActive("SA_TA_PA")= True
Component.IsActive("SA_TA_PB")= False
Component.IsActive("SA_LED_PA")= True
Component.IsActive("SA_LED_PB")= False
'ADJUST ALL PATTERN 'A' STARTING CONSTRAINTS TO MEET COMPONENTS ON LEFT SIDE OF SIDE A
Parameter("d26") = SA_NW_FT_PA
Parameter("d110") = SA_NW_ACM_PA
Parameter("d330") = SA_NW_LED_PA
Parameter("d198") = SA_NW_TA_PA
'ADJUST ALL PATTERN OCCURANCES TO FULLY EXTEND SIDE 'A'
Parameter("d33") = SA_AFT_PA_O_NW
Parameter("d118") = SA_AACM_PA_O_NW
Parameter("d338") =SA_ALED_PA_O_NW
Parameter("d288") = SA_ATA_PA_O_NW
End If
'SIDE A - SUPPRESS F-TRACK AND TOP ANGLE PATTERNS IF SIDE 'A' IS TO SHORT AND NO WORDMARK
If SA_WM=False And SA_AF_L<582 And SA_AFT_PA_O_D < 1 Then
Component.IsActive("SA_FT_PA")= False
Component.IsActive("SA_FT_PB")= False
Component.IsActive("SA_TA_PA")= False
Component.IsActive("SA_TA_PB")= False
Parameter("d26") = SA_NW_FT_PA
Parameter("d110") = SA_NW_ACM_PA
Parameter("d330") = SA_NW_LED_PA
Parameter("d198") = SA_NW_TA_PA
Parameter("d33") = SA_AFT_PA_O_NW
Parameter("d118") = SA_AACM_PA_O_NW
Parameter("d338") =SA_ALED_PA_O_NW
Parameter("d288") = SA_ATA_PA_O_NW
End If
'SIDE A - WORDMARK EXISTS AND SIDE 'A' IS LONG ENOUGH TO REQUIRE PATTERN A AND PATTERN B
If SA_WM=True And SA_AFT_PA_O_D > 1 And SA_AFT_PB_O_D > 1 And SA_AW_P > 0 And SA_ATA_PA_O_D > 1 And SA_ATA_PB_O_D > 1 And SA_ALED_PA_O_D > 1 And SA_ALED_PB_O_D > 1 Then 
Component.IsActive("SA_FT_PA")= True
Component.IsActive("SA_FT_PB")= True
Component.IsActive("SA_ACM_PA")= True
Component.IsActive("SA_ACM_PB")= True
Component.IsActive("SA_TA_PA")= True
Component.IsActive("SA_TA_PB")= True
Component.IsActive("SA_LED_PA")= True
Component.IsActive("SA_LED_PB")= True
'ADJUST ALL PATTERN 'A' STARTING CONSTRAINTS, PATTERN 'A' CONTRAINTS ON RIGHT SIDE OF WORDMARK, PATTERN 'B' CONSTRAINTS ON LEFT SIDE OF WORDMARK
Parameter("d26") = SA_WW_PA
Parameter("d110") = SA_WW_PA
Parameter("d330") = SA_WW_PA
Parameter("d198") = SA_WW_PA
'ADJUST ALL PATTERN OCCURANCES TO START FROM SIDES OF WORDMARKS AND REACH ENDS 
Parameter("d33") = SA_AFT_PA_O
Parameter("d118") = SA_AW_P
Parameter("d338") = SA_ALED_PA_O
Parameter("d288") = SA_ATA_PA_O
End If
If SA_WM=True And SA_AFT_PA_O_D < 1 And SA_AFT_PB_O_D < 1 And SA_AW_P =0 And SA_ATA_PA_O_D < 1 And SA_ATA_PB_O_D < 1 And SA_ALED_PA_O_D < 1 And SA_ALED_PB_O_D < 1 Then
Component.IsActive("SA_FT_PA")= False
Component.IsActive("SA_FT_PB")= False
Component.IsActive("SA_ACM_PA")= False
Component.IsActive("SA_ACM_PB")= False
Component.IsActive("SA_TA_PA")= False
Component.IsActive("SA_TA_PB")= False
Component.IsActive("SA_LED_PA")= False
Component.IsActive("SA_LED_PB")= False
End If
Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
Message 7 of 9
A.Acheson
in reply to: Shag_Bore

Hi @ I can only advise putting the parameter in a message box and seeing what value comes up incase the value is incorrect for you conditions. You can switch off some of unrelated lines of code to make checking more efficient. 

Where are these two parameters getting there values from? Are they being processed while the code is running? 

SA_NW_ACM_PA
SA_WW_PA

You can try using them using the Parameter function as well.  

Parameter("SA_NW_ACM_PA")
Parameter("SA_WW_PA")

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 8 of 9
Shag_Bore
in reply to: A.Acheson


@A.Acheson wrote:

Hi @ I can only advise putting the parameter in a message box and seeing what value comes up incase the value is incorrect for you conditions. You can switch off some of unrelated lines of code to make checking more efficient. 

Where are these two parameters getting there values from? Are they being processed while the code is running? 

SA_NW_ACM_PA
SA_WW_PA

those 2 parameters are user created, they are used for defining the mate constraint, one for when the wordmark exists and one for when it doesn't.  

i'll try the parameter("xxxx") way and see what happens, 

 

Thanks

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
Message 9 of 9
Shag_Bore
in reply to: A.Acheson

This image might help, Panel B is the Wordmark, in some of our assemblies, this can exist or not. S when it does exist, the side assembly will be comprised to two end panels and patterns, when the wordmark doesn't exist, then pattern 2 is suppressed, Panel_D is defaulted to full size and the mate constraint for Pattern 1 changes from SA_WW_PA to SA_NW_ACM_PA, or supposed to anyways...I might have some rules conflicting this elsewhere that I will check tomorrow. But I wasn't sure if the way I wrote the rule out in the previous post was not written out correctly, still learning when to use if/then or if/else if then...

 

Thanks!

image.PNG

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report