Change door size via script or lisp

Change door size via script or lisp

tevansERD
Advocate Advocate
625 Views
2 Replies
Message 1 of 3

Change door size via script or lisp

tevansERD
Advocate
Advocate

We need to change the door height of our hvac closet doors from 5'-0" to 5'-2", these doors are their own style. Is there a way to change the height with a script or lisp routine so we don't have to manually change them for all of our drawings?

Thank you in advance

0 Likes
Accepted solutions (1)
626 Views
2 Replies
Replies (2)
Message 2 of 3

David_W_Koch
Mentor
Mentor
Accepted solution

This code creates a command called DRHT that will check all of the Doors in a drawing file and change the height of those whose style name is Bifold - Single to 62.0.  You will need to substitute the name of your HVAC closet Door Style.

 

(defun C:DRHT (				; No arguments.
	       /
		iCount			; Loop counter [integer].
		iMax			; Total number of Doors in file [integer].
		iProc			; Number of Doors processed [integer].
		objDoor			; Door object being processed.
		ss1			; All Doors in the file [selection set].
		sStyleName		; Style name of Door being processed [string].
	      ) ;_ End arguments and local variables.
  (setq	ss1 (ssget "_X" '((0 . "AEC_DOOR"))))
  (cond
    ((not ss1)				; No Doors in drawing.
     (alert "Drawing file has no Door objects.\nNothing to do!")
    ) ;_ End condition A1.
    (T					; Else, continue.
     (setq iMax	  (sslength ss1)
	   iCount 0
	   iProc  0
     ) ;_ End setq.
     (while (< iCount iMax)
       (setq objDoor	(vlax-ename->vla-object (ssname ss1 iCount))
	     sStyleName	(vlax-get-property objDoor 'StyleName)
       ) ;_ End setq.
       (if (= sStyleName "Bifold - Single")
	 (progn
	   (vlax-put-property objDoor 'Height 62.0)
	   (setq iProc (1+ iProc))
	 ) ;_ End progn.
       ) ;_ End if.
       (setq icount (1+ icount))
     ) ;_ End while.
    ) ;_ End condition A2.
  ) ;_ End cond A.
  (prompt
    (strcat
      "\nDRHT function completed:  "
      (itoa iProc)
      " Door(s) of "
      (itoa iCount)
      " total Door(s) processed. "
    ) ;_ End strcat.
  ) ;_ End prompt.
  (prin1)
) ;_ End C:DRHT.

 

 


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 3 of 3

tevansERD
Advocate
Advocate

Awsome, works perfect

thank you

0 Likes