Author Topic: Help to judge the two objects draw order in drawing  (Read 2612 times)

0 Members and 1 Guest are viewing this topic.

Faster

  • Guest
Help to judge the two objects draw order in drawing
« on: December 13, 2012, 08:04:57 AM »
Hi all.
How to judge the two objects draworder in drawing?
thanks!

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Help to judge the two objects draw order in drawing
« Reply #1 on: December 13, 2012, 08:21:42 AM »
Example:

Code - Auto/Visual Lisp: [Select]
  1. ;; Full Draw Order  -  Lee Mac
  2. ;; Returns a list of objects contained in the supplied block, sorted by draw order.
  3.  
  4. (defun LM:fulldraworder ( blk / dic lst srt )
  5.     (if
  6.         (and
  7.             (= :vlax-true (vla-get-hasextensiondictionary blk))
  8.             (setq dic (vla-getextensiondictionary blk))
  9.             (or
  10.                 (setq srt (LM:catchapply 'vla-item (list dic "ACAD_SORTENTS")))
  11.                 (setq srt (LM:catchapply 'vla-addobject (list dic "ACAD_SORTENTS" "AcDbSortentsTable")))
  12.             )
  13.         )
  14.         (vla-getfulldraworder srt 'lst :vlax-true)
  15.     )
  16.     (if lst (vlax-safearray->list lst))
  17. )
  18.  
  19. ;; Catch Apply  -  Lee Mac
  20. ;; Applies a function to a list of parameters and catches any exceptions.
  21.  
  22. (defun LM:catchapply ( fnc prm / rtn )
  23.     (if (not (vl-catch-all-error-p (setq rtn (vl-catch-all-apply fnc prm))))
  24.         rtn
  25.     )
  26. )
  27.  

Code - Auto/Visual Lisp: [Select]
« Last Edit: December 13, 2012, 08:25:02 AM by Lee Mac »

Faster

  • Guest
Re: Help to judge the two objects draw order in drawing
« Reply #2 on: December 13, 2012, 08:38:34 AM »
Very nice,Lee.
Thanks a lot!

Faster

  • Guest
Re: Help to judge the two objects draw order in drawing
« Reply #3 on: December 13, 2012, 08:46:22 AM »
Hi,Lee,How to use method "GetRelativeDrawOrder"?Can you give me a example?

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Help to judge the two objects draw order in drawing
« Reply #4 on: December 13, 2012, 09:17:15 AM »
Hi,Lee,How to use method "GetRelativeDrawOrder"?Can you give me a example?

I think there is a bug with this method - I believe it should rearrange the objects in a supplied variant, but I always seem to receive 'Invalid Object Array' - I have tried using both a variant & safearray.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Faster

  • Guest
Re: Help to judge the two objects draw order in drawing
« Reply #6 on: December 13, 2012, 09:25:14 PM »
Hi,Lee,How to use method "GetRelativeDrawOrder"?Can you give me a example?

I think there is a bug with this method - I believe it should rearrange the objects in a supplied variant, but I always seem to receive 'Invalid Object Array' - I have tried using both a variant & safearray.
Yes,So do I.
Thank you very much, Lee

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Help to judge the two objects draw order in drawing
« Reply #7 on: December 14, 2012, 06:50:09 AM »
Hi,Lee,How to use method "GetRelativeDrawOrder"?Can you give me a example?

I think there is a bug with this method - I believe it should rearrange the objects in a supplied variant, but I always seem to receive 'Invalid Object Array' - I have tried using both a variant & safearray.
Yes,So do I.
Thank you very much, Lee

You're welcome  :-)