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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How to get a weblink "pfcBaseSession" object?

RandyJones
19-Tanzanite

How to get a weblink "pfcBaseSession" object?

Creo Parametric 2.0 M130

I want to use weblink to get the current value of a config option.In my case I want to get the value
of start_model_dir.

According to CS122393 it should be as simple as using pfcBaseSession.GetConfigOption(). However when
I attempt to do this:
var startModelDir = pfcBaseSession.GetConfigOption("start_model_dir");

I get a javascript error:
pfcBaseSession is not defined

So obviously there is more to this than what CS122393 states.

Does anybody have a working code snippet that uses any of the pfcBaseSession weblink methods they
would be willing to share?

Thanks

--
This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
4 REPLIES 4

Good morning,

if you want to learn how to start with Weblink it is neccessary to read the "Introduction" chapter in the Weblink API documentation.
There are examples how to get the session object and the important pfcCreate() method.

The Weblink API doc can be found in the folder <creo_installation_dir>/Common Files/M130/weblink/weblinkdoc.

Andreas

Randy,

Try this

var session = pfcCreate("MpfcCOMGlobal").GetProESession();

var dir = session.GetConfigOption("start_model_dir");

Regards,


Mike Phillips
Raytheon

-----Randy Jones <-> wrote: -----

On 11/24/14 09:55, Michael D1 Phillips wrote:
> Randy,
> Try this
> var session = pfcCreate("MpfcCOMGlobal").GetProESession();
> var dir = session.GetConfigOption("start_model_dir");

Perfect!
That is exactly what I needed but couldn't arrive at from the weblink users guide or the javascript
examples.

I had tried all combinations of
var baseSession = pfcCreate("MpfcBaseSession");
var baseSession = pfcCreate("pfcBaseSession");

and then
baseSession.GetConfigOption("start_model_dir");


Thanks.

> Regards,
> Mike Phillips
> Raytheon
>
> -----Randy Jones <-> wrote: -----
> To: -
> From: Randy Jones <->
> Date: 11/21/2014 03:09PM
> Subject: [proecus] - How to get a weblink "pfcBaseSession" object?
>
> Creo Parametric 2.0 M130
>
> I want to use weblink to get the current value of a config option.In my case I want to get the value
> of start_model_dir.
>
> According to CS122393 it should be as simple as using pfcBaseSession.GetConfigOption(). However when
> I attempt to do this:
> var startModelDir = pfcBaseSession.GetConfigOption("start_model_dir");
>
> I get a javascript error:
> pfcBaseSession is not defined
>
> So obviously there is more to this than what CS122393 states.
>
> Does anybody have a working code snippet that uses any of the pfcBaseSession weblink methods they
> would be willing to share?
>
> Thanks
>
> --
>

Hi Randy,

If it's still relevant on the following link found following solution:

  • The variable is a handle of the active Creo session. It could be retrieved (Interface) and could not be instantiated
  • we can simple get via casting pfcBaseSession <=> pfcSession
  • Example:

session=(new ActiveXObject ("pfc.MpfcCOMGlobal")).GetProESession ();
//the GetProESession returns a pfcSesson object

session.GetConfigOption("regen_failure_handling");
//pfcBaseSession method from a pfcSession object is automatic get along the
// inheritance of the object

Regards,

Aduard

Top Tags