Skip to main content
16-Pearl
July 15, 2025
Question

CREO JS API pfcViewOwner.GetCurrentViewTransform() and pfcViewOwner.SetCurrentViewTransform()

  • July 15, 2025
  • 3 replies
  • 1111 views

Hello, I'm having troubles using this two funcitons. 

Effect I'm expecting using this two functions one after each other. I see the same thing without changes by getting actual transformation and applying it to the model. 

Now let's see what's actually happens

 

let model = pfcGetCurrentSession().GetCurrentModel()
let transform = model.GetCurrentViewTransform()
model.SetCurrentViewTransform(transform)

This code retrieves transformation from opened model and i expect this transformation to be correct because I do actually see it in model and there is no errors in it. But:
 

Uncaught Error: pfcExceptions::XToolkitBadInputs in ProViewMatrixSet at <anonymous>:3:7


Is there any extra step needed to repair transformation gained directly from model?


3 replies

18-Opal
July 15, 2025

Normalize?

16-Pearl
July 16, 2025
const session = pfcGetCurrentSession();
const model = session.GetCurrentModel(); // fine – keeps the model handy

const view = model.GetView("Narys"); // saved view to copy
const transform = view.Transform; // keep the FULL transform object
//transform.Invert()
const matrix = transform.Matrix;
printMatrix(matrix);
const normmatrix = normaliseMatrix(matrix);
printMatrix(normmatrix);

model.SetCurrentViewTransform(normmatrix)



here is last example which i've tried 

18-Opal
July 22, 2025

You wrote 

don't forget creo uses 2 types of transformation which defines final position of a model on monitor

 

You have an unique view of the model, in an assembly each assembled component has a transformation matrix (this is independent from the view), in part mode you may define your model by your own initial transformation, for example you start your first solid feature without any datum, or you setup a default csys and next 3 datum’s, or you start with 3 datum’s and orient the csys by any possible direction (I think these are “9”, but I need to think about 😉),  and so on. You can even start by creating your 3 base datum’s by a transformed csys. You have quite a lot of options, but at the end you specify one named view matrix. And this matrix, as far I know will use the initial world csys (first feature without datum’s). If you measure from a different matrix you have to multiply this.

 

Please evaluate your matrix values by using the default csys.

Here the simplest way is to create first a csys, and next 3 datum’s through it😎


What is „Front“ ? How you name it, this depends on you, this is not important, but the names may miss lead you😉

 

All here my 2 Cents 😵

 

And yes, at the end you view at your 2D screen with a height and a width, your ViewPort. 

 

 

 

Community Manager
July 23, 2025

Hello @ilyachaban,

 

You have some responses from a community member. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

16-Pearl
August 2, 2025

This issue has been recreated by PTC Support and now it has SPR ticket