Jump to content

Recommended Posts

Posted

Well, I suppose the quickest way to combine them would be just this:

 

(defun c:pz ()
 (command "_.layer" "m" "test" "c" "4" "" "")
 (command "_.INSERT" "pz" "s" (getvar "dimscale") PAUSE PAUSE)
(test)
)
(defun test (/ txt ent)
 (if
   (and
     (/= "" (setq txt (getstring t "\nSpecify Text...")))
     (setq ent (entmakex
                 (list '(0 . "TEXT")
                       (cons 10 '(0 0 0))
                       (cons 40 1)
                       (cons 7 (getvar "TEXTSTYLE"))
                       (cons 1 txt)
                 )
               )
     )
   )
    (command "_move" ent "" '(0 0 0) pause)
 )
 (princ "\n<!> No Text Specified <!>")
 (princ)
) 			 		

 

But obviously you could just write them as one LISP

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • neekcotrack

    14

  • Lee Mac

    13

  • CAB

    5

  • Se7en

    1

Posted
Well, I suppose the quickest way to combine them would be just this:

 

(defun c:pz ()
 (command "_.layer" "m" "test" "c" "4" "" "")
 (command "_.INSERT" "pz" "s" (getvar "dimscale") PAUSE PAUSE)
(test)
)
(defun test (/ txt ent)
 (if
   (and
     (/= "" (setq txt (getstring t "\nSpecify Text...")))
     (setq ent (entmakex
                 (list '(0 . "TEXT")
                       (cons 10 '(0 0 0))
                       (cons 40 1)
                       (cons 7 (getvar "TEXTSTYLE"))
                       (cons 1 txt)
                 )
               )
     )
   )
    (command "_move" ent "" '(0 0 0) pause)
 )
 (princ "\n<!> No Text Specified <!>")
 (princ)
)                      

 

But obviously you could just write them as one LISP

 

I can't get this to work. After I insert the text loop and then type in what I want it to say it comes up with "No Text Specified"

Posted

Sorry, bracket was wrong :(

 

(defun c:pz  ()
 (command "_.layer" "m" "test" "c" "4" "" "")
 (command "_.INSERT" "pz" "s" (getvar "dimscale") PAUSE PAUSE)
 (test)
 )

(defun test  (/ txt ent)
 (if
   (and
     (/= "" (setq txt (getstring t "\nSpecify Text...")))
     (setq ent    (entmakex
         (list    '(0 . "TEXT")
           (cons 10 '(0 0 0))
           (cons 40 1)
           (cons 7 (getvar "TEXTSTYLE"))
           (cons 1 txt)))))
    (command "_move" ent "" '(0 0 0) pause)
    (princ "\n<!> No Text Specified <!>"))
 (princ))

Posted

It still does the same thing

 

Here is the info in the command line it keeps giving me.

 

Command: pz

_.layer

Current layer: "test"

Enter an option

[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock

/stAte]: m

Enter name for new layer (becomes the current layer) : test Enter an

option

[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock

/stAte]: c

New color [Truecolor/COlorbook] : 4

Enter name list of layer(s) for color 4 (cyan) : Enter an option

[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock

/stAte]:

Command: _.INSERT Enter block name or [?] : pz

Units: Inches Conversion: 0'-1"

Specify insertion point or [basepoint/Scale/X/Y/Z/Rotate]: s Specify scale

factor for XYZ axes : 96.00000000000001 Specify insertion point or

[basepoint/Scale/X/Y/Z/Rotate]:

Specify rotation angle :

Enter attribute values

1i":

Specify Text...1234

No Text Specified

1i":

Verify attribute values

1i":

Posted

Are you trying to place some text halfway through Inserting a Block???

Posted
Are you trying to place some text halfway through Inserting a Block???

 

I am trying to insert the block where I want it and then insert some text and put it where I want it.

Posted

Maybe:

 

(defun c:pz  (/ *error ovar vlst ent txt)
 (defun *error*  (msg)
   (if    ovar
     (mapcar 'setvar vlst ovar))
   (princ (strcat "\nError: " (strcase msg)))
   (princ))
 (setq    vlst '("CMDECHO" "ATTREQ")
   ovar (mapcar getvar vlst))
 (mapcar 'setvar vlst '(0 0))
 (command "_.layer" "m" "test" "c" "4" "" "")
 (command "_.INSERT" "pz" "s" (getvar "dimscale") PAUSE PAUSE)
 (if (and (/= "" (setq txt (getstring t "\nSpecify Text...")))
      (setq ent (entmakex
              (list '(0 . "TEXT")
                (cons 10 '(0 0 0))
                (cons 40 1)
                (cons 7 (getvar "TEXTSTYLE"))
                (cons 1 txt)))))
   (command "_move" ent "" '(0 0 0) pause)
   (princ "\n<!> No Text Specified <!>"))
 (mapcar 'setvar vlst ovar)
 (princ))

Posted
Maybe:

 

(defun c:pz  (/ *error ovar vlst ent txt)
 (defun *error*  (msg)
   (if    ovar
     (mapcar 'setvar vlst ovar))
   (princ (strcat "\nError: " (strcase msg)))
   (princ))
 (setq    vlst '("CMDECHO" "ATTREQ")
   ovar (mapcar getvar vlst))
 (mapcar 'setvar vlst '(0 0))
 (command "_.layer" "m" "test" "c" "4" "" "")
 (command "_.INSERT" "pz" "s" (getvar "dimscale") PAUSE PAUSE)
 (if (and (/= "" (setq txt (getstring t "\nSpecify Text...")))
      (setq ent (entmakex
              (list '(0 . "TEXT")
                (cons 10 '(0 0 0))
                (cons 40 1)
                (cons 7 (getvar "TEXTSTYLE"))
                (cons 1 txt)))))
   (command "_move" ent "" '(0 0 0) pause)
   (princ "\n<!> No Text Specified <!>"))
 (mapcar 'setvar vlst ovar)
 (princ))

 

It comes up with "BAD FUNCTION: #"

Posted

Ahhh, my carelessness - I missed an apostrophe - its so hard to spot these things when you don't test the routines...

 

(defun c:pz  (/ *error ovar vlst ent txt)
 (defun *error*  (msg)
   (if    ovar
     (mapcar 'setvar vlst ovar))
   (princ (strcat "\nError: " (strcase msg)))
   (princ))
 (setq    vlst '("CMDECHO" "ATTREQ")
   ovar (mapcar 'getvar vlst))
 (mapcar 'setvar vlst '(0 0))
 (command "_.layer" "m" "test" "c" "4" "" "")
 (command "_.INSERT" "pz" "s" (getvar "dimscale") PAUSE PAUSE)
 (if (and (/= "" (setq txt (getstring t "\nSpecify Text...")))
      (setq ent (entmakex
              (list '(0 . "TEXT")
                (cons 10 '(0 0 0))
                (cons 40 1)
                (cons 7 (getvar "TEXTSTYLE"))
                (cons 1 txt)))))
   (command "_move" ent "" '(0 0 0) pause)
   (princ "\n<!> No Text Specified <!>"))
 (mapcar 'setvar vlst ovar)
 (princ))

Posted
Ahhh, my carelessness - I missed an apostrophe - its so hard to spot these things when you don't test the routines...

 

(defun c:pz  (/ *error ovar vlst ent txt)
 (defun *error*  (msg)
   (if    ovar
     (mapcar 'setvar vlst ovar))
   (princ (strcat "\nError: " (strcase msg)))
   (princ))
 (setq    vlst '("CMDECHO" "ATTREQ")
   ovar (mapcar 'getvar vlst))
 (mapcar 'setvar vlst '(0 0))
 (command "_.layer" "m" "test" "c" "4" "" "")
 (command "_.INSERT" "pz" "s" (getvar "dimscale") PAUSE PAUSE)
 (if (and (/= "" (setq txt (getstring t "\nSpecify Text...")))
      (setq ent (entmakex
              (list '(0 . "TEXT")
                (cons 10 '(0 0 0))
                (cons 40 1)
                (cons 7 (getvar "TEXTSTYLE"))
                (cons 1 txt)))))
   (command "_move" ent "" '(0 0 0) pause)
   (princ "\n<!> No Text Specified <!>"))
 (mapcar 'setvar vlst ovar)
 (princ))

 

Its acting weird. I am trying to do this:

 

1. type "PZ" to run command

2. Pick insertion point of Text loop

3. Pick point of angle

4. Type desired Text

5. Insert Text

6. End command

 

I hope this makes more sense now.

Posted

what you you mean by, its acting weird, what is it doing wrong exactly?

Posted
what you you mean by, its acting weird, what is it doing wrong exactly?

 

When I insert the text loop it is not there ,then the test comes in at the same angle at the text loop.

Posted

Would you be able to post a sample of the block you are using, so I could see what you are trying to achieve?

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