Created
August 25, 2021 08:28
-
-
Save autokludge/47ac76270956bf1cb00190c21ec8c5da to your computer and use it in GitHub Desktop.
set length user parameter (untested)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main | |
Dim asmDoc As AssemblyDocument = ThisApplication.ActiveDocument | |
'Iterate through all of the referenced documents | |
For Each doc As Document In asmDoc.AllReferencedDocuments | |
'update the components | |
If doc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then | |
AddLengthParameter(doc) | |
End If | |
Next | |
End Sub | |
Sub AddLengthParameter(oDoc As PartDocument) | |
'Get the user parameters collection. | |
Dim userParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters | |
Dim param As Parameter | |
'Set/create parameter | |
Try | |
param = userParams.Item("Length") | |
param.Expression = "B_L" | |
Catch | |
'The parameter doesn't exist so add it. | |
param = userParams.AddByExpression("Length", "B_L", UnitsTypeEnum.kDefaultDisplayLengthUnits) | |
End Try | |
param.ExposedAsProperty = true | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment