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

0 Members and 1 Guest are viewing this topic.

Robb

  • Guest
Create text lisp?
« on: April 14, 2005, 10:23:44 PM »
Looking for a lisp that will set the style, layer color, and possibly prompt me a scale for text height. Example if I were drawing at 48 scale it will allow me to enter a scale value of 48 for the new text. or something similar.

Thanks.

CADaver

  • Guest
Create text lisp?
« Reply #1 on: April 14, 2005, 10:37:14 PM »
Before someone jumps in with the completed code....

This sounds like an opportunity to learn how to do it for yourself.  Build the "psuedo-code"  That's sort of a road map on what happens and when, it's just a list of steps.  When you've done that, post it here and you'll get a load of help from several real gurus in fleshing it out.

HINT: Find out all the command options and sequences for the -STYLE and -LAYER commands.

Robb

  • Guest
Create text lisp?
« Reply #2 on: April 15, 2005, 06:04:15 PM »
Cadaver, I tried to do it in a lisp but decided to use a pulldown menu.

I added all the commands that I needed to run but I keep getting an error.

What I want is the layer to be set to a TEXT layer with color "4", simplex, .8 width, 1/8 height and end with in the mtext commant to continue typing.

After loading the menu and trying to run one of these commands from the pull down I get an error that the Font is not available. Dont know if that makes sense.

Thanks.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Create text lisp?
« Reply #3 on: April 15, 2005, 06:08:34 PM »
Can you post the code you are using in the menu.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

danny

  • Guest
Create text lisp?
« Reply #4 on: April 15, 2005, 08:07:38 PM »
Robb,
good to see you around again....
try this
Code: [Select]
(defun c:mtxt()
(command "-layer" "n" "YourLayerName" "s" "YourLayerName" "c" "4" "" "")
(COMMAND "-linetype" "s" "BYLAYER" "")(princ)
(command "-style" "YourStyleName" "simplex" ".125" ".8" "" "" "" "")
(COMMAND "_mtext")(princ)
)

CADaver

  • Guest
Create text lisp?
« Reply #5 on: April 16, 2005, 02:19:14 PM »
Danny, ignore Robb's "give you the whole fish"  :P  :roll: and post what you've been working on so far.  An error usually means you've (I've) skipped a prompt in the command sequence along the way.

BTW, the command sequence for a menu pull-down is not all "that" different from lisp.  If you can get your hands around one, you can the other as well.

daron

  • Guest
Create text lisp?
« Reply #6 on: April 18, 2005, 08:29:48 AM »
Cadaver, don't you mean Robb, ignore Danny's...

Plus, if it were me, I'd ignore Danny's code too.

CADaver

  • Guest
Create text lisp?
« Reply #7 on: April 18, 2005, 09:26:53 AM »
Quote from: Daron
Cadaver, don't you mean Robb, ignore Danny's...
oops, typing faster than I can think...  hmmm...  considering I'm using one finger on each hand and taking a wild swipe at the keyboard, that doesn't say much about my thinkin' speed.

...

anyway...

Danny's code gives you BIG hints <grin> on how to do it using (command functions in lisp.  Though there are some here that would frown on the use of (command functions, I'm not one of the them.  I look at it as crawlin' before you walk.  (The walkin' part would be using (entmake function to build the layers and styles without using "command")

Another thought is Danny's code doesn't first check to to see if the style/layer already exists.  Sometimes this may not be necessary, if you want this layer/style to look a certain way no matter what.  Just understand that it will effect elements already plced in the drawing.

ELOQUINTET

  • Guest
Create text lisp?
« Reply #8 on: April 18, 2005, 09:27:24 AM »
maybe you could create a button. someone could help you on setting the text height, don't have time right now.

(setq var (getvar "clayer"));(command "-layer" "n" "text" "c" "WHITE" "text" ) ;setvar clayer "text";mtext;\;_LayerP

daron

  • Guest
Create text lisp?
« Reply #9 on: April 18, 2005, 09:41:21 AM »
Has anybody noticed that Randy was trying to help Robb at least begin this project himself? It is a very simple thing to give him what he has asked for.  Randy didn't want to just give it to him, but probably could have. As far as using command goes, I am not totally against its use. I use it in many applications, but on a limited use and for different reasons. Now, as it is a good way to learn to crawl, let's not let it be a crutch. Randy's last comment shows where command has become a crutch. On a daily basis I have to work with crutch style programming. It sucks. The programs I have to use are riddled with command and user un-friendly (lacking error traps) code.

Dan, why not use "-layer" "m" instead of "n"? You wouldn't have to use setvar if you did and by using "m" instead of "n', if the layer exists it is merely set.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Create text lisp?
« Reply #10 on: April 18, 2005, 10:35:07 AM »
I noticed and was hanging back waiting for the psuedo code to show up.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CADaver

  • Guest
Create text lisp?
« Reply #11 on: April 18, 2005, 10:45:59 AM »
Quote from: MP
I noticed and was hanging back waiting for the psuedo code to show up.
We may have lost Robb on this one, we may have to assume the psuedo-code ourselves after a while.

I think this is an important little routine, something everyone should understand, and a major step in standardization.  If you can control the layer and style of text, without the user even knowing about it, you've gone a long way in making compliance with the standard easy.

It may seem basic to some, but I think this is a primary building block in the foundation of standardization.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Create text lisp?
« Reply #12 on: April 18, 2005, 10:55:10 AM »
<nodding.mpg>
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Create text lisp?
« Reply #13 on: April 18, 2005, 12:51:38 PM »
Quote from: CADaver
It may seem basic to some, but I think this is a primary building block in the foundation of standardization.


I think this one of the keys to acceptance in standardization.  If the users are "using" the standard without kowing it, or using it and enjoying your code setting things for them, they tend to accept other "standards" more readily because you will "help" them comply.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

CADaver

  • Guest
Create text lisp?
« Reply #14 on: April 18, 2005, 01:52:51 PM »
Quote from: CmdrDuh
Quote from: CADaver
It may seem basic to some, but I think this is a primary building block in the foundation of standardization.


I think this one of the keys to acceptance in standardization.  If the users are "using" the standard without kowing it, or using it and enjoying your code setting things for them, they tend to accept other "standards" more readily because you will "help" them comply.
Exactly, and text layers and styles are the perfect place to start.  That's why I'm hoping Robb steps up for this one.