Message 1 of 7
Replace derived part via API is limited vs the right click menu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I noticed today that the right click option for Replace Base Component on a derived part does not appear to care if the original and replacement part have the same document ID. Where as with the API example below the replacement part needs to share the document ID of the original derived part.
I'd like to update my addin to work the same way as the right click menu does, since it lets you replace a grease fitting with a pulley. Does anyone have a clue how the right click feature works and if it can be emulated with the API? Otherwise I'll probably just remove my script and point everyone to the right click menu.
Try
Dim oPartDoc As Document = ThisDoc.Document
Dim oRefPartDoc As DocumentDescriptor= oPartDoc.ReferencedDocumentDescriptors.Item(1)
oRefPartDoc.ReferencedFileDescriptor.ReplaceReference("FILE NAME HERE")
oPartDoc.Update()
Catch ex As Exception
MsgBox("Model seems to be not the same!")
End Try