Jump to content
JBenghiat

Screen move to model move?

Recommended Posts

Does anyone know of a function or have a process of transforming a screen move to a 3D coordinate when not in a top view?

 

For catching moves in Update Support, I handle x and y moves differently than z moves.  So, for example, if looking at a front view, I want a y screen move to translate to a z object move.  The matrix reported in theData->fTransformOffset follows the screen coordinates.

 

I can easily catch the case I want:

if (!theData->fbIs3DMove && gSDK->GetProjection(gSDK->GetActiveLayer()) != projectionPlan )

 

But I can't seem to find an easy way to transform the screen offset to the model offset.

Share this post


Link to post

You have probably already looked at this but in VS, there are functions to change coordinates:

 

ScreenVecToModelVec

ScreenPtToModelPt2D

ScreenPlanePtToPlanarPt

PlanarPtTo3DModelPt

 

Plus some others. I played with them MANY years ago, but don't really remember if I solved your problem or not.

 

HTH

Share this post


Link to post

The SDK has equivalent functions. ScreenVecToModelVec looked promising, but it only works for two dimensional points, which limits its use to translating rotated plan. 

 

PlanarPtTo3DModelPt might work, but there would need to be a way to find the ID of the screen-aligned plane. 

Share this post


Link to post

OK, got it.  I can get the working plane and convert the working plane point to a model pt.

 

TransformMatrix matMove = theData->fTransformOffset;
WorldPt3 moveOffset = matMove.P();
bool isPlanarMove = false;
// Check if 2D move in 3D view
// If so, transform move vector so it acts with respect of the object
if (!theData->fbIs3DMove && gSDK->GetProjection(gSDK->GetActiveLayer()) != projectionPlan ) {
	TPlanarRefID wpRef = gSDK->GetWorkingPlanePlanarRefID();
	gSDK->PlanarPtTo3DModelPt(wpRef, WorldPt(matMove.P().x,matMove.P().y), moveOffset);
	isPlanarMove = true;
}

 

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.

×