In VBA, is there a way to run the DrawOrder command without using SendCommand. The reason is that I have a current AutoCAD command in execution and that would get killed if I use SendCommand. Thanks in advance & Regards Rakesh -- - Rakesh Rao [rakesh.rao(at)4d-technologies.com] - Four Dimension Technologies [www.4d-technologies.com] - Coordinate Systems - Geo GeoTools, Work smarter in AutoCAD: www.4d-technologies.com/geotools
Hi Rakesh At the moment I have no sample in VBA. The following sample is written in VisualLISP - therefore no problem to translate: Code: ; ; -- Function MeSetDrawOrder ; Changes draw order of object(s) by given method. ; Copyright: ; ©2004 MENZI ENGINEERING GmbH, Switzerland ; Arguments [Typ]: ; Obl = Object list [LIST] ; Mde = Sort method [SYMBOL] ; Methodes: ; - 'MoveToTop ; - 'MoveToBottom ; - 'MoveAbove ; - 'MoveBelow ; Return [Typ]: ; > Null ; Notes: ; None ; (defun MeSetDrawOrder (Obl Mde / AcaDoc ExtDic SreTbl) (setq AcaDoc (vla-get-ActiveDocument (vlax-get-acad-object)) ExtDic (vla-GetExtensionDictionary (vla-get-ModelSpace AcaDoc)) ) (if (vl-catch-all-error-p (setq SreTbl (vl-catch-all-apply 'vla-Item (list ExtDic "ACAD_SORTENTS") ) ) ) (setq SreTbl (vla-AddObject "ACAD_SORTENTS" "AcDbSortentsTable")) ) (vlax-Invoke SreTbl Mde Obl) (princ) ) Cheers
Rakesh - In addition to any replies you might receive or have already received, you may find more information or responses by posting future VBA related questions in the following discussion group: Web browser: http://discussion.autodesk.com/forum.jspa?forumID=33 Newsreader: news://discussion.autodesk.com/autodesk.autocad.customization.vba
Hi Rakesh I published an old and faulty version of 'VxSetDrawOrder'. Here is the correct one: Code: ; ; -- Function VxSetDrawOrder ; Changes draw order of object(s) by given method. ; Copyright: ; ©2004 MENZI ENGINEERING GmbH, Switzerland ; Arguments [Typ]: ; Obl = Object list [LIST] ; Tob = Target object [VLA-OBJECT] *) ; or nil ; Mde = Sort method [SYMBOL] ; Methodes: ; - 'MoveToTop ; - 'MoveToBottom ; - 'MoveAbove ; - 'MoveBelow ; Return [Typ]: ; > Null ; Notes: ; *) Sort methods 'MoveAbove and 'MoveBelow require a target object (Tob) ; as target of the draw order. Tob argument must be nil for 'MoveToTop ; and 'MoveToBottom. ; (defun VxSetDrawOrder (Obl Tob Mde / AcaDoc ExtDic SreTbl) (setq AcaDoc (vla-get-ActiveDocument (vlax-get-acad-object)) ExtDic (vla-GetExtensionDictionary (vla-get-ModelSpace AcaDoc)) ) (if (vl-catch-all-error-p (setq SreTbl (vl-catch-all-apply 'vla-Item (list ExtDic "ACAD_SORTENTS") ) ) ) (setq SreTbl (vla-AddObject ExtDic "ACAD_SORTENTS" "AcDbSortentsTable")) ) (if Tob (vlax-Invoke SreTbl Mde Obl Tob) (vlax-Invoke SreTbl Mde Obl) ) (princ) ) Cheers