Automatic Scale Loop Causing infinite Loop

Automatic Scale Loop Causing infinite Loop

MechMachineMan
Advisor Advisor
611 Views
4 Replies
Message 1 of 5

Automatic Scale Loop Causing infinite Loop

MechMachineMan
Advisor
Advisor

Can anyone explain why this peice of code is causing an infinite loop in a drawing package with mroe than one drawing?

 

For Each oSheet In ThisApplication.ActiveDocument.Sheets
 oViews = oSheet.DrawingViews
 While oViews.Item(1).Height * oViews.Item(1).Width <= 800 'Sheet area/6
  MsgBox(oViews.Item(1).Scale)
  oViews.Item(1).Scale = oViews.Item(1).Scale + .01
  MsgBox(oViews.Item(1).Scale)
 End While
Next

 

Any help is much appreciated, thanks!

My first guess would be an issue with the while loop doing the calculation?


--------------------------------------
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
0 Likes
612 Views
4 Replies
Replies (4)
Message 2 of 5

BrandonBG
Collaborator
Collaborator

It worked for me running inside a .dwg (I added Try-Catch for sheets with no drawing views).

 

Where are you running the rule?

 

Brandon

0 Likes
Message 3 of 5

MechMachineMan
Advisor
Advisor
Inside a rule that sorts parts and makes drawings of each.

--------------------------------------
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
0 Likes
Message 4 of 5

BrandonBG
Collaborator
Collaborator

Is the loop occurring in the first drawing it runs through? I don't have a good guess why this is happening. It looks good from here . . .

 

Brandon

0 Likes
Message 5 of 5

MechMachineMan
Advisor
Advisor

Thanks for the responses Brandon.

 

I'm starting to think that maybe the file was just bugged during that instance of inventor or something goofy is going on with the file. Still seems weird though because I wrote this sub as a test to see if it would work outside of my main program, but it still didnt.


--------------------------------------
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
0 Likes