Polls

Within the context of its era, which version of AutoCAD was the most STABLE?
 

Subscribe

Bhatch does not find a hatch boundary PDF Print E-mail
Friday, 07 March 2008
Ever since bhatch was introduced in R13, it has had trouble finding the boundary of many areas which are bound by arcs or polylines with arcs.  This bug seems to be more troublesome the farther the linework is away from the UCS origin.  It appears to be worse still when the linework is far from the WCS origin (such as any geospatial drawing).  Over the past 14 years, the user community has come up with numerous workarounds to coax results from the bhatch command.  Unfortunately, no single workaround works in all cases.  Furthermore, none of these workarounds make sense to younger users who have never had to massage results from their software and have grown to expect applications to "just work."  These workarounds are documented below.

Workarounds:

  • If the linework is polylines, sometimes it helps to explode them before hatching
  • If the linework is lines and arcs, sometimes it helps to convert them to polylines before hatching
  • Sometimes it helps to temporarily set the UCS closer to the current view *
  • Sometimes it helps to temporarily move the linework closer to the WCS origin
  • Sometimes it helps to continuously cut the figure that won't hatch into halves and hatch each half until a "leak" is found
  • You should always to check the entities in question for an "extrusion direction" and if they have one, remove the extrusion direction with the express tools FLATTEN command. 
  • HPGAPTOL almost never works

First Appeared: When bhatch was introduced in R13 (1994).  It's possible that the hatch command from previous releases exhibited the same symptoms, but I simply can't remember.
Status as of 2008 SP1: Still reproducible.

* I have written a short lisp command which automatically sets the UCS close to the current view, runs the bhatch command, and then sets the UCS back.  Although it still fails in many of the same situations that cause the "out of the box" bhatch command to fail, it definitely does a better job than the default command in many cases.  In particular, it sheilds the users from quite a few hatch errors when working in geospatial drawing files.  The code is as listed below.  I'll add it to the downloads section as time permits.

;; bbh.lsp (Better BHatch)
;; ralph sanchez (rsanchez at texupport dawt net)
;;
;; As most users know, AutoCAD has trouble hatching anything but simple figures when working far from the WCS origin
;; The user community has come up with several workarounds and this code attempts one of the most common.
;; In short, it will temporarily change the UCS to the current view before executing the bhatch command.
;; As with all of the workarounds, it is not perfect and does not work in many situations.
;; It does, however, work better than the default bhatch command.
(DEFUN c:bbh (/ ucsorg ucsx ucsy)
  (DEFUN savars (sv0 / x)
    ;;excellent savars/revars functions from paul turvill 
    ;;(prevents user ESC from killing variables)
    (COMMAND "._undo" "begin")
    (SETQ svx1  nil
   olderr *error*
    ) ;_ end-setq
    (FOREACH x sv0 (SETQ svx1 (APPEND svx1 (LIST (LIST x (GETVAR x))))))
    (SETQ ucsorg (GETVAR "UCSORG"))
    (SETQ ucsx (TRANS (LIST 1 0 0) 1 0))
    (SETQ ucsy (TRANS (LIST 0 1 0) 1 0))
    (DEFUN *error* (msg) (revars))
  ) ;_ end-defun
  (DEFUN revars (/ x)
    (SETQ *error* olderr)
    (FOREACH x svx1 (SETVAR (CAR x) (CADR x)))
    (SETQ svx1 nil)
    (COMMAND "._ucs" "3p" (TRANS ucsorg 0 1) (TRANS ucsx 0 1) (TRANS ucsy 0 1))
    (PRINC)
    (COMMAND "._undo" "end")
  ) ;_ end-defun
  ;;******************************************************
  (savars '("cmdecho")) ;'saves variables to be reset later
  (SETVAR "cmdecho" 0)
  (COMMAND "._ucs" (GETVAR "vsmin") "")
  (INITDIA)
  (COMMAND "bhatch")
  (WHILE (= (LOGAND (GETVAR "cmdactive") 1) 1) (COMMAND pause))
  ;;******************************************************  
  (revars)
  (PRINC)
) ;_ end- defun

 

 
< Prev   Next >

THIS INFORMATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright © 2008, http://www.texupport.net/