Author Topic: getting object "above" with from draworder  (Read 2977 times)

0 Members and 1 Guest are viewing this topic.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
getting object "above" with from draworder
« on: August 08, 2006, 05:46:03 PM »
(Posted in adesk customization group also)
I want to replace an existing entity with another, and put the new one at the exact same draworder.
To get the draworder of the existing entity, I have to use the getfulldraworder method I believe.
Once I have the list, I can determine what object is above me so I use that in the MoveBelow method.
I am this far with getting it:

(setq space (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(setq extdict (vla-getextensiondictionary space))
(if (not (zerop (vla-get-count extdict)))
  (setq sorttbl (vla-getobject extdict "acad_sortents"))
  (setq sorttbl (vla-addobject extdict "acad_sortents" "acdbsortentstable"))
)
(setq allorder (vla-getfulldraworder sorttbl space :vlax-false))

but no go, I get nil for allorder...any ideas
James Maeding

T.Willey

  • Needs a day job
  • Posts: 5251
Re: getting object "above" with from draworder
« Reply #1 on: August 08, 2006, 05:57:28 PM »
I just noticed that the SortEntsDictionary has a SwapMember method.  If you have the entity names, then you can swap them, no need to find the full order (which I haven't been able to do either).
Quote from: Acad Help
SwapOrder Method
 


Swaps the draw order positions of two objects.

See Also | Example

Signature

object.SwapOrder (Object1, Object2)

object

SortentsTable
The object or objects this method applies to.

Object1

AcadEntity; the first object.

Object2

AcadEntity; the second object.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: getting object "above" with from draworder
« Reply #2 on: August 08, 2006, 06:03:06 PM »
It worked for me.  I drew a line, and then a rectangle, and then I hatched the rectangle.  I used the draw order command, and brought it all to front.  The hatch still on top.  I got the object id for the line, and the hatch.  I swaped them in the dictionary, and after a regen the line shows over the hatch.

Hope that helps.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: getting object "above" with from draworder
« Reply #3 on: August 08, 2006, 06:38:24 PM »
(setq allorder (vla-getfulldraworder sorttbl space :vlax-false))

but no go, I get nil for allorder...any ideas
Yep, this is one of those cases where the supplied argument (you used space above) is an OUTPUT variable.....this is more what you want:
Code: [Select]
(vla-getfulldraworder sorttbl 'allorder :vlax-false)
(setq allList (vlax-safearray->list allorder))

T.Willey

  • Needs a day job
  • Posts: 5251
Re: getting object "above" with from draworder
« Reply #4 on: August 08, 2006, 06:42:24 PM »
(setq allorder (vla-getfulldraworder sorttbl space :vlax-false))

but no go, I get nil for allorder...any ideas
Yep, this is one of those cases where the supplied argument (you used space above) is an OUTPUT variable.....this is more what you want:
Code: [Select]
(vla-getfulldraworder sorttbl 'allorder :vlax-false)
(setq allList (vlax-safearray->list allorder))
Good one Jeff.  I don't know if I would have ever caught that one.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: getting object "above" with from draworder
« Reply #5 on: August 08, 2006, 08:37:43 PM »
ahhh, grasshoppper!
Thanks again, hope you make it to AU this year!
James Maeding