AddSurfaceDrawingObjects lisp

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to fins a way to use the "AddSurfaceDrawingObjects" command without the dialogue box.
I want to choose "Blocks" in the object type in the dialogue box from the command line and populate the description with the date, time, and user name.
Then I want to select the previous selection and enter.
See the lisp below:
I'm sure there is probably a more elegant way of doing this:
(defun C:XS ()
(c:xe)
(c:xle)
(Command "AddSurfaceDrawingObjects" pause "p")
)
(defun C:XLE (/
entSelection
intCount
objAttribute
objSelection
ssSelections
strTextstring
)
(if (setq ssSelections (ssget (list (cons 2 "XLABEL"))))
(repeat (setq intCount (sslength ssSelections))
(setq intCount (1- intCount)
entSelection (ssname ssSelections intCount)
objSelection (vlax-ename->vla-object entSelection)
)
(foreach objAttribute (vlax-invoke objSelection "getattributes")
(if (= (vla-get-tagstring objAttribute) "ELEV1")
(if (/= (setq strTextstring (vla-get-textstring objAttribute)) "")
(progn
(setq lstInsertion (vlax-get objSelection "insertionpoint")
lstInsertion (list (car lstInsertion)
(cadr lstInsertion)
(atof strTextString)
)
)
(vlax-put objSelection "insertionpoint" lstInsertion)
)
)
)
)
)
)
)
(princ)
(vl-load-com)
(defun c:xe ( / blockname sset); filter all blocks of same name with one click
(setq blockname (cdr (assoc 2 (entget (car (entsel))))))
(setq sset (ssget "x" (list (cons 2 blockname))))
(sssetfirst sset sset)
(princ (strcat "\nSelected " (itoa (sslength sset)) " instances of block \"" blockname "\"."))
(princ)
)