AddSurfaceDrawingObjects lisp

AddSurfaceDrawingObjects lisp

Anonymous
Not applicable
747 Views
3 Replies
Message 1 of 4

AddSurfaceDrawingObjects lisp

Anonymous
Not applicable

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

0 Likes
748 Views
3 Replies
Replies (3)
Message 2 of 4

DannyNL
Advisor
Advisor

Not sure what AutoCAD vertical you are using (AutoCAD Vanilla doesn't have the AddSurfaceDrawingObjects command), but usually you can suppress dialogue boxes by prefixing the command with a minus sign (so the command -AddSurfaceDrawingObjects) or by setting the CMDDIA variable to 0.

0 Likes
Message 3 of 4

Anonymous
Not applicable

I am using Civil 3D 2017. -AddSurfaceDrawingObjects does not work. I tried the CMDDIA variable, but the dialogue box still pops up to select the drawing object type.

0 Likes
Message 4 of 4

DannyNL
Advisor
Advisor

Mmmh...that's too bad.

As I do not have Civil 3D I'm not able to further check on this and find a solution, so hopefully someone else can help you out.

0 Likes