Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to get a user parameter copied in to a derived part. I got help from the forum and tailored to my requirement.
In my rule, I have a problem in the last line.
I Request help.
Sub main() 'Public Sub ModifDerivedParams() oTDMD = ThisDoc.ModelDocument oFFN_TDMD = oTDMD.FullFileName 'Full File Name (ABS)of THMD oDN_wExt_TDMD = oTDMD.DisplayName 'Display Name (LFN)of THMD 'https://adndevblog.typepad.com/manufacturing/2012/06/includeexclude-parameters-from-the-base-part-in-a-derived-part.html If oTDMD.DocumentType <> kPartDocumentObject Then MsgBox("Make a Part Document the active document") Exit Sub Else MsgBox("This drawig has a part document") End If If oTDMD.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Count < 1 Then MsgBox("No Derived Part Components in this part") Exit Sub Else MsgBox("This part has Derived Part Components") End If Dim oDPs As New ArrayList() For Each oDP In oTDMD.ComponentDefinition.ReferenceComponents.DerivedPartComponents MessageBox.Show("oDP: " & oDP.Name, "Title") oDPs.Add(oDP) Next oDP 'oDP_Selected = oDerPart.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1) oDP_Selected = InputListBox("Prompt", oDPs, oDPs(0), Title := "SELECT DP FROM", ListName := "LIST OF DPs") Dim oDerivedPartDef As DerivedPartUniformScaleDef oDerivedPartDef = oDP_Selected.Definition Dim oDerEntity As DerivedPartEntity For Each oDerEntity In oDerivedPartDef.Parameters If oDerEntity.ReferencedEntity.Name.Contains("D3") Then MessageBox.Show("oDerEntity.ReferencedEntity.Name: " & oDerEntity.ReferencedEntity.Name, "Title") oDerEntity.IncludeEntity = True End If Next 'To set Definition back, so DerivedPart Document is updated oDP_Selected.Definition = oDerivedPartDef End Sub
Solved! Go to Solution.