03-08-2021
05:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-08-2021
05:40 AM
While I think your code chunk would work; here's a bigger picture of the relevant code so people have a better idea of what's going on:
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim AssyDoc As AssemblyDocument = ThisApplication.Documents.Add(kAssemblyDocumentObject, "{source Assy filepath}", True)
Dim oUParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
Dim iUParamCount As Integer = oUParams.Count
Dim Cycle As Integer
Dim uParamName As String
For Cycle = 1 To iUParamCount
uParamName = oUParams(Cycle).Name
If oUParams(Cycle).IsKey = True Then
If oUParams(Cycle).Units = "ul" Then
AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByExpression(uParamName, oUParams(Cycle).Value, "ul").IsKey = True
' If oUParams(Cycle).ExpressionList.Count > 0 Then
' AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByExpression(uParamName, MultiValue.List(uParamName), "ul").IsKey = True
' End If
Else If oUParams(Cycle).Units = "Text" Then
AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByValue(uParamName, oUParams(Cycle).Value, kTextUnits).IsKey = True
Else
AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByValue(uParamName, oUParams(Cycle).Value, kMillimeterLengthUnits).IsKey = True
End If
End If
Next
It's because I'm trying to transfer the parameters between the source (part) file to the destination (part or assy) file that I'm tripping up.