cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Change parameter value with vbscript

Marius_D
6-Contributor

Change parameter value with vbscript

Hello,

 

i would like to change a parameter with vbscript. So far I have already managed to call a model from Windchill and check it out afterwards. I can also call the value of the parameter to be changed. Unfortunately I can not change its value.

 

I hope there are some experts here who can help me with my problem.

 

Here is my current code that works:

 

Option Explicit

'##################################################

 

Dim asynconn
Dim conn
Dim session
Dim mdlname  'modelname
Dim mdl   'Ipfc Model
Dim server   'Ipfc Server
Dim modelDesc  'Ipfc Model Descriptor

 


Set asynconn = CreateObject("pfcls.pfcAsyncConnection")
Set conn = asynconn.Connect("", "", ".", 5)
Set session = conn.session

 

mdlname = "test.prt"

set server = session.GetActiveServer

set modelDesc = CreateObject("pfcls.pfcModelDescriptor").CreateFromFileName(mdlname)

session.openFile(modelDesc).activate()

set mdl = session.Currentmodel
         
server.CheckoutObjects Nothing, mdl.filename, True, Nothing


'##################################################

Dim param  'Ipfc Base Parameter
Dim Powner  'Ipfc Parameter Owner
Dim Paramname  'Parametername
Dim paramValue  'Ipfc Param Value

 

paramname = "testparam"

Set Powner = mdl
Set param = Powner.GetParam(paramname)


MsgBox Param.value.stringvalue


conn.Disconnect(2)

'##################################################

 

Thanks for your help

Marius

1 REPLY 1
Top Tags