Send Backwards all hatches in a block

Send Backwards all hatches in a block

zafera5VK85
Contributor Contributor
309 Views
2 Replies
Message 1 of 3

Send Backwards all hatches in a block

zafera5VK85
Contributor
Contributor

Hello Form, 

 

I'm having difficulties to send all hatches to backwards in a block. Anyway to solve this issue? 

 

Best regards

Victor.

0 Likes
310 Views
2 Replies
Replies (2)
Message 2 of 3

LDShaw
Collaborator
Collaborator

Here is a lisp that removes hatches from a dwg.

 

(defun c:dlhatch (/ adoc)

  (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
  (vlax-for blk_def (vla-get-blocks adoc)
    (if (equal (vla-get-isxref blk_def) :vlax-false)
      (vlax-for ent blk_def
        (if (= (vla-get-objectname ent) "AcDbHatch")
          (vl-catch-all-apply
            (function
              (lambda ()
                (vla-erase ent)
                ) ;_ end of lambda
              ) ;_ end of function
            ) ;_ end of vl-catch-all-apply
          ) ;_ end of if
        ) ;_ end of vlax-for
      ) ;_ end of if
    ) ;_ end of vlax-for
  (vla-endundomark adoc)
  (princ)
)

 


Untested but maybe this?

 

(defun c:foohatch (/ adoc)

  (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
  (vlax-for blk_def (vla-get-blocks adoc)
    (if (equal (vla-get-isxref blk_def) :vlax-false)
      (vlax-for ent blk_def
        (if (= (vla-get-objectname ent) "AcDbHatch")
          (vl-catch-all-apply
            (function
              (lambda ()
                (vla-sendtoback ent)
              ) ;_ end of lambda
            ) ;_ end of function
          ) ;_ end of vl-catch-all-apply
        ) ;_ end of if
      ) ;_ end of vlax-for
    ) ;_ end of if
  ) ;_ end of vlax-for
  (vla-endundomark adoc)
  (princ)
)

 

 

Just changed the erase to a sendback

(vla-sendtoback ent)

Sorry I just tried this. It does not work. My best guess is it has something to do with the pointing system when blocks are created.  

0 Likes
Message 3 of 3

pendean
Community Legend
Community Legend

@zafera5VK85 wrote:

...I'm having difficulties to send all hatches to backwards in a block. Anyway to solve this issue? ...


it appears your attribute and your hatch are one and the same color, nothing more.

Same with the "table" outline.

pendean_0-1722875340680.png

 

 

Your issue is not draworder, but color

pendean_1-1722875365167.png

 

You need to fix your blocks' content to be different from each other, not all the same.

pendean_3-1722875471583.png

 

pendean_2-1722875449123.png