Discussion:
DrawOrder without SendCommand
(too old to reply)
Rakesh Rao
2005-03-26 09:36:16 UTC
Permalink
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
Jürg Menzi
2005-03-26 11:18:22 UTC
Permalink
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)
)[/code]

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch
Anne Brown
2005-03-26 22:02:24 UTC
Permalink
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
---
Anne Brown
Discussion Groups Administrator
Autodesk, Inc.
Post by Rakesh Rao
In VBA, is there a way to run the DrawOrder command without using
SendCommand. (snip)
Jürg Menzi
2005-03-29 11:30:03 UTC
Permalink
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)
)[/code]

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch
Loading...