Inventor General Discussion

Reply
Distinguished Contributor
drguitarum2005
Posts: 196
Registered: ‎10-08-2012
Message 1 of 5 (165 Views)

Removing characters from iProperty

165 Views, 4 Replies
01-03-2013 02:47 PM

I'd like to build a rule into my standard part template that takes the part number (which it automatically gets from the rilename by default), removes the characters after a delimiter, as well as the delimiter itself, and sets that as a new custom property. For example, we'll call the custom property Prop1

 

For part 123-321-1.ipt

Inventor already sets part number iProperty to 123-321-1

I want to set Prop1 to 123-321

 

For part 123-321-25.ipt

Inventor already sets part number iProperty to 123-321-25

I want to set Prop1 to 123-321

 

Any ideas?

Employee
Yijiang.Cai
Posts: 357
Registered: ‎05-20-2008
Message 2 of 5 (148 Views)

Re: Removing characters from iProperty

01-03-2013 09:51 PM in reply to: drguitarum2005

Assumed that there is one custom property named "Prop1" in the template, and please use the code lines below in your iLogic rule -

Temp=Split(iProperties.Value("Project", "Part Number"),"-")(UBound(Split(iProperties.Value("Project", "Part Number"),"-")))
iProperties.Value("Custom", "Prop1")=Left(iProperties.Value("Project", "Part Number"),Len(iProperties.Value("Project", "Part Number"))-Len(temp)-1)

 

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Distinguished Contributor
drguitarum2005
Posts: 196
Registered: ‎10-08-2012
Message 3 of 5 (135 Views)

Re: Removing characters from iProperty

01-04-2013 06:48 AM in reply to: Yijiang.Cai

Thanks for the help sir, I was able to take that, modify it a little, and get it to work on my template.

 

My problem now is, I have this rule running after save document. When I saved the template, it ran the rule and set the property. Now when I create a new part with that template, it still has the Prop1 value from the template, not from the new part. How do I make it overwrite the value again?

Distinguished Contributor
drguitarum2005
Posts: 196
Registered: ‎10-08-2012
Message 4 of 5 (135 Views)

Re: Removing characters from iProperty

01-04-2013 06:50 AM in reply to: drguitarum2005

Ignore that, dumb question. Changed it to "before save" it works fine.

 

Thanks!

Employee
Yijiang.Cai
Posts: 357
Registered: ‎05-20-2008
Message 5 of 5 (104 Views)

Re: Removing characters from iProperty

01-04-2013 06:03 PM in reply to: drguitarum2005

Really glad to know this could be helpful for you:smileyvery-happy:

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube