Message 1 of 2
Update derived part parameters

Not applicable
05-26-2016
05:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I'm writing a simple script to update user parameters of a derived part. The derived part already exists, I just want to add all new 'User Parameters'. I thought I had it figured out, but the line where I set "IncludeEntity" to true has no effect. Here's the code below, and the line that doesn't do what I want is highlighted in Red.
I would expect it to change "IncludeEntity" to true, but instead it just leaves it as false. No error messages, the file has read/write access so I'm not sure what else it could be.
Any suggestions?
Dim oapp As Application Dim oDoc As PartDocument Dim oDerDoc As DerivedPartComponent Set oapp = ThisApplication Set oDoc = oapp.ActiveDocument On Error GoTo subError 'UPDATE DERIVED COMPONENT WITH ALL USER PARAMETERS Dim sDerivedComp As String sDerivedComp = "P00031-001-000.ipt" If MsgBox("Get User Parameters from " & sDerivedComp & "?", vbYesNo, "Update Derived Component") = vbYes Then For Each oDerDoc In oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents If oDerDoc.Name = sDerivedComp Then Exit For Next If oDerDoc Is Nothing Then If MsgBox("No derived part named " & sDerivedComp & " found. Would you like to continue?", vbOKCancel) = vbCancel Then GoTo subExit End If Dim DerEnt As DerivedPartEntity Dim X1 As Integer For Each DerEnt In oDerDoc.Definition.Parameters X1 = X1 + 1 If DerEnt.ReferencedEntity.Type = kUserParameterObject Then If oDerDoc.Definition.Parameters(X1).IncludeEntity = False Then oDerDoc.Definition.Parameters(X1).IncludeEntity = True End If End If Next End If