Task Based Application Libraries
Applications created using different Creo Parametric API products are interoperable. These products use Creo Parametric as the medium of interaction, eliminating the task of writing native-platform specific interactions between different programming languages.
With application interoperability Creo.JS applications can call into Creo TOOLKIT from areas not covered in the native interface. You can an HTML front end on legacy Creo TOOLKIT applications..
Managing Application Arguments
Creo.JS passes application data to and from tasks in other applications as members of a sequence of pfcArgument objects. Application arguments consist of a label and a value. The value can be of any one of the following types:
•  Integer
•  Double
•  Boolean
•  ASCII string (a non-encoded string, provided for compatibility with arguments provided from C applications)
•  String (a fully encoded string)
•  pfcSelection (a selection of an item in a Creo Parametric session)
•  pfcTransform3D (a coordinate system transformation matrix)
Methods and Properties Introduced:
  • pfcCreateIntArgValue()
  • pfcCreateDoubleArgValue()
  • pfcCreateBoolArgValue()
  • pfcCreateASCIIStringArgValue()
  • pfcCreateStringArgValue()
  • pfcCreateSelectionArgValue()
  • pfcCreateTransformArgValue()
  • pfcArgValue.discr
  • pfcArgValue.IntValue
  • pfcArgValue.DoubleValue
  • pfcArgValue.BoolValue
  • pfcArgValue.ASCIIStringValue
  • pfcArgValue.StringValue
  • pfcArgValue.SelectionValue
  • pfcArgValue.TransformValue
  • The class pfcArgValue contains one of the seven types of values. Creo.JS provides different properties to create each of the seven types of argument values.
    Use the method pfcCreateIntArgValue() to create an integer argument value object.
    Use the method pfcCreateDoubleArgValue() to create a double argument value object.
    Use the method pfcCreateBoolArgValue() to create an Boolean argument value object.
    Use the method pfcCreateASCIIStringArgValue() to create an ASCII string argument value object.
    Use the method pfcCreateStringArgValue() to create a string argument value object.
    Use the method pfcCreateSelectionArgValue() to create a new selection argument value object.
    Use the method pfcCreateTransformArgValue() to create a new transform argument value object.
    The property pfcArgValue.discr returns the type of value contained in the argument value object.
    Use the properties pfcArgValue.IntValue , pfcArgValue.DoubleValue, pfcArgValue.BoolValue, pfcArgValue.ASCIIStringValue, pfcArgValue.StringValue, pfcArgValue.SelectionValue, and pfcArgValue.TransformValue to access and modify the argument values.
    Modifying Arguments
    Methods and Properties Introduced:
  • pfcArgument.Create()
  • pfcArgument.Label
  • pfcArgument.Value
  • The method pfcArgument.Create() creates a new argument. Provide a name and value as the input arguments of this method.
    The property pfcArgument.Label returns the label of the argument.
    The property pfcArgument.Value returns the value of the argument.
    Launching a Creo Parametric TOOLKIT DLL
    The methods described in this section enable a Creo.JS user to register and launch a Creo TOOLKIT DLL from a Creo.JS application. The ability to launch and control a Creo TOOLKIT application enables the following:
    •  Reuse of existing Creo TOOLKIT code with Creo.JS applications.
    •  ATB operations.
    Methods and Properties Introduced:
  • pfcBaseSession.LoadProToolkitDll()
  • pfcBaseSession.LoadProToolkitLegacyDll()
  • pfcBaseSession.GetProToolkitDll()
  • pfcDll.ExecuteFunction()
  • pfcDll.Id
  • pfcDll.IsActive()
  • pfcDll.Unload()
  • Use the method pfcBaseSession.LoadProToolkitDll() to register and start a Creo TOOLKIT DLL. The input parameters of this method are similar to the fields of a registry file and are as follows:
    •  ApplicationName—Name of the application to initialize.
    •  DllPath—Full path to the DLL binary file.
    •  TextPath—Path to the message and user interface files for the application.
    •  UserDisplay—Set this parameter to true to register the application in the Creo Parametric user interface and to see error messages if the application fails. If this parameter is false, the application is invisible to the user.
    The user_initialize() function for the application is called when the application is started. The method returns a handle to the loaded Creo TOOLKIT DLL.
    To register and start a legacy Pro/TOOLKIT DLL that is not Unicode-compliant, use the method pfcBaseSession.LoadProToolkitLegacyDll(). It takes the same input parameters as the earlier method pfcBaseSession.LoadProToolkitDll().
    Use the method pfcBaseSession.GetProToolkitDll() to obtain a Creo TOOLKIT DLL handle. Specify the Application_Id, that is, theidentifier string for the DLL as the input parameter of this method. The method returns the DLL object or null if the DLL was not in session. The Application_Id can be determined as follows:
    •  Use the function ProToolkitDllIdGet() within the DLL application to get a string representation of the DLL application. Pass NULL to the first argument of ProToolkitDllIdGet() to get the string identifier for the calling application.
    •  Use the Get method for the Id attribute in the DLL interface. The property pfcDll.Id returns the DLL identifier string.
    Use the method pfcDll.ExecuteFunction() to call a properly designated function in the Creo TOOLKIT DLL library. The input parameters of this method are:
    •  FunctionName—Name of the function in the Creo TOOLKIT DLL application.
    •  InputArguments—Input arguments to be passed to the library function.
    The method returns an object of class pfcFunctionReturn. This interface contains data returned by a Creo TOOLKIT function call. The object contains the return value, as integer, of the executed function and the output arguments passed back from the function call.
    The method pfcDll.IsActive() determines whether a Creo TOOLKIT DLL previously loaded by the method pfcBaseSession.LoadProToolkitDll() is still active.
    The method pfcDll.Unload() is used to shutdown a Creo TOOLKIT DLL previously loaded by the method pfcBaseSession.LoadProToolkitDll() and the user_terminate() function for the application is called.
    Launching Tasks from J-Link Task Libraries
    Use the methods described in this section to launch tasks from a predefined J-Link task library.
    Methods Introduced:
  • pfcBaseSession.StartJLinkApplication()
  • pfcJLinkApplication.ExecuteTask()
  • pfcJLinkApplication.IsActive()
  • pfcJLinkApplication.Stop()
  • Use the method pfcBaseSession.StartJLinkApplication() to start a J-Link application. The input parameters of this method are similar to the fields of a registry file. A list of input parameters and what each parameter specifies, follows:
    •  ApplicationName—A unique name that is assigned to this J-Link application.
    •  ClassName—Name of the Java class that contains the start and stop method of the J-Link application. . This should be a fully qualified Java package and class name.
    •  StartMethod—Start method of the J-Link application.
    •  StopMethod—Stop method of the J-Link application.
    •  AdditionalClassPath—Locations of packages and classes that must be loaded when starting this J-Link application. If this parameter is specified as null, the default classpath locations are used.
    •  TextPath—Application text path for menus and messages. If this parameter is specified as null, the default text locations are used.
    •  UserDisplay—Whether to display the application in the Auxiliary Applications dialog box in Creo Parametric.
    When starting the application, the static start() method is invoked. The method returns a pfcJLinkApplication referring to the J-Link application.
    The method pfcJLinkApplication.ExecuteTask() calls a registered task method in a J-Link application. The input parameters of this method follow:
    •  Name of the task to be executed.
    •  A sequence of name value pair arguments contained by the interface pfcArguments.
    The method outputs an array of output arguments.
    The method pfcJLinkApplication.IsActive() returns a True value if the application specified by the pfcJLinkApplication object is active.
    The method pfcJLinkApplication.Stop() stops the application specified by the pfcJLinkApplication object. This method activates the static Stop() method for the application.