Jump to content

Recommended Posts

Posted

am having trouble writing a macro for the alignment of text to an existing line orientation, has anyone already done this by any chance?

Posted
am having trouble writing a macro for the alignment of text to an existing line orientation, has anyone already done this by any chance?

 

Can you post whatever you have written?

There are guys they cannot resist to help you, but any initial effort's appreciated.

Posted

Your profile states that you are using LT; therefore I have to presume that you are talking about a macro for a toolbar button. I’m really not sure if you can achieve that – it is supposed to require a kind of calculation of the base line orientation, which I really don’t see how can be done in button’s macro without AutoLISP support.

Posted (edited)

What is wrong with ALIGN command?

Edited by Blackfish
Posted

If you don't mind an interactive solution, then may check if this is useful to you.

Posted
If you don't mind an interactive solution, then may check if this is useful to you.

 

That's interesting, but now you have standard ALIGN command in AutoCAD 2012LT or newer.

However with single-line text when justified to left there is no second characteristic point you can select to align to the line...

Posted

Not sure if this works in LT UCS OB pick line do text UCS W make sure ortho is on. this will allow text at 0 90 etc to line. You can add a button or menu or macro to do UCS OB

Posted
Not sure if this works in LT UCS OB pick line do text UCS W make sure ortho is on. this will allow text at 0 90 etc to line. You can add a button or menu or macro to do UCS OB

That's fine if the current ucs is W. I think it should return to the previous one, UCS P would be a better choise.

Posted (edited)
Not sure if this works in LT UCS OB pick line do text UCS W make sure ortho is on. this will allow text at 0 90 etc to line. You can add a button or menu or macro to do UCS OB

 

BIGAL, thank you for the great idea: UCS OB! I didn't know how to get an angle from single-line text, because there is only one insertion point, and with Diesel and macro you are very limited, but as always we should try...

 

I did it the other way, because I don't understand what do you mean by 'do text UCS W'. Would be nice to just select line instead of picking two points, but I have no idea how to improve the below code.

 

 

That's fine if the current ucs is W. I think it should return to the previous one, UCS P would be a better choise.

 

So, I did.

 

 

^C^C_ucs;n;ob;\^C^C_move;@;;0,0;\^C^C_rotate;p;;@;\^C^C_ucs;p;

 

Maybe something could be better but as a start I'm quite happy :D

 

 

PS. Almost as usually no OP's cooperation :(

Edited by Blackfish
better revised code
Posted

I thought you were trying to add text but to an existing line for orientation rather than alter existing.

 

Any way the Ucs W, User Co-ordinate System WORLD, mosts times when you start a dwg you are in the "world" setting, if you crash your macro you may need UCS W but UCS P "previous" is a good way to go if your playing with different ucs's. Also another quickie for lots of text "UCS Ob plan" pick all text use "modify" set angle to 0 then "UCS P plan" bit quicker maybe than typing 47d23'35" after you have found out the correct angle.

Posted (edited)

sorry, am not always in the office, been out in the field.

I did come up with this but am having trouble trying to align the single line text to a specific orientation of a line, i am not sure where i am going wrong and if i understand this programming at all really, all well, i will keep persisting. here is what i have so far

^C^C_select;\_move;_p;;\\_rotate;_p;;@0,0;_ref;@;\\

Edited by SLW210
Added code tags.
Posted
BIGAL, thank you for the great idea: UCS OB! I didn't know how to get an angle from single-line text, because there is only one insertion point, and with Diesel and macro you are very limited, but as always we should try...

 

^C^C_ucs;n;ob;\^C^C_move;@;;0,0;\^C^C_rotate;p;;@;\^C^C_ucs;p;

 

Try the above code, where I use UCS;OB command. Thank you again BIGAL :)

Posted

whilst this works, i am hoping to achieve a macro that means that i select the text and then select a line, and it orientates itself to that line, whereby i can then add a section where i can rotate it 180 from its orientation or I can leave it at its current orientation.

Posted

All the best and good luck!

And post what you achieved one day :thumbsup:

Posted
whilst this works, i am hoping to achieve a macro that means that i select the text and then select a line, and it orientates itself to that line, whereby i can then add a section where i can rotate it 180 from its orientation or I can leave it at its current orientation.

 

I've just read your coment again and noyiced that my script does exactly what you want in three mouse clicks:

  1. select a text
  2. select a line
  3. select a rotation of the text

and you don't need any additional option to rotate the text 180 degrees or not; it's done in the third click :shock:

 

 

PS.

It looks like you could have one click less, but you actually need to it to decide about leaving the text or rotating 180 degrees. It's exactly what you need :D

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...