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: 

Project Number from Part Number using iLogic

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Daniel.buzinari
399 Views, 3 Replies

Project Number from Part Number using iLogic

Hi!

 

All my files (iam and ipt) start with the project number I am designing them for.

 

Does anyone have an iLogic rule that could extract these first digits from the file name and automatically populate it to project number?

 

Thank you

3 REPLIES 3
Message 2 of 4

Hi Daniel,

 

This one is easy. Even I can do it. Here you go!

 

Dim PN_Project As String
PN_Project = iProperties.Value("Project", "Part Number")
iProperties.Value("Project","Project")=Left(PN_Project,2)


Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 3 of 4

Thanks John! 

 

I will try to figure out now how to bring in the file name instead.

 

I use Vault with Auto-Naming, so my ipt files usually follow the patterns PPPP-NNNNN (in P the Project No and N the auto sequence created by Vault).

 

Our Part Number uses a macro to be populated, based on the element (plate thickness x width, or structural member spec for example).

 

Are there any courses to learn a bit more about iLogic and how to write the scripts?

Message 4 of 4
A.Acheson
in reply to: Daniel.buzinari

Hi @Daniel.buzinari 

 

For learning do an internet search using ilogic and the task you want to do and you will usually find this forum and post that might help you. There is also the ilogic help files

Here is the filename function found under document functions.

 

Dim fileNameWoExt As String = ThisDoc.FileName(False)

 

You can also sort of make out what each snippet does by navigating the ilogic browser looking in each category and adding the snippets of code and hover the cursor over the text to display a tool tip which is instructions on its function. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

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

Post to forums  

Autodesk Design & Make Report