05-09-2021
02:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-09-2021
02:32 PM
The two of these sources were useful for researching this.
This one is more in depth copying all iProperties or selected iProperties,
However the selected iProperties failed to run for me so I created the below to just target the iProperty you requested.
If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then MessageBox.Show("Make a Part Document the active document,Exiting", "iLogic") Else Dim oDerDoc As PartDocument oDerDoc = ThisApplication.ActiveDocument 'Look for Derived part components If oDerDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Count < 1 Then MessageBox.Show("No Derived Part Components in this part", "iLogic") ElseIf oDerDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Count > 1 Then MessageBox.Show("More than one Derived Part Components in this part,Exiting!", "iLogic") Else ' Set a reference to the part component definition Dim oDerCompDef As PartComponentDefinition oDerCompDef = oDerDoc.ComponentDefinition 'Get a reference to derived part components in this part Dim oDerComps As DerivedPartComponents oDerComps = oDerCompDef.ReferenceComponents.DerivedPartComponents 'Get a reference to derived part component Dim oDerComp As DerivedPartComponent oDerComp = oDerComps(1)'1st component 'MessageBox.Show(oDerComp.Name, "iLogic") ' Get the Reference document. Dim oRefDoc As Document oRefDoc = oDerComp.ReferencedDocumentDescriptor.ReferencedDocument
'Creates the iProperty in the derived part and assigns the iProperty value of the refDoc iProperties.Value("Custom", "ParentPartNumber") = iProperties.Value(oRefDoc.DisplayName,"Project", "Part Number") MessageBox.Show("iProperty Copied from Parent to Child", "Success") End If End If
I hope that helps.
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan
Or if this helped you, please, click (like)
Regards
Alan