Author Topic: 3d polyline draw with text  (Read 1535 times)

0 Members and 1 Guest are viewing this topic.

dussla

  • Bull Frog
  • Posts: 291
3d polyline draw with text
« on: August 30, 2015, 10:02:12 PM »
hello  friends
i need help again ~
if you see dwg file , you can see  polyline with text
i would like to draw 3d polyline  with text ( z value)
if i select  1   text     ,  after that    draw 3d polyline countley ~
« Last Edit: August 30, 2015, 10:21:18 PM by dussla »

dussla

  • Bull Frog
  • Posts: 291
Re: 3d polyline draw with text
« Reply #1 on: September 02, 2015, 02:06:47 AM »
(defun c:Poly ( / a)
  (command "._3dpoly")
  (while (eq 1 (logand 1 (getvar "cmdactive")))
    (if a (setq a (getpoint a "\n Pick Point: "))
      (setq a (getpoint "\n Pick Point: "))
    )

    (if a
   
     ( cond
     (setq e (car (entsel "\nNew Elevation, Select TEXT object [Return for KB input]: ")))
     (setq elist (entget e))
     (setq elev (read (cdr (assoc 1 elist)))) 
   
   
   
  (command (list (car a) (cadr a) elev))     
      (command)
    
      )
    )
   
  )
  (princ)
)


 this is  code  but that does not work

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: 3d polyline draw with text
« Reply #2 on: September 02, 2015, 04:43:41 AM »
Below is an improved version of your code. You will probably need to switch to the WCS before using it.

BricsCAD supports arbitrary input for entsel. But, according to the docs, AutoCAD does not. Which is a pity: the code can be more user friendly if arbitrary input is possible.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:Poly ( / elev elist enme pt)
  2.   (command "._3dpoly")
  3.   (while (eq 1 (logand 1 (getvar "cmdactive")))
  4.     (if
  5.       (and
  6.         (if pt
  7.           (setq pt (getpoint pt "\nPick Point: "))
  8.           (setq pt (getpoint "\nPick Point: "))
  9.         )
  10.         (or
  11.           (and
  12.             (setq enme (car (entsel "\nNew Elevation from TEXT object or Enter: ")))
  13.             (setq elist (entget enme))
  14.             (numberp (setq elev (read (cdr (assoc 1 elist)))))
  15.           )
  16.           (setq elev (getdist "\nNew Elevation or Enter to quit: "))
  17.         )
  18.       )
  19.       (command "_non" (list (car pt) (cadr pt) elev))
  20.       (command nil)
  21.     )
  22.   )
  23.   (princ)
  24. )

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: 3d polyline draw with text
« Reply #3 on: September 02, 2015, 07:43:27 AM »
Here is my attempt...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:3pltxtelev ( / *error* *adoc* ape px pt pick enter gr p s pl lil )
  2.  
  3.  
  4.   (defun *error* ( msg )
  5.     (if lil
  6.       (foreach li lil
  7.         (entdel li)
  8.       )
  9.     )
  10.     (command "_.3DPOLY")
  11.     (foreach pt (reverse pl)
  12.       (if (listp pt) (command "_non" pt))
  13.     )
  14.     (command "")
  15.     (if ape (setvar 'aperture ape))
  16.     (vla-endundomark *adoc*)
  17.     (if msg (prompt msg))
  18.     (princ)
  19.   )
  20.  
  21.   (vla-startundomark *adoc*)
  22.   (setq ape (getvar 'aperture))
  23.   (setvar 'aperture 15)
  24.   (setq px (/ (getvar 'viewsize) (cadr (getvar 'screensize))))
  25.   (setq pt (getpoint "\nStart point : "))
  26.   (prompt "\nPick text entity or ENTER for keyboard input...")
  27.   (while (and (not el) (setq gr (grread t 15 2)))
  28.     (cond
  29.       ( (= (car gr) 3)
  30.         (if (osnap (cadr gr) "_nea") (setq p (osnap (cadr gr) "_nea")) (setq p (cadr gr)))
  31.         (setq s (ssget "_C" (mapcar '- p (list (* (getvar 'aperture) px) 0.0 0.0)) (mapcar '+ p (list (* (getvar 'aperture) px) 0.0 0.0)) '((0 . "TEXT"))))
  32.         (if s (setq pick nil) (setq pick t))
  33.       )
  34.       ( (and (= (car gr) 2) (or (= (cadr gr) 13) (= (cadr gr) 32)))
  35.         (setq enter t)
  36.       )
  37.     )
  38.     (if (not s)
  39.       (cond
  40.         ( pick
  41.           (prompt "\nMissed, try picking text entity again, or press ENTER for keyboard input...")
  42.           (setq el nil pick nil)
  43.         )
  44.         ( enter
  45.           (setq el (getdist "\nPick or specify elevation for point specification <0.0> : "))
  46.           (if (null el) (setq el 0.0))
  47.           (setq enter nil)
  48.         )
  49.       )
  50.       (setq el (atof (cdr (assoc 1 (entget (ssname s 0))))))
  51.     )
  52.   )
  53.   (setq pt (list (car pt) (cadr pt) el))
  54.   (setq pl (cons pt pl))
  55.   (setq el nil s nil)
  56.   (while (and pt (and (not (eq pt "c")) (not (eq pt "C")) (not (eq pt "Close"))))
  57.     (if (= (length pl) 1)
  58.       (progn
  59.         (initget 1)
  60.         (setq pt (getpoint (car pl) "\nPick or specify next point : "))
  61.       )
  62.       (progn
  63.         (initget 128)
  64.         (setq pt (getpoint (car pl) "\nPick or specify next point or [Undo/Close] <ENTER-FINISH> : "))
  65.       )
  66.     )
  67.     (if (and pt (listp pt))
  68.       (progn
  69.         (prompt "\nPick text entity or ENTER for keyboard input...")
  70.         (while (and (not el) (setq gr (grread t 15 2)))
  71.           (cond
  72.             ( (= (car gr) 3)
  73.               (if (osnap (cadr gr) "_nea") (setq p (osnap (cadr gr) "_nea")) (setq p (cadr gr)))
  74.               (setq s (ssget "_C" (mapcar '- p (list (* (getvar 'aperture) px) 0.0 0.0)) (mapcar '+ p (list (* (getvar 'aperture) px) 0.0 0.0)) '((0 . "TEXT"))))
  75.               (if s (setq pick nil) (setq pick t))
  76.             )
  77.             ( (and (= (car gr) 2) (or (= (cadr gr) 13) (= (cadr gr) 32)))
  78.               (setq enter t)
  79.             )
  80.           )
  81.           (if (not s)
  82.             (cond
  83.               ( pick
  84.                 (prompt "\nMissed, try picking text entity again, or press ENTER for keyboard input...")
  85.                 (setq el nil pick nil)
  86.               )
  87.               ( enter
  88.                 (setq el (getdist "\nPick or specify elevation for point specification <0.0> : "))
  89.                 (if (null el) (setq el 0.0))
  90.                 (setq enter nil)
  91.               )
  92.             )
  93.             (setq el (atof (cdr (assoc 1 (entget (ssname s 0))))))
  94.           )
  95.         )
  96.         (setq pt (list (car pt) (cadr pt) el))
  97.         (setq pl (cons pt pl))
  98.         (setq lil (cons (entmakex (list '(0 . "LINE") (cons 10 (trans (car pl) 1 0)) (cons 11 (if (cadr pl) (trans (cadr pl) 1 0) (trans (car pl) 1 0))))) lil))
  99.         (setq el nil s nil)
  100.       )
  101.       (cond
  102.         ( (or (eq pt "u") (eq pt "U") (eq pt "Undo"))
  103.           (setq pl (cdr pl))
  104.           (entdel (car lil))
  105.           (setq lil (cdr lil))
  106.         )
  107.         ( (or (eq pt "c") (eq pt "C") (eq pt "Close"))
  108.           (setq pl (cons (last pl) pl))
  109.         )
  110.       )
  111.     )
  112.   )
  113.   (*error* nil)
  114. )
  115.  

HTH, M.R.
« Last Edit: September 03, 2015, 12:01:15 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

dussla

  • Bull Frog
  • Posts: 291
Re: 3d polyline draw with text
« Reply #4 on: September 08, 2015, 09:32:45 PM »
roy_043  , ribram   really thank you
work is good

really  thank youy