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: 

Extract parts of material name and populate iProperties

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
326 Views, 1 Reply

Extract parts of material name and populate iProperties

Hello

 

4718800 GLV ZAM 1.6mm(16Ga)PLT   11H8376M5PZ

 

This is what my material name looks like, I want to extract the first "4718800" and the last "11H8376M5PZ"

I want to know how to write my code so that it reads the name from the left and right up until there is a space. "4718800" should then be populated in the iProperties under "Custom" tab and "AREA". and the "11H8376M5PZ" to be populated under the iProperties "Project" , "Stock Number"

 

I can do a code that counts a number of spaces and the uses that but, I would like it to read just till space and the use that as not all of the names are the same lengths.

 

Can anyone help me, please?

1 REPLY 1
Message 2 of 2
dean.morrison
in reply to: Anonymous

Hi,

 

You could use split to do it, but the number of parts must be the same - in your case below it would be 5.

 

If you can count the number of spaces, i'm sure you could modify it so it works if the number is different.

 

Anyway it goes like this..

 

MatSplit = Split(MaterialName, " ")
For i = 0 To UBound(MatSplit)
Part1 = MatSplit(0)
Part2 = MatSplit(1)

Part3 = MatSplit(2)

Part4 = MatSplit(3)

Part5 = MatSplit(4)
Next

 

I hope that helps you.

 

Dean.

 

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report