Author Topic: Hatch boundary modified by lisp: how to update the hatch?  (Read 3432 times)

0 Members and 1 Guest are viewing this topic.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Hatch boundary modified by lisp: how to update the hatch?
« on: November 04, 2010, 07:17:04 AM »
I am playing around with True Rectangle by Gile:
http://www.theswamp.org/index.php?topic=29339.0
(Thank you Gile for that great reactor example!)

Basically Gile's code updates the coordinates of a rectangle after every user modification, making sure it stays a true rectangle. If the rectangle is a hatch boundary the hatch is not automatically updated (the rectangle can of course be the boundary of any number of hatches). The only solution I have come up with is to move the rectangle after the coordinates have been updated:
Code: [Select]
<snip>
  (setvar 'cmdecho 0)
  (vl-cmdf "_.move" ent "" '(0 0 0) '(0 0 0))
  (setvar 'cmdecho 1)
<snip>

Without success I have also tried the following on individual hatches:
Code: [Select]
(vla-evaluate (vlax-ename->vla-object (car (entsel))))
Code: [Select]
(vla-update (vlax-ename->vla-object (car (entsel))))
Code: [Select]
(vla-setpattern (vlax-ename->vla-object (car (entsel))) achatchpatterntypepredefined "ANSI32")
Is there a different way (not using vl-cmdf) to force all the hatches of which the rectangle is a boundary to update?

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: Hatch boundary modified by lisp: how to update the hatch?
« Reply #1 on: November 04, 2010, 09:20:41 AM »
Hi, have you already tried (vla-update (vlax-get-acad-object)) or (vla-regen (vla-get-document oHatch) acActiveViewport) or (entmod (entget entHatch))?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Hatch boundary modified by lisp: how to update the hatch?
« Reply #2 on: November 04, 2010, 10:49:07 AM »
Fred, thanks for responding. The problem is that the hatches retain their original boundary data. The lisp modification of the rectangle doesn't trigger an update the way a normal command does. Even saving, closing and reopening doesn't help.

So your suggestions, sadly, don't work :cry::
Code: [Select]
(vla-update (vlax-get-acad-object))
Code: [Select]
(vla-regen (vla-get-document (vlax-ename->vla-object (car (entsel)))) acallviewports)
Code: [Select]
(entmod (entget (car (entsel))))

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: Hatch boundary modified by lisp: how to update the hatch?
« Reply #3 on: November 04, 2010, 12:13:46 PM »
That's interesting, because I have a tool that appends or removes points from the polyline and automatically the hatch will be updated after (entmod lstNewList).

That's really bad. Then I have no other idea.
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Hatch boundary modified by lisp: how to update the hatch?
« Reply #4 on: November 04, 2010, 01:18:10 PM »
... and automatically the hatch will be updated after (entmod lstNewList).
I Use Bricscad. Maybe AutoCAD behaves better!