Author Topic: Dissasociate all hatches in model  (Read 1461 times)

0 Members and 1 Guest are viewing this topic.

w64bit

  • Newt
  • Posts: 78
Dissasociate all hatches in model
« on: July 01, 2017, 06:39:53 AM »
I am trying to disassociate all hatches in model with:
(if (setq hatch (ssget "_X" '((0 . "HATCH") (410 . "Model"))))(command "_HATCHEDIT" hatch "" "_DI"))
but it doesn't work.
Can anyone give me a hint to fix it?
Thank you.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Dissasociate all hatches in model
« Reply #1 on: July 01, 2017, 07:09:37 AM »
Try the following:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:dehatch ( / sel qaf )
  2.     (if (setq sel (ssget "_X" '((0 . "HATCH") (410 . "Model"))))
  3.         (progn
  4.             (setq qaf (getvar 'qaflags))
  5.             (setvar 'qaflags 1)
  6.             (vl-cmdf "_.-hatchedit" sel "" "_DI")
  7.             (setvar 'qaflags qaf)
  8.         )
  9.     )
  10.     (princ)
  11. )

w64bit

  • Newt
  • Posts: 78
Re: Dissasociate all hatches in model
« Reply #2 on: July 01, 2017, 07:39:03 AM »
If I want to put it in a SCR file and to make it simpler, is it OK like this?

Code: [Select]
(if (setq sel (ssget "_X" '((0 . "HATCH") (410 . "Model"))))
(progn
(setvar 'qaflags 1)
(vl-cmdf "_.-hatchedit" sel "" "_DI")
(setvar 'qaflags 0)))
« Last Edit: July 01, 2017, 08:17:39 AM by w64bit »

w64bit

  • Newt
  • Posts: 78
Re: Dissasociate all hatches in model
« Reply #3 on: July 01, 2017, 08:25:24 AM »
A simpler version for SCR file.

Code: [Select]
QAFLAGS 1
(if (setq sel (ssget "_X" '((0 . "HATCH") (410 . "Model"))))(command "_.-HATCHEDIT" sel "" "_DI"))
QAFLAGS 0

Thank you very much, Lee.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Dissasociate all hatches in model
« Reply #4 on: July 01, 2017, 08:26:29 AM »
Save it as dehatch.lsp to an AutoCAD Support Path, then, in your Script:
Code: [Select]
(or (boundp 'c:dehatch) (load "dehatch.lsp" nil)) (if (boundp 'c:dehatch) (c:dehatch))