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: 

Custom Property. Extract text from file name.

2 REPLIES 2
Reply
Message 1 of 3
pablo.portilla
503 Views, 2 Replies

Custom Property. Extract text from file name.

Hello everybody
I have an issue and may be you could help me. I would like to know if is possible to extract text from one property (in my case file name). In my company we use a combination of the file name to get an item number, which we set in the balloons of all drawings, then, currently you have to type it in the balloons manually. I was wondering if this could be done by Inventor. Next some examples. 

 

P-12-50-03 then Item number is 203

P-15-14-05 then Item number is 505

P-18-20-51 then Item number is 851

P-11-25-473 then Item number is 1473

P-13-64-001 then Item number is 3001

 

I need to extract from the 'part file name' the numbers in Bold. With this new property, I could set it in the balloons and also in my part list and we don't have to do a lot of manual work. Thank you in Advance.Hello Everybody

Pablo
2 REPLIES 2
Message 2 of 3
Ralf_Krieg
in reply to: pablo.portilla

Hello

 

Take a look at the SPLIT and RIGHT-function. Split creates an array of Substrings devided by "-" in your case. Take the second arrayfield and get your first number with the right-fuction. Take the complete fourth arrayfield as second part and combine these two parts.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 3 of 3
nttoan8187
in reply to: pablo.portilla

You can try this. Create a button and a textbox

 

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click

 

      Dim pSplit() AsString

      pSplit = Split(TextBox1.Text,"-")

 

      Dim a AsString

      TextBox1.SelectionStart = 3

      TextBox1.SelectionLength = 1

      a = TextBox1.SelectedText

      MsgBox(CInt(a & pSplit(3)))

 

EndSub 

Please mark this answer as Problem Solved if it solves your question.
-----------------------------------------------------------------------------------------
Toan
Inventor API

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

Post to forums  

Autodesk Design & Make Report