Jump to content
Developer Wiki and Function Reference Links ×

How to Mirror a 2D symbol with the SDK as with the mirror tool?


Nebeor

Recommended Posts

I made some progress: But i'm not quite there, i changed the object variables like this:

TVariableBlock value =  TVariableBlock ((Sint16) 3);
gSDK->SetObjectVariable(*rect,  ovSymbolScaleType,value);
TVariableBlock value2 =  TVariableBlock ((Real64) -1.0);
gSDK->SetObjectVariable(*rect,  ovSymbolYScaleFactor,value2);

this does almost what I want, but unfortunately this does not work with the rectangle objects that are in my group.

I suppose this is a bug?
Apparently I need to 'Flip' this object without scale.
I'm looking forward to your reply.

Edited by Nebeor
Link to comment
10 minutes ago, Nebeor said:

apparently using scale on VWTransform is the way to go, It will keep everything 2D as long the z offset equals 0.

 

Using a transform matrix was what I was about to recommend, but I was unsure for a 2D-Symbol, especially in VW 2015. (However, sorry, I had no time to test it, even on a newer VW.)

Link to comment

Scale has nothing to do with mirroring, either with the object variables or the transformation matrix. 

 

A mirror is a flip of the transformation matrix and an offset from the line of reflection (twice the vector from the object to the reflection axis)

 

Using matrix transformations can be a bit tricky: you can get and set an object’s transformation matrix directly, which is its location and rotation in space, as well as transform by a matrix (effectively multiply the object’s matrix by the transformation matrix). The order of applying the transformation also makes a difference

 

VWTransformationMatrix also has a method returning whether a matrix is flipped. 

Link to comment

I think the use of matrices is the only sensible way to transform objects.(sorry Vectorscript and Python)

The good part now is that I can use almost the same transform for my 2D and 3D parts (hybrid objects),

I just have to drop the Z-offfset back to 0 on the transform before applying it to the 2D part.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...