Inserting text with Macro in command

Inserting text with Macro in command

johnc11
Participant Participant
1,915 Views
4 Replies
Message 1 of 5

Inserting text with Macro in command

johnc11
Participant
Participant

Hi, 

 

I am transition across from Briscad and found one of the commands I used previously no longer works. 

 

I have a series of buttons on the toolbar that will insert text onto a set layer at a set size. The macro attached to one command is 

^C^C(setvar "TEXTSIZE" (* 2.2 scl));(setvar "textstyle" "ARIAL");-layer;n;"TXT_22";-layer;m;"TXT_22" "" text

 

Basically I want the text to be on layer TXT_22 at a size of 2.2 and style ARIAL. 

 

I am getting an "Invalid option keyword" error. Can someone shed some light on what is not working here. 

 

Many thanks 

 

0 Likes
Accepted solutions (2)
1,916 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

It's probably that you don't conclude the first Layer command [it needs another ; to end it] before starting the next one.  It is still at the main Layer prompt when you feed in the second -layer, which is not a valid option at that point.  And the "" to do that is Enter in AutoLisp format, not in command-macro format.  But you don't need both the New and Make options with the same Layer name -- the Make option creates it if it doesn't exist yet, and sets it current in the process.  And in this context you don't need the quotation marks around the Layer name.  This should do:

 

^C^C(setvar "TEXTSIZE" (* 2.2 scl));(setvar "textstyle" "ARIAL");-layer;m;TXT_22;;text

 

 

Kent Cooper, AIA
Message 3 of 5

johnc11
Participant
Participant

Thanks Kent, 

 

Works a treat, greatly appreciated. 

0 Likes
Message 4 of 5

johnc11
Participant
Participant

Thanks for the help so far. 

 

How would I go about adding a variable to set the obliquing to 15 degrees.

 

Or would I be best to create a new text style with the obliquing but in. 

0 Likes
Message 5 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

@johnc11 wrote:

....

How would I go about adding a variable to set the obliquing to 15 degrees.

Or would I be best to create a new text style with the obliquing but in. 


That is certainly the simplest.  There doesn't seem to be any way to set obliquing within the Text command itself, so it would need to be applied after the fact.  But it's not just a Property you can give it in something like a CHPROP command, as you can for color, etc.  You could include:
(setpropertyvalue (entlast) "oblique" 0.26)

which works in a macro, but I'm not sure about giving room for you to conclude the Text command first.  [I haven't tried the AutoLisp for waiting for User input until the command finishes, in a macro.]  And if you made more than one Text object in that same command, only the last would get the angle.

Kent Cooper, AIA