Using While

Anonymous

Using While

Anonymous
Not applicable

Hello,

 

I'm trying to make a rule or multiple rules that will run and calculate different dimensions. I don't think it will be too difficult, but I'm not sure how to write iLogic, especially trying to run certain rules only under certain conditions.  Here is an example of my idea of the syntax.

 

Rule 1:

While (SecondDist = 0 & ThirdDist = 0)

     *math*

End While

 

Rule 2:

While (ThirdDist = 0)

     *math*

End While

 

Rule 3:

While (FirstDist=0 & SecondDist = 0 & ThirdDist = 0)

     *math*

End While

 

Rule 4:

While (FirstDist !=0 & SecondDist != 0 & ThirdDist != 0)

     *math*

End While

0 Likes
Reply
Accepted solutions (1)
516 Views
3 Replies
Replies (3)

bradeneuropeArthur
Mentor
Mentor

Use "and"

 

 

Rule 1:

While (SecondDist = 0 and ThirdDist = 0)

     *math*

End While

Regards,

Arthur Knoors

Autodesk Affiliations:

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: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 !

bradeneuropeArthur
Mentor
Mentor

@Anonymous

is this solved for you, than please mark as solution for administrative reasons.

 

Thanks,

Regards,

Arthur Knoors

Autodesk Affiliations:

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: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 !

0 Likes

MechMachineMan
Advisor
Advisor
Accepted solution

However, the only time you should need to use while in doing a calculation is if it is an iterative calculation. If you are doing a 1 time calculation, you should be using IF statements. It seems like having that many iterating parameters could lead to an unstable solution and just cause your code to run in an infinite loop and crash your machine.


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

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type