Skip to main content
10-Marble
May 30, 2022
Solved

pfcViewOwner.SetCurrentViewTransform(pfcTransform3D) API cause an pfcXToolkitBadInputs exception

  • May 30, 2022
  • 2 replies
  • 2407 views

I am using Creo Parametric Release 8.0 and Datecode8.0.4.0, there is some unexpected exception happended with following code,I.m sure that the .prt I got from session is valid.

My finally purpose is creating a new pfcTransform3D and setting the matirx data, then call this api to change view in window.

//Get Current Mdl From Session
var session = pfcGetProESession();
var part = session.CurrentModel;
if (part.Type == pfcCreate ("pfcModelType").MDL_PART) {
        var pfcTransform3D = part.GetCurrentViewTransform();
        //below code cause an exception (pfcXToolkitBadInputs)
        part.SetCurrentViewTransform(pfcTransform3D);
}

Best answer by remy

Right then it is a Java Script issue pertaining to the inheritance capability specific to that language.

Given that i'm not an expert with Java Script, i suggests that you file an actual Support case, share all that has been disclosed so far and a proper Java Script engineer will take over.

 

File your case here: https://support.ptc.com/apps/case_logger_viewer/cs/auth/ssl/log  

2 replies

21-Topaz I
May 31, 2022

Hi

I'm not a specialist of JavaScript but your code looks like JavaScript. Can you confirm?

part.SetCurrentViewTransform(pfcTransform3D); throws exception XToolkitBadInputs and it looks to be expected.
in the documentation SetCurrentViewTransform is a method listed for ViewOwner objects and not a model.

Consequently to resolve, you need to use the proper object.

10-Marble
May 31, 2022

Hi Remy, thanks for your reply, I do use the javascript for customization.

 

In the documentation, we can see the pfcModel is the Direct Known Subclasses of pfcViewOwner, which means that pfcModel inherited from pfcViewOwner,

so I think part.SetCurrentViewTransform(pfcTransform3D) should be valid.

 

This point could also be proved by the upper line part.GetCurrentViewTransform(), it really return the valid pfcTransform3D object.

remy21-Topaz IAnswer
21-Topaz I
June 1, 2022

Right then it is a Java Script issue pertaining to the inheritance capability specific to that language.

Given that i'm not an expert with Java Script, i suggests that you file an actual Support case, share all that has been disclosed so far and a proper Java Script engineer will take over.

 

File your case here: https://support.ptc.com/apps/case_logger_viewer/cs/auth/ssl/log  

4-Participant
November 11, 2024

SetCurrentViewTransform does not accept a transform whose origin is not (0, 0 ,0), you should set the origin of the pfcTransform3D to (0, 0, 0) before invoke this method.