TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Faster on December 13, 2012, 08:04:57 AM

Title: Help to judge the two objects draw order in drawing
Post by: Faster on December 13, 2012, 08:04:57 AM
Hi all.
How to judge the two objects draworder in drawing?
thanks!
Title: Re: Help to judge the two objects draw order in drawing
Post by: Lee Mac 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]
Title: Re: Help to judge the two objects draw order in drawing
Post by: Faster on December 13, 2012, 08:38:34 AM
Very nice,Lee.
Thanks a lot!
Title: Re: Help to judge the two objects draw order in drawing
Post by: Faster on December 13, 2012, 08:46:22 AM
Hi,Lee,How to use method "GetRelativeDrawOrder"?Can you give me a example?
Title: Re: Help to judge the two objects draw order in drawing
Post by: Lee Mac 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.
Title: Re: Help to judge the two objects draw order in drawing
Post by: CAB on December 13, 2012, 10:03:18 AM
http://entercad.ru/acadauto.en/idh_getrelativedraworder.htm
Title: Re: Help to judge the two objects draw order in drawing
Post by: Faster 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
Title: Re: Help to judge the two objects draw order in drawing
Post by: Lee Mac 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  :-)