Create a Multivalue Parameter in a drawing with ilogic after drawing is created

Create a Multivalue Parameter in a drawing with ilogic after drawing is created

rluttrellCRO
Participant Participant
415 Views
1 Reply
Message 1 of 2

Create a Multivalue Parameter in a drawing with ilogic after drawing is created

rluttrellCRO
Participant
Participant

Hi,

im trying to create a multivalue parameter to select a template once a drawing has been created. The idea is to have an input list show and the user picks a template and the drawing will load in the foormats. I have the formats set up and have most of the code to load those written and i cna get the drawing t create how i would like, my issue is with the input box list and multivalue parameter. i cant get it to populate in the drawing itself, i found some help and was able to get it into the part but would like this parameter to live in drawings and not the part itself.

 

Example of what i have been working with below:

Dim oDoc2 As Document = ThisApplication.ActiveDocument
Dim oPar2 As UserParameters = oDoc2.Parameters.UserParameters
Dim oPar1 As UserParameter


MultiValue.SetList("Select Template","Onsrud Template", "Part Template", "Assy Template")
Dim oTemplateSelect = InputListBox("Select a Template", MultiValue.List("Select Template"), oTemplateSelect, Title := "Select a Template", ListName := "List")
'= InputBox("Select a Template", "Template Selection", "Onsrud Template")

Try
    oPar1 = oPar2.Item("Select_Template")
Catch
    oPar1 = oPar2.AddByValue("Select_Template", 0, UnitsTypeEnum.kDegreeAngleUnits)
End Try


'Parameter("Select_Template") = ThisDrawing.Document.Parameters.UserParameters
'oParameter = Parameter("Select_Template").AddByValue("Select Template", "Onsrud Template", UnitsTypeEnum.kTextUnits)
'MultiValue.SetList("Select Template","Onsrud Template", "Part Template", "Assy Template")

'oSelectTemplate = InputListBox("Select a Template", MultiValue.List("Select Template"), oSelectTemplate, Title := "Select a Template", ListName := "List")

 

And here is the example code I found on here that i got to work for inserting into a part but cant get it to work for the drawing document:

 

'Create Parameter for selecting template
If oPartDoc.DocumentType = kPartDocumentObject Then

Dim oPartCompDef As PartComponentDefinition
oPartCompDef = oPartDoc.ComponentDefinition

Dim oParams As Parameters
oParams=oPartCompDef.Parameters

Dim oUserParams As UserParameters
oUserParams=oParams.UserParameters

Dim oAwesomeParameter As Parameter

Try
otester = oUserParams.Item("AwesomeParameter")
Catch
oInsulationType=oUserParams.AddByValue("AwesomeParameter", "Option1", kTextUnits)
MultiValue.SetList("AwesomeParameter", "Option1", "Option2", "Option3", "Option4")
End Try
End If

Parameter.Param("AwesomeParameter").ExposedAsProperty = False
Parameter.Param("AwesomeParameter").IsKey = True

 

 

Any help or direction would be greatly appreciated, im sure its something simple im overlooking.

 

 

0 Likes
416 Views
1 Reply
Reply (1)
Message 2 of 2

rluttrellCRO
Participant
Participant

Edit***

 

I'm able to get this code to work in the part but would like to do assembly as well or have it alwasy live in the drawing as stated before. any help?

 

'Create Parameter for selecting template
	Dim oPartCompDef As PartComponentDefinition
		oPartCompDef = oPartDoc.ComponentDefinition
		
Dim oParams As Parameters
		oParams = oPartCompDef.Parameters
				
		Dim oUserParams As UserParameters
		oUserParams=oParams.UserParameters       
		
		Dim oTemplateSelect As Parameter                     
				
		Try
			otester = oUserParams.Item("TemplateSelect")
			Catch
oInsulationType=oUserParams.AddByValue("TemplateSelect", "Onsrud Template", kTextUnits) 
MultiValue.SetList("TemplateSelect", "Onsrud Template", "Onsrud Part Template", "Onsrud Assembly Template", "Sheet Metal Template","200 Template", "201 Template", "205 Template", "109 Template", "115 Template", "115 Config Template")
			End Try
        
Parameter.Param("TemplateSelect").ExposedAsProperty = False
Parameter.Param("TemplateSelect").IsKey = True
 
 Dim oList = InputListBox("TemplateSelect", MultiValue.List("TemplateSelect"))
0 Likes