Jump to content

Rotating and offsetting text

Recommended Posts

I have a parametric path object.  I'm inserting symbols along the object that are tangent to the path.


I also want to insert a string value at each point also tangent to the path and offset a given distance perpendicular to the tangent.


I can insert the string at the point.  Not having any luck rotating the string or offsetting it.  Can someone point me in the right direction?


Can't figure out what function will rotate the text around its center point and what function will move it a given distance perpendicular to point along a path. 



        BTest := PointAlongPoly(ControlGeometry,(DistanceBetweenPoints * N), PtAlongPath,TangentAtPoint);
        TangentAngle := Vec2Ang(TangentAtPoint);
        Symbol(MySymbol, PtAlongPath.x, PtAlongPath.y, TangentAngle);

        N := N+1;





Share this post

Link to post
Procedure Test;

	CreateText('Does This Work Michatel??
	You should use Vector Math
	To Determine the X and Y displacement
	That you need to move the text block');



  • Laugh 1

Share this post

Link to post

If you already have the Tangent, then getting the perpendicular vector should be easy.  Function Perp will get you the vector perpendicular to the Tangent (You will have to decide you need the positive or negative version).


Vec2Ang will give you the angle. If you know the distance you want to offset the text, the X and Y distances should be just trigonometry.


And I thought you were a Maths Major. 😉




  • Laugh 1

Share this post

Link to post
19 minutes ago, Pat Stanford said:

And I thought you were a Maths Major. 😉


Ha!!  Back in those days it was Math was singular. 🙂.


Share this post

Link to post


   Vectors are our friends.


Perp(V);    { is a 90° CW rotation }

Perp(-V);   { is a 90° CC rotation }


UnitVec(Perp(V)) * aDistance;    { scales the vector to exactly the distance you need }

where "aDistance" is any real number. 


The position of the text is point P on your path (a Vector not a Point) + your offset vector (UnitVec(Perp(V)) * aDistance).



Voffset := UnitVec(Perp(±Vtan)) * Doffset;   { the distance between the path and the text object }

Ptext := Ppath + Voffset;     { the new position of your text object }

where Ptext, Ppath, Vtan, and Voffset are Vectors and Doffset is a Real, and this assumes you already know Vtan, Doffset, and Ppath. 


You can also use SetTextOrientation() to position and rotate your text object.


SetTextOrientation(H, Ptext.x, Ptext.y, Vec2Ang(Voffset), False);


You'll have to play with your angles, but I bet you're only off by a multiple of 90°.





PS - Embrace your Vectors, but not the pointy ends.

  • Like 3

Share this post

Link to post

Thanks Raymond!!!


I've been learning about and this tool currently uses unit vectors and point arrays and tangent arrays.  Which somehow never came up while getting a math degree!!!


Great explanation.  It is much clearer now.


Share this post

Link to post

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.

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.


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.

  • Create New...