Jump to content
Developer Wiki and Function Reference Links Read more... ×
Nebeor

gSDK->GetViewMatrix

Recommended Posts

I'm trying to transform a 3Dpoint in my drawing to a point in the screen, intuitively I would multiply with a (VW)TransformMatrix that should be easy to retrieve.

I tried this:

VWTransformMatrix viewMatrix;
gSDK->GetViewMatrix(gSDK->GetActiveLayer(),viewMatrix); 

This line returns a empty (identity) matrix, even when i'm not in top view.

I'm using an isometric perspective.

What could I be doing wrong?

Share this post


Link to post

Try to use TransformMatrix directly for the call as specified by http://developer.vectorworks.net/index.php/VCOM:VectorWorks:ISDK::GetViewMatrix

 

Something like:

TransformMatrix rawViewMatrix;
gSDK->GetViewMatrix(gSDK->GetActiveLayer(),rawViewMatrix); 

// If needed, you can still make something like this afterwards:
VWTransformMatrix viewMAtrix = rawViewMatrix;

 

 

Edited by Nicolas Goutte
  • Like 1

Share this post


Link to post

Thank you,

This works, but i would  like to understand he story behind TransformMatrix and VWTransformMatrix.

What's compatible and what is not?

Edited by Nebeor

Share this post


Link to post

When you take the reference of VWTransformMatrix, you get the reference of a TransformMatrix that is inside VWTransformMatrix (to be exact: VWTransformMatrix::fMatrix). This matrix does get the correct value by the call gSDK->GetViewMatrix but this good matrix  is never transferred to the main matrix data of VWTransformMatrix (to be exact: VWTransformMatrix::m). That is why you still get the identity matrix.

 

So you have to explicitly set a TransformMatrix to the VWTransformMatrix to have what you want.

 

This behavior was changed already in VWSDK 2016. From 2016 on, there is no "double bookkeeping" any more in the class.

Edited by Nicolas Goutte

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×