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: 

How to Truncate ActiveSheet.Name with Ilogic

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
RobABerger
927 Views, 3 Replies

How to Truncate ActiveSheet.Name with Ilogic

Hi, just dipping my toes into Ilogic customization, last time I did any programming was TurboPascal at uni a million years ago.

 

Problem background:

 

We are using multisheet IDWs with each sheet assigned a unique four-digit number for its name.  Inventor appears to add an instance extension to this four digit number when using ActiveSheet.Name.

 

Thus if we have five sheets in an idw in ascending order such as 1600, 1601, 1605, 1606, and 1608, ActiveSheet.Name returns 1600:1, 1601:2, 1605:3, 1606:4, and 1608:5 respectively.

 

What code could I use to truncate the ":#" part of each ActiveSheet.Name, or is there an option to return only the user assigned portion of the name?

 

Thanks for any help, much appreciated!

 

Regards,

Rob B

3 REPLIES 3
Message 2 of 4
RobABerger
in reply to: RobABerger

Okay, I did what I should have done at first...googled it.  This was pretty close to what I needed:

 

http://inventortrenches.blogspot.co.nz/2011/04/ilogic-to-trim-file-name-to-populate.html

 

I just modified my variable as follows:

 

strCurrentSeqNum = (Left(ActiveSheet.Name, 4))

 

This starts at the left side of the string and takes the first four character, omitting whatever follows.  Hope it helps someone...

Message 3 of 4
danvang
in reply to: RobABerger

The following will allow you to trim a string based on a character. In this case, the last colon. With this your sheet name does not have to be limited 4 characters only. Just another way. Hope this helps others as well.

SheetName = ActiveSheet.Name
ColonIndex = SheetName.LastindexOf(":")
SheetNameOnly = SheetName.substring(0,ColonIndex)
** If my reply resolves this issue, please choose "Accept as Solution" **
Dan Vang
Message 4 of 4
RobABerger
in reply to: danvang

Thanks for posting your solution, as it is more robust than mine, I've changed my code to yours.  Much appreciated!

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

Post to forums  

Autodesk Design & Make Report