Inventor Engineer-to-Order

Inventor Engineer-to-Order

Reply
Mentor
FarrenYoung
Posts: 264
Registered: ‎07-13-2009
Message 1 of 2 (91 Views)

Cannot set rule iProperties if iProperty name starts with underscore - Error

91 Views, 1 Replies
11-05-2012 12:42 PM

Assuming I have a custom iProperty pre-existing in my document that starts with an underscore, I am getting an error when setting the iProperties rule. 

 

Rule iProperties As List = {{"_10_DRAWING_NUM", "MyNumber"}} 'for example

 

If my document doesn't already have the iProperty starting with a underscore, it will create it and have no problems.  Has anyone else ran into this?

 

--Farren

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************
Mentor
FarrenYoung
Posts: 264
Registered: ‎07-13-2009
Message 2 of 2 (88 Views)

Re: Cannot set rule iProperties if iProperty name starts with underscore - Error

11-05-2012 02:06 PM in reply to: FarrenYoung

I believe this is due to the fact that an iProperty starting with an underscore is a special case in Inventor.  It basically makes it only accessible by name PropertySet.Item("_PropNameHere") and not by looping through the collection (I haven't figured out where this would be useful).

 

So my assumption is that the intent function is looping through the collection of properties and comparing the names until it finds it.  If it doesn't it is creating it (as it should).  If it does exist, it thinks it doesn't exist since it wasn't visible in the collection and then tries to create it, throwing an error since it already exists.

 

This is a problem because the first time it creates my drawing it will correctly add the iproperty, but when the drawing is modified it will again call iv_PropertyPut and error out.

 

Obviously the solution is to just get the item by name.

 

Thoughts?

--Farren

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.