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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

pfcViewOwner.SetCurrentViewTransform(pfcTransform3D) API cause an pfcXToolkitBadInputs exception

Andy.Hsieh
7-Bedrock

pfcViewOwner.SetCurrentViewTransform(pfcTransform3D) API cause an pfcXToolkitBadInputs exception

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);
}

1 ACCEPTED SOLUTION

Accepted Solutions
remy
21-Topaz I
(To:Andy.Hsieh)

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  

View solution in original post

4 REPLIES 4
remy
21-Topaz I
(To:Andy.Hsieh)

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.

Andy.Hsieh
7-Bedrock
(To:remy)

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.

remy
21-Topaz I
(To:Andy.Hsieh)

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  

Andy.Hsieh
7-Bedrock
(To:remy)

Finally, I open a case and got the reply as follow.

 

"It is incorrect to input the exact matrix got by GetCurrentViewTransform() into SetCurrentViewTransform(), because it changes nothing. 
If changing the matrix, SetCurrentViewTransform() will not return error. Please try the below code.
" part.SetCurrentViewTransform(pfcTransform3D.Invert());"

Top Tags