iLogic code not working perfectly

iLogic code not working perfectly

GKPByDesign
Advocate Advocate
497 Views
6 Replies
Message 1 of 7

iLogic code not working perfectly

GKPByDesign
Advocate
Advocate

I am have an issue with this logic with the attached file.

 

1. Model_Type remain blank, but should only be blank as written in code as Model_Type=""

2. MOD appears as True when MOD="" in code

 

Can someone help 

 

Everything else works fine! 

 

 

 

If Cut = "Box Section - No Cut" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Angle_1_PA = "0.1" & Angle_2_PA = "0"
Angle_1_PA = "0"
Angle_2_PA = "0"
iProperties.Value("Custom", "Model_Type") = ""
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Angle Section - No Cut" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = True
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "" & Angle_1_PA = "0.1" & Angle_2_PA = "0"
Angle_1_PA = "0"
Angle_2_PA = "0"
iProperties.Value("Custom", "Model_Type") = ""


ElseIf Cut = "U Channel - No Cut" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = True
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = True
Model_Type = "" & Angle_1_PA = "0.1" & Angle_2_PA = "0"
Angle_1_PA = "0"
Angle_2_PA = "0"
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Box Section - Model A" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = True
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model A"
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Box Section - Model A - Small Side" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = True
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model A"
iProperties.Value("Custom", "MOD") = Model_Type	
	

ElseIf Cut = "Box Section - Model B" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = True
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model B"
iProperties.Value("Custom", "MOD") = Model_Type

ElseIf Cut = "Box Section - Model B - Small Side" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = True
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model B"
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Angle Section - Model C" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = True
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = True
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model C"
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Angle Section - Model D" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = True
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = True
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model D"
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Angle Section - Model E" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = True
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = True
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model E"
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Angle Section - Model F" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = True
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = True
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "Model F"
iProperties.Value("Custom", "MOD") = Model_Type

ElseIf Cut = "Box Section - Single Cut" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = True
Feature.IsActive("U Channel") = False
Angle_2_PA = "0"
Model_Type = "Single Cut"
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Angle Section - Single Cut" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = True
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = True
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Angle_2_PA = "0"
Model_Type = "Single Cut"
iProperties.Value("Custom", "MOD") = Model_Type

End If

0 Likes
498 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

Change this in general...

 

Dim Model_Type as string

If Cut = "Box Section - No Cut" Then Feature.IsActive("Box Section") = True Feature.IsActive("U Channel") = False Feature.IsActive("Angle Section") = False Feature.IsActive("Model A") = False Feature.IsActive("Model A - Small Side") = False Feature.IsActive("Model B") = False Feature.IsActive("Model B - Small Side") = False Feature.IsActive("Model C") = False Feature.IsActive("Model D") = False Feature.IsActive("Model E") = False Feature.IsActive("Model F") = False Feature.IsActive("Angle Section - Single Cut") = False Feature.IsActive("Box Section - Single Cut") = False Feature.IsActive("U Channel") = False Angle_1_PA = "0.1" & Angle_2_PA = "0" Angle_1_PA = "0" Angle_2_PA = "0" iProperties.Value("Custom", "Model_Type") = "" iProperties.Value("Custom", "MOD") = Model_Type ElseIf Cut = "Angle Section - No Cut" Then Feature.IsActive("Box Section") = False Feature.IsActive("U Channel") = False Feature.IsActive("Angle Section") = True Feature.IsActive("Model A") = False Feature.IsActive("Model A - Small Side") = False Feature.IsActive("Model B") = False Feature.IsActive("Model B - Small Side") = False Feature.IsActive("Model C") = False Feature.IsActive("Model D") = False Feature.IsActive("Model E") = False Feature.IsActive("Model F") = False Feature.IsActive("Angle Section - Single Cut") = False Feature.IsActive("Box Section - Single Cut") = False Feature.IsActive("U Channel") = False Model_Type = "" & Angle_1_PA = "0.1" & Angle_2_PA = "0" Angle_1_PA = "0" Angle_2_PA = "0" iProperties.Value("Custom", "Model_Type") = Model_Type

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

GKPByDesign
Advocate
Advocate

Sorry can you elaborate ? 

0 Likes
Message 4 of 7

bradeneuropeArthur
Mentor
Mentor

What is Model_Type meant in this?

iProperties.Value("Custom", "Model_Type") = ""

I assume the Custom Property Model_Type

 

What is Model_Type meant in this?

It seems that it is not declared.

Declare it first with Dim Model_Type as string with a value of course.
If the value is missing it does not work

 

What is MOD meant in this?

I assume the Custom Property MOD.
iProperties.Value("Custom", "MOD") = Model_Type

 

Is the Custom property always available?

Otherwise you need a try catch.

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 7

GKPByDesign
Advocate
Advocate

The code can be split into around 10 different processes, and if 1 process is done it does a few extra steps with varying results. I am coming across two issues: Take the first paragraph:

 

If Cut = "Box Section - No Cut" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Angle_1_PA = "0.1" & Angle_2_PA = "0"
Angle_1_PA = "0"
Angle_2_PA = "0"
iProperties.Value("Custom", "Model_Type") = ""
iProperties.Value("Custom", "MOD") = Model_Type



 

 Model_Type & MOD are the same parameter I require them both, they are simply text values. The above paragraph if run, will fail at two things.

 

1. When you run the above, Model_Type should be blank, which it is, however it is always blank, even when its not supposed to be? I don't know why this is

 

2. MOD copies Model_Type, and in most instances if there is a value for Model_Type it copies fines, but when I ask for Model_Type to be "" (blank) it cannot copy this at all and inputs "True" instead

 

Hopefully this now makes a little more sense.

 

To answer your reply, 

 

What is Model_Type meant in this?

iProperties.Value("Custom", "Model_Type") = ""

I assume the Custom Property Model_Type

 

 

What is Model_Type meant in this?

It seems that it is not declared.

Declare it first with Dim Model_Type as string with a value of course.
If the value is missing it does not work

 

I need Model_Type to be Blank when written as above ""

 

What is MOD meant in this?

I assume the Custom Property MOD.
iProperties.Value("Custom", "MOD") = Model_Type

 

Is the Custom property always available?

Otherwise you need a try catch.

 

This captures correctly when there is a value for Model_Type, however becomes "True" when the value of Model_Type supposed to be blank

0 Likes
Message 6 of 7

smilinger
Advisor
Advisor

These lines cause the problem:

If Cut = "Box Section - No Cut" Then
Feature.IsActive("Box Section") = True
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Angle_1_PA = "0.1" & Angle_2_PA = "0"
Angle_1_PA = "0"
Angle_2_PA = "0"
iProperties.Value("Custom", "Model_Type") = ""
iProperties.Value("Custom", "MOD") = Model_Type


ElseIf Cut = "Angle Section - No Cut" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = False
Feature.IsActive("Angle Section") = True
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = False
Model_Type = "" & Angle_1_PA = "0.1" & Angle_2_PA = "0"
Angle_1_PA = "0"
Angle_2_PA = "0"
iProperties.Value("Custom", "Model_Type") = ""


ElseIf Cut = "U Channel - No Cut" Then
Feature.IsActive("Box Section") = False
Feature.IsActive("U Channel") = True
Feature.IsActive("Angle Section") = False
Feature.IsActive("Model A") = False
Feature.IsActive("Model A - Small Side") = False
Feature.IsActive("Model B") = False
Feature.IsActive("Model B - Small Side") = False
Feature.IsActive("Model C") = False
Feature.IsActive("Model D") = False
Feature.IsActive("Model E") = False
Feature.IsActive("Model F") = False
Feature.IsActive("Angle Section - Single Cut") = False
Feature.IsActive("Box Section - Single Cut") = False
Feature.IsActive("U Channel") = True
Model_Type = "" & Angle_1_PA = "0.1" & Angle_2_PA = "0"
Angle_1_PA = "0"
Angle_2_PA = "0"
iProperties.Value("Custom", "MOD") = Model_Type

You can't join multiple assignment statements into one line with "&" in VB.

0 Likes
Message 7 of 7

GKPByDesign
Advocate
Advocate

Amended to what you've said, and its still functional however when I want the code to be blank as in "" it won't pick up that value, any ideas a better way to leave something blank in ilogic? 

0 Likes