User text parameter with model states

User text parameter with model states

michal.skubik
Explorer Explorer
265 Views
4 Replies
Message 1 of 5

User text parameter with model states

michal.skubik
Explorer
Explorer

Hello, is it possible modify code bellow to work with model states?

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim OComp As ComponentDefinition = oDoc.ComponentDefinition
Dim oUPs As UserParameters = OComp.Parameters.UserParameters
Dim oUP As UserParameter

Dim xlsFile As String = "c:\_WORK_AV\Engineering\_Invdata\iLogic\Category.xls"
GoExcel.Open(xlsFile, "Sheet1")

Dim i As Integer = 2
Dim Param As String
Dim List As IList
Do Until i = 100
	Param = GoExcel.CellValue ("A" & i)
	If Param = "" Then Exit Do
	List = GoExcel.CellValues("B" & i, "L" & i)
	Try
		Test = oUPs.Item(Param)
	Catch
		oUP = oUPs.AddByValue(Param, GoExcel.CellValue("B" & i), UnitsTypeEnum.kTextUnits)
	End Try
	MultiValue.List(Param) = List
	i = i + 1
	
Loop
0 Likes
266 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @michal.skubik.  Do you want those values to be put into the main 'factory document' or do you want them put into a specific model state member?  If in a specific member, what is its name?  Is this code always working with a Part, an Assembly, or both/either?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

michal.skubik
Explorer
Explorer

Hi, I would like to put them in specific model state members, I would like to do it for any name not for specific. It should fit for every assembly or part. 

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor
  1. So...if you want the Excel values to go into a model state member, but you do not want to specify a specific model state name, then:
    1. What should it do if there are multiple model states present in the model document...how should the code determine which one to put the values into?
    2. Should it just put them into whichever one is currently active?
    3. Should it always just create a New ModelState, then put the values into that new one.
    4. What if the 'Master' model state is currently active?

When a new parameter is created, it will be made available to the factory document and all other model states, no matter which model state may have been active at the time.  That's just how that works.  But within each ModelState member, you have the option to change/customize the parameter's value different from the factory document's value.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

michal.skubik
Explorer
Explorer

Hi,

1, It should determine on the base of part number, which will be manualy putted before

2, Yes it should put just into currently active model state.

3, No, it should not create new model state, just rewrite or write new parameters.

4, Activation of the code will be manual.

 

 

0 Likes