Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Splitting file name in two: CODE Help

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
268 Views, 2 Replies

Splitting file name in two: CODE Help

I need a little help please.

 

I have an inventor part with the name “0955-P05”. To break it down the Job # is 0955 and the Mark # is P05

The code below will automatically take whatever the file name and split it to fill in the Job # and Mark #

 

 

'MarkNumber and Job Information

 

  'Filename Convert

    Part_Number = iProperties.Value("Project", "Part Number")

 

    iProperties.Value("Custom", "Job" ) = "=" & Left(Part_Number,4)

    iProperties.Value("Custom", "MarkNumber") = "=" & Right(Part_Number,3)

 

 

The code works great in till my Mark # reaches P99

 

I know what you’re thinking but I can’t change the Mark #s to P001 and fix the code that way. The whole company is already set up with this Mark # system and they will not change it.

 

I was wondering if anyone might have any ideas or if there is a way to make the Mark # whatever is after the – in the file name or something like that.

 

 

Please help me Obi Wan you're my only hope…

2 REPLIES 2
Message 2 of 3
Curtis_Waguespack
in reply to: Anonymous

 

Hi  jddickson,

 

This should do it as long as the dash is always the seperator. It divides the string into element(0) and element(1).

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

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

 

Part_Number = iProperties.Value("Project", "Part Number")

sJobNumber = Split(Part_Number, "-")(0)
sMarkNumber = Split(Part_Number, "-")(1)

MessageBox.Show("Job #: " & sJobNumber, "iLogic")
MessageBox.Show("Mark #: " & sMarkNumber, "iLogic")

 

Message 3 of 3
Anonymous
in reply to: Curtis_Waguespack

Thank you that worked great. 

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

Post to forums  

Autodesk Design & Make Report