Author Topic: Detect multiply connected hatch  (Read 2677 times)

0 Members and 1 Guest are viewing this topic.

Treddin

  • Guest
Detect multiply connected hatch
« on: June 17, 2009, 12:19:22 PM »
Hi, I did some searching but couldn't find an answer...

Say you have two closed polygons that are not touching and are not inside each other.  If you hatch them both at the same time, there are now two hatch "islands" that are invisibly connected.  Let's call this situation A.

Say you have two closed polygons, where one is inside the other. If you select them both to hatch, you get a donut, or ring, type of hatch. Let's call this situation B.

Does anyone know how to detect when situation A occurs, but ignore when situation B occurs, using autoLisp? 

The solution needs to work in AutoCAD 2000 and it also needs to be autolisp (can't use, vl, vla or vlax functions)

-Thanks

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: Detect multiply connected hatch
« Reply #1 on: June 18, 2009, 02:22:59 AM »
Hi,

Look for all the 92 DXF code group (there's one per boundary), if one of them countains a bit 16, it means there's an outermost loop (situation B).
« Last Edit: June 18, 2009, 07:00:24 AM by gile »
Speaking English as a French Frog

Lee Mac

  • Seagull
  • Posts: 12923
  • London, England
Re: Detect multiply connected hatch
« Reply #2 on: June 18, 2009, 06:06:35 AM »

Treddin

  • Guest
Re: Detect multiply connected hatch
« Reply #3 on: June 22, 2009, 10:59:55 AM »
I would have posted sooner, but I've been on vacation :)

I thought of what you've suggested, but that doesn't work in all situations.  Enter, situation C!

First let's start with situation A as the base.  If one of the "islands" is a situation B, then there will be 3 boundaries and 1 group code 16.  But if situation B has more than one inside boundary, there's still just one group code 16.  So there could actually be 5, 10, or 200 boundaries inside B's "island", and it will still have just one group code 16.  Hence, I have no way of knowing how many separated "islands" each boundary may represent using the gc 16.

Treddin

  • Guest
Re: Detect multiply connected hatch
« Reply #4 on: June 22, 2009, 12:00:37 PM »
I suppose, if I had a routine that could tell me if a boundary was inside another boundary, that would let me filter out boundaries that are inside the gc 16 boundaries....

Treddin

  • Guest
Re: Detect multiply connected hatch
« Reply #5 on: June 24, 2009, 11:16:29 AM »
I'm going to attempt to combine something in this post: http://www.theswamp.org/index.php?topic=7785.0 with this problem.  using that post to help determine what parts are inside each boundary with a gc 16 val.

Spike Wilbury

  • Guest
Re: Detect multiply connected hatch
« Reply #6 on: June 24, 2009, 11:49:51 AM »
It will be (maybe) much easier for you, if you end up doing your code let say in C# and taking advantage that you can now write function that can be called from lisp too, and use the MPolygon class - for more about this class read the ObjectARX SDK help - AcDbMPolygon class

Treddin

  • Guest
Re: Detect multiply connected hatch
« Reply #7 on: June 24, 2009, 11:54:12 AM »
The problem is, it has to work in Acad 2000, AND intellicad. hence why I can't use, vl, vla or vlax functions