iRule Remove Custom Property

iRule Remove Custom Property

jbwaiteG7526
Contributor Contributor
1,191 Views
4 Replies
Message 1 of 5

iRule Remove Custom Property

jbwaiteG7526
Contributor
Contributor

In an iLogic rule, I can create a property in the "Custom" tab by simply defining it :

      iProperties.Value("Custom", "NewParam") = "value"

 

I can not find a method to Remove/Delete/Erase that "NewParam" from the custom tab.

In particular, someone had edited the default part template and had a "LENGTH" field on the custom tab.  I have a rule that checks many parameters and fields to make sure they are correct for passing to our post-processing program and I would like the rule to check if this "LENGTH" field exists and then it completely remove it.

 

Jim

0 Likes
Accepted solutions (2)
1,192 Views
4 Replies
Replies (4)
Message 2 of 5

mcgyvr
Consultant
Consultant
Accepted solution

 

'define list of custom properties to delete
Dim MyArrayList As New ArrayList
MyArrayList.add("LENGTH")

'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'look at each property in the collection
For Each oCustProp in oCustomPropertySet
'check property name against the list you want to delete
If MyArrayList.Contains(oCustProp.name)Then
'delete the custom iProperty
oCustProp.Delete 
Else 
'skip it
End If
Next

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @jbwaiteG7526 

 

Here is another example.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Try
ThisDoc.Document.PropertySets.Item _
	("Inventor User Defined Properties").Item("LENGTH").Delete
Catch' catch error when property is not present
End Try

 

EESignature

Message 4 of 5

WCrihfield
Mentor
Mentor

Hi @jbwaiteG7526 

Just another note on the subject.  That "Length" custom property may have been made automatically by Inventor, if within the Parameters dialog of that document there is a parameter named "Length", and someone checked the checkbox option for that parameter in the "Export Parameter" column.  When you check that box, it 'exposes' that parameter as a custom iProperty automatically for you (creates a custom iProperty with the same name and value as the parameter).  Also after that option has been checked, more options become available under your right-click menu for that parameter, where you can further customize how you want that custom iProperty to be formatted.  If this is the reason that custom iProperty exists, you can probably just uncheck that option in the parameters dialog box to get rid of that custom iProperty.  Just thought you should know, if you didn't already. 🙂

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

jbwaiteG7526
Contributor
Contributor

This was one we had made sure to check.

The "LENGTH" was coming in from a "template" that was made a while ago in the default ".ipt" template.

 

Thanks for your response.

0 Likes