- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm trying to write some iLogic that will create a virtual component, and populate its Part Number and Description iProperties to match the parent assembly (the reason I want to do this is not important). I'd like it to just populate these iProperties if that virtual component already exists. I'm a real novice at this, but have managed to get the following to work by copying snippets of code from elsewhere:
'Create Virtual Component
oOcc = oAsm.ComponentDefinition.Occurrences.AddVirtual("virtualPart", oMatrix)
'edit iProperties
oOcc.Definition.PropertySets.Item(3).Item("Part number").Value = iProperties.Value("Project", "Part Number")
oOcc.Definition.PropertySets.Item(3).Item("Description").Value = iProperties.Value("Project", "Description")
This works great to create the virtual part and populate the iProperties, but if I run it again, it throws an error ("The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))" ) and does not update the iProperties, presumably because "virtualPart" already exists. How can I get this to update the iProperties if the virtual component has already been created?
Apologies for the simplistic nature of this, like I said, I'm very new to this!
Solved! Go to Solution.