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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Creo 9 problem retrieving parameter value.


Creo 9 problem retrieving parameter value.

If i run the following code in windows scripting host running in either wsh or csh. This works fine in Creo 7 and 8 but reports: pfcExceptions::XToolkitObsoleteFunc in Creo 9 on the para.Value call. If this truly is obsolete function? If it is obsolete is there a list of what was deprecated? Or is it just a installation problem?


Code distilled to smallest possible repeatable unit. Open a part or assembly into creo. Put following into a file with .js extension and run the file in windows scripting host (usually just double clicking of file but other programs might have hijacked the function so...).



var assCon = WScript.CreateObject('pfcls.pfcAsyncConnection');

var paraName = 'DESCRIPTION';

var conn = assCon.Connect('','','.',1);
var session = conn.session;

var mdl = session.CurrentModel; 
var para = mdl.GetParam(paraName); 
var val = para.Value; 
WScript.Echo(paraName + " = \"" + val.StringValue+"\"");





Accepted Solutions


please ask PTC Support.

Martin Hanák

View solution in original post



please ask PTC Support.

Martin Hanák

I can't somebody has screwed up my support registrations so i can not report issues for creo, i can for mathcad (which i dont manage or use). Its not really super critical for me, ill just skip teaching users how to script in creo context and just teach solidworks instead. Loss for PTC sure but not me personally.


Here's some VBA code using the Creo VB API that handles the different parameter types and uses GetScaledValue.



  • This uses both IpfcBaseParameter and IpfcParameter to access the different properties of each.
  • There are 4 different types of parameters to account for (String, Integer, Boolean, Double)


Dim model as IpfcModel
Dim paramOwner As IpfcParameterOwner
Dim parameter As IpfcParameter
Dim Param As IpfcBaseParameter
Dim CreoParameterValueStr as String
Dim ParamName as String

Set model = session.CurrentModel
Set paramOwner = model
Set parameter = paramOwner.GetParam(ParamName)
If Not parameter Is Nothing Then
  Set Param = paramOwner.GetParam(ParamName)
  If Param.Value.discr = EpfcPARAM_STRING Then
    CreoParameterValueStr = parameter.GetScaledValue.StringValue 'String
  ElseIf Param.Value.discr = EpfcPARAM_INTEGER Then
    CreoParameterValueStr = parameter.GetScaledValue.IntValue 'Integer
  ElseIf Param.Value.discr = EpfcPARAM_BOOLEAN Then
  CreoParameterValueStr = parameter.GetScaledValue.BoolValue 'Boolean
    ElseIf Param.Value.discr = EpfcPARAM_DOUBLE Then
  CreoParameterValueStr = parameter.GetScaledValue.DoubleValue 'Double
  End If
  CreoParameterValueStr = "ERROR: PARAMETER MISSING"
End If



Top Tags