- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is Part 2 of a previous post:
https://forums.autodesk.com/t5/inventor-customization/copy-all-custom-iproperties/m-p/6941570#M70802
@HermJan.Otterman helped with this great rule (Below) to Copy all the Custom iProperties from a derive into the new part.
In using the rule we have found out that it does not check for existing first; if the Custom iProperty is already existing, it adds a new iProperty "Inventor User Defined Properties#". I would like for it to overwrite the existing iProperty.
I have tried several "Try/Catch" and "If/Then" options, but they error out or run with no change in results.
Can someone provide guidance?
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 7314 StartFragment: 314 EndFragment: 7282 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
'-----Start iLogic Rule "Copy all Custom iProperties from original derive" Dim derivedComponent As Inventor.Document = ThisApplication.ActiveDocument 'if there is only one reference: Dim referencedComponent As Inventor.Document = derivedComponent.ReferencedDocuments(1) Dim deriProps As PropertySet = derivedComponent.PropertySets.Item("Inventor User Defined Properties") Dim refiProps As PropertySet = referencedComponent.PropertySets.Item("Inventor User Defined Properties") Dim oProp As Inventor.Property For Each oProp In refiProps Try deriProps.Add(oProp.Value, oProp.Name) Catch ex As Exception deriProps.Add(oProp.Value) End Try Next '-----End iLogic Rule
Secondary goal; is there a way to modify this code to have it pull only a specific iProperty? I have one called "CMF_DESGINATION" that I need most of the time, so I was trying to change the above to ignore all except this one.
Thank you all for your help as I learn these processes.
*(And thank you to Mod the Machine, From the Trenches, If This Then That and all the other sites!)
Kenny
*Edit, I had tried (`) at the Catch phrase above during testing and forgot to remove it on the post.
Solved! Go to Solution.