Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
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);
}
Solved! Go to Solution.
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
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.
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.
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
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());"
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.