Jump to content

Rotate automatically an object to a line


castagnaccio

Recommended Posts

Hello,

 

I'm wondering if there is a method to snap a text object to order to place it automatically parallel (therefore rotate) to the line on the left. please see attachment

 

prob3.jpg

 

Thank you in advance

Link to comment
Share on other sites

Hmmm.......guess I should have tested it myself first. I think I might have mislead you. Sorry. I'll see what I can do to correct that mistake.

 

One option (not the best in my opinion but it is a start) can be found here. http://www.cad-notes.com/text-alignment-technique/

 

I'll keep looking.

 

Second option. Click on the link that follows. At the next webpage read about the free shared lisp program as described by linhoreka. Click on the word DOWNLOAD. Note that the lisp routine actually contains to programs. The one you want to test is invoked by typing ALT at the command line. Let me know what you think.

 

http://www.cadeverything.com/help/showthread.php/7920-Free-shared-lisp-align-any-annotationTexts-on-lines-arcs-and-polylines

Link to comment
Share on other sites

If you have Polar Tracking on and it is set to Relative to last segment, then when you Rotate the text and snap (with Osnap Endpoint, Near, of Midpoint) to the line when specifying base point, the text will align itself to the line and also the Ortho points to the line when you drag it around. You may have to move the text slightly at the end.

 

This is a built-in property so no lisp is needed.

Link to comment
Share on other sites

Third option, the one I would recommend, and it works on MText or DText to any Curve Object (Arc/Line/Polyline/Spline/Circle/Ellipse etc...). And guess what? It too was written by Lee Mac. I just didn't see it apparently. Find it here...

 

http://www.lee-mac.com/dtcurve.html

 

Read about the five options available too. I think you'll like this one.

Link to comment
Share on other sites

If you pick the rotation base point on the line itself, instead of at the insertion point of the text, then with Polar tracking, the angle of the line is picked up without any further snapping - one less Osnap to use.

Link to comment
Share on other sites

ReMark: thank you for your replay.

That lisp doesn't work, the text does not get aligned. I think that the problem is that the orientation of the starting mtext is not 0 degree!

 

eldon: thank you for your replay.

The problem is that I don't draw the line before placing the mtext..

 

nestly: thank you for your replay.

Your solution does work but only when the starting mtext is at 0 or 180 degree (perpendicular) or 90 or 270 degree (parallel).

 

 

 

 

The starting orientation of the mtext is not 0 or 90 or 180 or 270 degree but random. Other ideas?

Link to comment
Share on other sites

From the wording of your first post, one would assume that the line was there first.

 

I find it easier to write the text first and then rotate it to align with an existing line.

 

You could always set up a UCS parallel to the line, and then any text would align with the line.

Link to comment
Share on other sites

yes, the line is there first but I drew the lines all together and then I started to place all the text objects.

The text objects were oriented not 0, 90, 180 or 270 deg. because I just copied a text object that was already aligned to a line.

"I find it easier to write the text first and then rotate it to align with an existing line." Yes again, next time I will do the same :) .

 

 

I solved this issue by selecting all the text objects at the same time and then setting the orientation to 0 degrees. After that I used the method suggested by nestly. I'm wondering if there is a method on how to point snap on a line that is parallel to the object it self, in this way I wouldn't need to rotate all to objects to 0 deg.

Link to comment
Share on other sites

You're welcome...

 

thank you, but I have only autocad 2010..

 

He's talking AutoCAD 12 for DOS from the 80's :ouch: (not AutoCAD 2012) :)

Edited by Spaj
Link to comment
Share on other sites

ReMark: thank you for your replay.

That lisp doesn't work, the text does not get aligned. I think that the problem is that the orientation of the starting mtext is not 0 degree!

Which routine are you referring to?

 

The lisp routine I mention in post #6 works with MText as I just tested it. In my test drawing I had four lines of MText that were created with a rotation angle of 15 degrees and a single line that was drawn at an angle of 52.5 degrees.

Link to comment
Share on other sites

AlignedText.jpg

Aligned text test. Pay attention to the options Lee has so kindly provided as one of them is required to achieve the final result.

 

Reference: Link to lisp routine in post #6.

Link to comment
Share on other sites

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...