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: 

Compress lines of code in iLogic

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
ClintWestwood
2547 Views, 8 Replies

Compress lines of code in iLogic

A while back I figured out how to put a few characters before and after several lines of code in iLogic to make it compress to one line or expand to its full size inside the code editor. I belive this is a fairly common VBA command, but I can't figure out how to do it again. I'm not very familiar with the guts of VBA, anyone know how to do this? I'm a neat freak and I'd really like to compress my code to make it easier to read. Thanks

Inventor 2014
HP Pavilion dv6t-6b00
Intel Core i7 2670QM
AMD Radeon HD 6490M
16gb RAM
Windows 7 64 bit
3Dconnexion SpaceExplorer
8 REPLIES 8
Message 2 of 9
pcrawley
in reply to: ClintWestwood

Was this it?

 

Sub main()

'your code

End sub

Peter
Message 3 of 9
ClintWestwood
in reply to: pcrawley

That's it! Thank you.
Inventor 2014
HP Pavilion dv6t-6b00
Intel Core i7 2670QM
AMD Radeon HD 6490M
16gb RAM
Windows 7 64 bit
3Dconnexion SpaceExplorer
Message 4 of 9
cwhetten
in reply to: ClintWestwood

This also works:

 

'[ You can add some label text here

 

']

 

So, in case it is hard to tell what I did there, that's a single quote mark (also used to create comments), followed by an open square bracket, followed by a space.  You can then add whatever text you like, usually describing the code that is collapsed.

 

You can control where the collapsing stops by including a single quote mark followed by a closed square bracket.

 

The Sub Main() ... End Sub works, but you can only have one of those per rule.  If you have several code sections that you want to collapse, use the method I described.  It's also possible to nest with this method.

 

Cameron Whetten
Inventor 2014

Message 5 of 9
pcrawley
in reply to: cwhetten

Every time I come to this discussion group, I learn something new!

Thanks!!

Peter
Message 6 of 9
ClintWestwood
in reply to: cwhetten

I have found that if I change "Main" to something else, I can use multiple sub commands throughout my rule. However, since your method has nesting capability (and doesn't require me to type as many characters) I will use it in the future. Thank you!
Inventor 2014
HP Pavilion dv6t-6b00
Intel Core i7 2670QM
AMD Radeon HD 6490M
16gb RAM
Windows 7 64 bit
3Dconnexion SpaceExplorer
Message 7 of 9
pcrawley
in reply to: ClintWestwood

''' Three inverted commas (as used for a comment line) will collapse the comments to a small block.

I'm not quite sure why you'd want to, but worth a mention in your quest for tidiness.

Peter
Message 8 of 9
pcrawley
in reply to: pcrawley

And here's another useful trick to add to the bag of OCD tidyness tools.

Use the ''' trick on subsequent lines of comments and the whole lot becomes collapsible:

17-01-2014 5-01-52 p-m-.png

I really like this one!

Peter
Message 9 of 9
Maxim-CADman77
in reply to: pcrawley

I wonder if it possible to have those specially marked code collapsed by default in iLogic-editor?

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

Post to forums  

Autodesk Design & Make Report