Parameter creating Rule needs to run for Drawing, Assembly, and Parts Individually.

Parameter creating Rule needs to run for Drawing, Assembly, and Parts Individually.

gconley
Advocate Advocate
277 Views
3 Replies
Message 1 of 4

Parameter creating Rule needs to run for Drawing, Assembly, and Parts Individually.

gconley
Advocate
Advocate

I have a rule that creates a Parameter inside an IDW file and works fine.

 

'Creating a Drop down for the Author
Dim List As New List(Of String)
List.Add("")
List.Add("DDiggler")
List.Add("BJohnson")
List.Add("JHolmes")
List.Add("LRichards")
List.Add("TWang")


Dim ParamName As String = "Author"

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oUPs As UserParameters = oDoc.Parameters.UserParameters
Dim oUP As UserParameter

Try
	oUP = oUPs.Item(ParamName)
Catch
    oUP = oUPs.AddByValue(ParamName, List(0), UnitsTypeEnum.kTextUnits)
	' Make parameter key
    oUP.IsKey = True
End Try
 MultiValue.List(ParamName) = List

  I believe it has something to do with DrawingDocument, so I changed it to PartDocument and it still didn't work.

I am still learning the iLogic / API and not sure what the issue could be.

 

This is the error I am getting.

gconley_0-1663871989124.png

 

 

Any ideas will be appreciated. 

0 Likes
Accepted solutions (1)
278 Views
3 Replies
Replies (3)
Message 2 of 4

tyler.warner
Advocate
Advocate

So you want this rule to be run within a drawing & if that drawing contains any parts or assemblies then you want the parameter to be created within those files as well?

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
0 Likes
Message 3 of 4

gconley
Advocate
Advocate
Accepted solution

Problem solved by Curtis Waguespack

 

'Creating a Drop down for the Author
Dim List As New List(Of String)
List.Add("")
List.Add("DDiggler")
List.Add("BJohnson")
List.Add("JHolmes")
List.Add("LRichards")
List.Add("TWang")


Dim ParamName As String = "Author"

Dim oDoc As Document = ThisDoc.Document
Dim oUPs As UserParameters
If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
oUPs = oDoc.Parameters.UserParameters
Else
oUPs = oDoc.ComponentDefinition.Parameters.UserParameters
End If

Dim oUP As UserParameter

Try
oUP = oUPs.Item(ParamName)
Catch
oUP = oUPs.AddByValue(ParamName, List(0), UnitsTypeEnum.kTextUnits)
' Make parameter key
oUP.IsKey = True
End Try

MultiValue.List(ParamName) = List

0 Likes
Message 4 of 4

gconley
Advocate
Advocate

No was just looking for it to do it per file.

0 Likes