vba commands for drawing order

vba commands for drawing order

Anonymous
Not applicable
1,117 Views
5 Replies
Message 1 of 6

vba commands for drawing order

Anonymous
Not applicable
I'm using Acad2002 and am trying to figure out how to change the properties
of an object programatically so it is sent to the back of the drawing and
other line entities that are already existing are drawn/displayed on top of
this object.

Thanks,
0 Likes
1,118 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Here's a very simple lisp. Use as is or translate to vba if you wish.
;;; Top.lsp - move to top of draworder
(defun c:Top (/ selset)
(prompt "Select entities to move to top of draworder. ")
(setq selset (ssget))
(command "copy" selset "" "@" "@") ;copy at same location puts ents higher
in database
(command "erase" selset "") ;erase previous ents
(command "redraw")
(princ)
)

--
--
Ed
--

"Brent" wrote in message
news:8E9EC6F5E9BF56ABCE9150FCF306498A@in.WebX.maYIadrTaRb...
> I'm using Acad2002 and am trying to figure out how to change the
properties
> of an object programatically so it is sent to the back of the drawing and
> other line entities that are already existing are drawn/displayed on top
of
> this object.
>
> Thanks,
>
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
Ed -
Thanks for the reply. However, I'm wanting to send to the back of the
drawing just one entity/object. Instead of creating a selection set for all
the other entities in the drawing and erasing them and recreating them, it
seems that there should be a process in either vba or vlisp that can achieve
modifying just one entity? I would think there is a property value that can
be changed on an object that would flag this entity to be in the background.

Thanks,
BB


"Ed Jobe" wrote in message
news:91CC866D284D2161CA8F215AA72C3D2C@in.WebX.maYIadrTaRb...
> Here's a very simple lisp. Use as is or translate to vba if you wish.
> ;;; Top.lsp - move to top of draworder
> (defun c:Top (/ selset)
> (prompt "Select entities to move to top of draworder. ")
> (setq selset (ssget))
> (command "copy" selset "" "@" "@") ;copy at same location puts ents
higher
> in database
> (command "erase" selset "") ;erase previous ents
> (command "redraw")
> (princ)
> )
>
> --
> --
> Ed
> --
>
> "Brent" wrote in message
> news:8E9EC6F5E9BF56ABCE9150FCF306498A@in.WebX.maYIadrTaRb...
> > I'm using Acad2002 and am trying to figure out how to change the
> properties
> > of an object programatically so it is sent to the back of the drawing
and
> > other line entities that are already existing are drawn/displayed on top
> of
> > this object.
> >
> > Thanks,
> >
> >
> >
>
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
In pure VB most objects have a Zorder property which is for affecting exactly what you are describing. Unfortunately Autodesk appears not to have implemented this functionality in their object model.



You could try investigating the Windows API SetWindowPos. The second parameter should be 1 (I think) for Send To Back. I've used this in VB but I'm not sure if it would work in the AutoCAD environment. (Sorry, no time to go into more detail.)



Regards



Wayne Ivory

IT Analyst Programmer

Wespine Industries Pty Ltd
0 Likes
Message 5 of 6

Anonymous
Not applicable
Use the AutoCAD unsupported library - ADSKUNSUPP2000.ARX - which is
available on the 'net. It will allow for DrawOrder.

HTH,
Mike
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
0 Likes
Message 6 of 6

Anonymous
Not applicable
Maybe you could try this. It's kinda hoky but it does kind of do what you
asked. You could add functionality that would allow you to select the
object(s) that you want the object to go under...

Sub vbaDrawOrder()

Dim obj As AcadObject, obj2 As AcadObject
Dim PickPoint As Variant
ThisDrawing.Utility.GetEntity obj, PickPoint, vbCr & "Select object to
send back:"
Set obj2 = obj.Copy
obj.Delete
ThisDrawing.SendCommand "DRAWORDER" & vbCr & "L" & vbCr & vbCr & "Back"
& vbCr

End Sub

Regards,
Rogue



"Brent" wrote in message
news:8E9EC6F5E9BF56ABCE9150FCF306498A@in.WebX.maYIadrTaRb...
> I'm using Acad2002 and am trying to figure out how to change the
properties
> of an object programatically so it is sent to the back of the drawing and
> other line entities that are already existing are drawn/displayed on top
of
> this object.
>
> Thanks,
>
>
>
0 Likes