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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Change parameter value with vbscript

Marius_D
7-Bedrock

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
Announcements
NEW Creo+ Topics: PTC Control Center and Creo+ Portal


Top Tags