Remove letters from string

Remove letters from string

pklWNF89
Participant Participant
574 Views
2 Replies
Message 1 of 3

Remove letters from string

pklWNF89
Participant
Participant

Hi guys.

Is it possible to get a parts name as a string from the generaltap in iProperties.
And then remove the filetype extension from it? 

pklWNF89_1-1632388347843.png

 

0 Likes
Accepted solutions (1)
575 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Not really.  That tab of the iProperties dialog is mostly just a reflection of the Windows file system type properties related to the file.  However, there are several other ways to get the file name of any Inventor document, as long as it actually has one.  If a file was just created using the New command, and has not been saved yet, it will not return a path or file name, because it has not been assigned one yet.

Here are just a few (of many) ways to get just the file name of the current document, without the path or file extension in an iLogic rule.

a = ThisDoc.FileName(False)
b = Split(ThisApplication.ActiveDocument.DisplayName,".")(0)
c = System.IO.Path.GetFileNameWithoutExtension(ThisApplication.ActiveDocument.FullFileName)
MsgBox("a = " & a, , "")
MsgBox("b = " & b, , "")
MsgBox("c = " & c, , "")

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

Curtis_Waguespack
Consultant
Consultant

Hi @pklWNF89 

 

Additionally, in iLogic there is a built in method for this:

 

Curtis_W_0-1632399015892.png

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

EESignature

0 Likes