Author Topic: Create text lisp?  (Read 10819 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
Create text lisp?
« Reply #15 on: April 18, 2005, 02:52:38 PM »
Did you try PMing him?

CADaver

  • Guest
Create text lisp?
« Reply #16 on: April 18, 2005, 03:07:28 PM »
Quote from: Daron
Did you try PMing him?
Not yet, I was sorta hoping he'd surface on his own.  He may have "work" getting in the way so I was gonna wait til tomorrow.

hyposmurf

  • Guest
Create text lisp?
« Reply #17 on: April 18, 2005, 03:15:27 PM »
I tried doing a similar thing before,but ran into a brick wall.Tried to have the MTEXT command set the layer to my specific text layer and create that layer if it wasnt present.Had to be done by LISP,I tried via macros and resetting my aliases but just didnt work. Here's the thread.

Robb

  • Guest
still here... sorry
« Reply #18 on: April 22, 2005, 05:07:59 AM »
Sorry i've been busy moving... should be done by this weekend. Anyway I think i've figure it out... I didnt have time so I was hoping someone would help me out. I wrote a lisp  to do this a while back but cant seem to find it.

I will give it another shot later and will repost.

Thanks!

CADaver

  • Guest
Create text lisp?
« Reply #19 on: April 22, 2005, 11:51:21 AM »
Here's a sketch of how I've setup our layer/style control.

I have a text style/layer routine (txstla) (long before reactors but looking at that soon) that:

1.)  Reads Current space If it's MS
-- It reads the current DIMSCALE
If the current space is PS
-- It reads the current DIMLFAC

2.)  It then puts together a style/layer name "TEXT" plus the DIMSCALE/DIMLFAC = TEXT48

3.)  It then checks to see if that layer exists, if it does it sets it current, if not it makes it based on a layermake function I have.

4.)  Then it checks is that style exists (TEXT48, we use text height set in the style) if it does it sets it current, if not it creates it based on a sylemake function I have.

Okay, so now I've made or set the right style and layer current in this function.  Notice I didn't collect the current style and layer data for return later.  Basically, I don't care, if the user is in annotation mode, he'll be there a while.

I have another that does nearly the same for DIM style and layers using "DIM" as the prefix.

Now if I had a reactor setup to run these whenever the command was issued it'd be real cool, but I haven't taken the time for that yet.  But what I have done is prefix every possible way a user can inout text with the function (txstla).  All the shorthand functions and autolablers we have, all the menu locations and buttons, yada yada yada, then undefined the MTEXT and TEXT and DTEXT functions entirely and setup MT, TX and DT in thier place.  Someone has to know how to get around it it to screw it up.  One of the things we stress NOT to do in our training sessions.

Now for client specific layer/style names all I need do is modify the (txstla) function and everything is rosy.

hyposmurf

  • Guest
Create text lisp?
« Reply #20 on: May 01, 2005, 05:31:02 PM »
Heres the thread I was refering to before,the one above references this thread. :roll: similar thread topic
Is it possible to have a lisp call a macro and execute it?I have the macro I need to make sure my MTEXT and QLEADER are always on the correct layer.I was previously trying to redefine both those commands in the pgp file using my own macro,but that aint possible.Want to call the commands from the command line,rather than using a menu button.

hyposmurf

  • Guest
Create text lisp?
« Reply #21 on: May 01, 2005, 06:20:06 PM »
OK I've managed to put some lame lisp together and it seems to work.Here it is:

Code: [Select]
(defun C:MTE()
  (command "LAYER" "s" "SML_TEXT" "" "MTEXT")
)


I'd like to have my layer "SML_TEXT" created if it isnt present,but this will do at the moment as I have the layer incorporated in my template file.What is weird though is that when I run my lisp it sets the layer to SML_TEXT and then executes the MTEXT command,but just leaves me to input my text at the command line,no MTEXT eidtor. :( If I then hit enter it exits the MTEXT command.

ronjonp

  • Needs a day job
  • Posts: 7529
Create text lisp?
« Reply #22 on: May 02, 2005, 09:52:18 AM »
Use the make option to ensure the layer is always created. As far as inputting to the command line don't know how to fix that one.

(defun C:MTE()
  (command "LAYER" "m" "SML_TEXT" "" "_.MTEXT")
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

hyposmurf

  • Guest
Create text lisp?
« Reply #23 on: May 12, 2005, 03:39:19 PM »
The problem I have is it will not open the MTEXT editor when I run the lisp,just run MTEXT from the command line. :shock: How do I get round thos one?I am almost there with this lisp,but cant figure out where to go next. :cry:

daron

  • Guest
Create text lisp?
« Reply #24 on: May 12, 2005, 04:12:27 PM »
Lisp doesn't natively handle dialog. You have to call the dialog information or create your own and call to it. Without, you're left on the command line.

hyposmurf

  • Guest
Create text lisp?
« Reply #25 on: May 12, 2005, 04:40:29 PM »
Bummer Ive gone from a macro to lisp and now....?Would I need VB to bring up the MTEXT dialogue box then?I feel Im doomed then until Ive learnt how that all works :(

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Create text lisp?
« Reply #26 on: May 12, 2005, 04:43:22 PM »
Give this a try.
Code: [Select]
(defun C:MTE ()
  (command "LAYER" "m" "SML_TEXT" "")
  (initdia)
  (command "_.MTEXT")
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

daron

  • Guest
Create text lisp?
« Reply #27 on: May 12, 2005, 04:48:36 PM »
Yeah that'll work, but you won't get back into the program if there's anything left for it to do, or am I wrong again?

hyposmurf

  • Guest
Create text lisp?
« Reply #28 on: May 12, 2005, 05:03:05 PM »
Beauty!Cheers CAB :dood: Not sure if that problem will occur maybe CAB will know.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Create text lisp?
« Reply #29 on: May 12, 2005, 05:13:19 PM »
Daron, you are correct.
In that MTE lisp it activates the Mtext command and is done, never to return.
If you want to activate the Mtext command and stay in a lisp you will have to jump through some hoops.
See this post.
http://www.theswamp.org/phpBB2/viewtopic.php?p=62268#62268
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.