DrawOrder without SendCommand

Discussion in 'AutoCAD' started by Rakesh Rao, Mar 26, 2005.

  1. Rakesh Rao

    Rakesh Rao Guest

    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
     
    Rakesh Rao, Mar 26, 2005
    #1
  2. Rakesh Rao

    Jürg Menzi Guest

    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
     
    Jürg Menzi, Mar 26, 2005
    #2
  3. Rakesh Rao

    Anne Brown Guest

    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, Mar 26, 2005
    #3
  4. Rakesh Rao

    Jürg Menzi Guest

    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
     
    Jürg Menzi, Mar 29, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.