Home How create automation that get text value and set it to point in Autocad
Reply: 1

How create automation that get text value and set it to point in Autocad

user2481034
1#
user2481034 Published in 2017-11-09 14:10:02Z

Need create macros/lisp/vba/diesel that user may do next steps:

  • user clicking on TEXT on scheme and script getting this text value (it will be number) to buffer or into varialbe
  • after that script changing cursor to PO (point)
  • user will click on scheme and creates point
  • our number from first steps will set automatically into point property as Z coordinate

How better to do it? With macros possible? Or need VBA or something else?

gileCAD
2#
gileCAD Reply to 2017-11-09 22:43:58Z

IMO, the simplest is AutoLISP

(defun c:foo (/ txt data z pt)
  (if (setq txt (car (entsel "\nSelect text: ")))
    (if (wcmatch (cdr (assoc 0 (setq data (entget txt)))) "*TEXT")
      (if (setq z (distof (cdr (assoc 1 data))))
        (if (setq pt (getpoint "\nPick a point: "))
          (command "_.point" (list (car pt) (cadr pt) z))
        )
        (prompt "\nSelected text is not a number.")
      )
      (prompt "\nSelected object is not a text or mtext.")
    )
  )
  (princ)
)
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.330396 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO