Community
hi,
how to check if a part document is a derived part in vba? then, I can check if its link is fine and updated.
thanks.
Solved! Go to Solution.
Solved by humbertogo. Go to Solution.
from Manufacturing DevBlog
Public Sub ModifDerivedParams() If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then MsgBox("Make a Part Document the active document") End End If Dim oDerPart As PartDocument oDerPart = ThisApplication.ActiveDocument Dim oDerPartComp As DerivedPartComponent If oDerPart.ComponentDefinition.ReferenceComponents. DerivedPartComponents.Count < 1 Then MsgBox("No Derived Part Components in this part") End End If oDerPartComp = oDerPart.ComponentDefinition. ReferenceComponents.DerivedPartComponents(1) Dim oDerivedPartDef As DerivedPartUniformScaleDef oDerivedPartDef = oDerPartComp.Definition Dim oDerEntity As DerivedPartEntity For Each oDerEntity In oDerivedPartDef.Parameters If (oDerEntity.ReferencedEntity.Name = "d1") Then oDerEntity.IncludeEntity = True Exit For End If Next 'Set Definition back, so DerivedPart Document is updated oDerPartComp.Definition = oDerivedPartDef End Sub