Author Topic: annotation text lisp  (Read 6641 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
annotation text lisp
« on: November 15, 2015, 03:27:12 AM »
Hi I am using Lee Mac code for text .I want to update this code to work with annotation text. The only commands i know to do this is

Code - Auto/Visual Lisp: [Select]
  1. (COMMAND "_layer" "_m" "_KEIM" "_c" "7" "" "")
  2. (command "_.-style" "_KEIM" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")
  3.  

Can any one help me to update the code

Code - Auto/Visual Lisp: [Select]
  1. (defun c:txt (/ *error* varlist oldvars pt1 tval)
  2.     (defun *error* (msg)
  3.     (mapcar 'setvar varlist oldvars)
  4.     (if (= msg "")
  5.         (princ "\nText Inserted.")
  6.         (princ "\nEsc or Error Pressed...")
  7.     ) ;_  end if
  8.     (princ)
  9.     ) ;_  end defun
  10.     (setq varlist (list "CMDECHO" "CLAYER")
  11.       oldvars (mapcar 'getvar varlist)
  12.     ) ;_  end setq
  13.     (while (and    (/= (setq pt1 (getpoint "\nSelect Insertion Point: ")) nil)
  14.         (/= (setq tval (getstring t "\nSpecify Text: ")) "")
  15.        ) ;_  end and
  16.     (if (not (tblsearch "Layer" "TEXT"))
  17.         (command "-layer" "m" "TEXT" "")
  18.     ) ;_  end if
  19.     (entmake (list '(0 . "TEXT")
  20.                '(8 . "_KEIM")
  21.                (cons 10 pt1)
  22.                (cons 40 (getvar "TEXTSIZE"))
  23.                (cons 1 tval)
  24.                '(50 . 0.0)
  25.                '(7 . "_KEIM")
  26.                '(71 . 0)
  27.                '(72 . 0)
  28.                '(73 . 0)
  29.          ) ;_  end list
  30.     ) ;_  end entmake
  31.     ) ;_  end while
  32.     (*error* "")
  33.     (princ)
  34. ) ;_  end defun
  35.  

Thanks
« Last Edit: November 15, 2015, 10:13:19 AM by Topographer »

pedroantonio

  • Guest
Re: annotation text lisp
« Reply #1 on: November 15, 2015, 10:13:03 AM »
No one ?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: annotation text lisp
« Reply #2 on: November 15, 2015, 01:08:26 PM »
Hey, it's the weekend. We're all watching football & drinking beer.
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.

pedroantonio

  • Guest
Re: annotation text lisp
« Reply #3 on: November 15, 2015, 01:18:36 PM »
Ok CAB  :-D

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: annotation text lisp
« Reply #4 on: November 15, 2015, 02:27:16 PM »
It is much easier with visual lisp:
Code - Auto/Visual Lisp: [Select]
  1.   (setvar 'textstyle "_KEIM")
  2.     <current space>;; ModelSpace or PaperSpace
  3.     <text>;;; your text
  4.     (vlax-3d-point <point>) ;;; insertion point
  5.     (/
  6.       (cdr (assoc 40 (tblsearch "style" "_KEIM")))
  7.       (getvar 'cannoscalevalue)
  8.     )
  9.   )

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: annotation text lisp
« Reply #5 on: November 15, 2015, 03:27:28 PM »
This topic (also started by the OP) is quite similar:
http://www.theswamp.org/index.php?topic=50075.0
« Last Edit: November 15, 2015, 03:32:48 PM by roy_043 »

pedroantonio

  • Guest
Re: annotation text lisp
« Reply #6 on: November 16, 2015, 05:12:22 AM »
any other option ?

ChrisCarlson

  • Guest
Re: annotation text lisp
« Reply #7 on: November 16, 2015, 08:02:58 AM »
Are you just trying to make annotative text?

pedroantonio

  • Guest
Re: annotation text lisp
« Reply #8 on: November 16, 2015, 09:27:24 AM »
Hi  ChrisCarlson
I am using the lisp in post 1 to write text in specific layer and text style. I want now to use the same lisp or same like this lisp to write an annotation text in specific text style and layer

Code - Auto/Visual Lisp: [Select]
  1. (COMMAND "_layer" "_m" "_KEIM" "_c" "7" "" "")
  2. (command "_.-style" "_KEIM" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")
  3.  

Thanks

ChrisCarlson

  • Guest
Re: annotation text lisp
« Reply #9 on: November 16, 2015, 09:41:11 AM »
Hi  ChrisCarlson
I am using the lisp in post 1 to write text in specific layer and text style. I want now to use the same lisp or same like this lisp to write an annotation text in specific text style and layer

Code - Auto/Visual Lisp: [Select]
  1. (COMMAND "_layer" "_m" "_KEIM" "_c" "7" "" "")
  2. (command "_.-style" "_KEIM" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")
  3.  

Thanks

This doesn't create text, that just simply creates a layer and text style. Just shooting off the hip..

Code - Auto/Visual Lisp: [Select]
  1.         (list
  2.                 (cons 0 "TEXT")
  3.                 (cons 8 "_KEIM") ; layer name
  4.                 (list 10 0.0 0.0 0.0) ; insertion point
  5.                 (cons 1 textstring) ; text string to pass
  6.                 (cons 50 0)
  7.                 (cons 7 "_KEIM") ; text style
  8.         )
  9. )
  10.  



pedroantonio

  • Guest
Re: annotation text lisp
« Reply #10 on: November 16, 2015, 09:46:22 AM »
I try this but is not working

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test (/ *error* varlist oldvars pt1 tval)
  2.     (COMMAND "_layer" "_m" "_KEIM" "_c" "7" "" "")
  3. (command "_.-style" "_KEIM" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")
  4.      (defun *error* (msg)
  5.     (mapcar 'setvar varlist oldvars)
  6.     (if (= msg "")
  7.         (princ "\nText Inserted.")
  8.         (princ "\nEsc or Error Pressed...")
  9.     ) ;_  end if
  10.     (princ)
  11.     ) ;_  end defun
  12.     (setq varlist (list "CMDECHO" "CLAYER")
  13.       oldvars (mapcar 'getvar varlist)
  14.     ) ;_  end setq
  15.     (while (and    (/= (setq pt1 (getpoint "\nSelect Insertion Point: ")) nil)
  16.         (/= (setq tval (getstring t "\nSpecify Text: ")) "")
  17.        ) ;_  end and
  18.     (if (not (tblsearch "Layer" "_KEIM"))
  19.         (command "-layer" "m" "_KEIM" "")
  20.     ) ;_  end if
  21.     ) ;_  end while
  22.     (*error* "")
  23.     (princ)
  24. ) ;_  end defun
  25.  

ChrisCarlson

  • Guest
Re: annotation text lisp
« Reply #11 on: November 16, 2015, 09:49:17 AM »
Ok, what line does it error out on?

pedroantonio

  • Guest
Re: annotation text lisp
« Reply #12 on: November 16, 2015, 09:50:47 AM »
I can not see any text.Create only the layer

ChrisCarlson

  • Guest
Re: annotation text lisp
« Reply #13 on: November 16, 2015, 09:52:29 AM »
So it creates the layer then breaks? Based on that I would assume something is wrong with this line. Copy and paste it into the CAD command line.

Code - Auto/Visual Lisp: [Select]
  1. (command "_.-style" "_KEIM" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")

pedroantonio

  • Guest
Re: annotation text lisp
« Reply #14 on: November 16, 2015, 09:54:43 AM »
I use the same line in other lisp files . is correct