Conversion: Region to Hatch

Conversion: Region to Hatch

Anonymous
Not applicable
730 Views
5 Replies
Message 1 of 6

Conversion: Region to Hatch

Anonymous
Not applicable
Anyone know of a simple way to do it? I know AutoCAD can do it internally cause in the Hatch interface you can select a region as an object to hatch.

But I haven't seen anything exposed in ARX. Of course I know I can explode the region and get its curves and yadayada, but it can get pretty complex what with islands, disparate areas, etc. There's no guarantee that a region given to me will be nice and simple.

So just wanted to see if there were a quick way to do it before I implement something extreme. Message was edited by: dougk16
0 Likes
731 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
AcDbMPolygon class ?
0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks for the suggestion, but is there any specific function of this class I should look at? I didn't see anything useful in the docs.

Anyway, I've since implemented my own function for this. I may post it after it's seen more extensive testing.
0 Likes
Message 4 of 6

Anonymous
Not applicable
Well, I have used this class, for other purposes like testing if a point is inside of a closed polyline or when a polyline selfcross, etc... and noticed the use of hatch in them, so that's why I posted.

But, for what I see now, there is no form of using as boundaries directly the regions.... 😞
0 Likes
Message 5 of 6

Anonymous
Not applicable
Yea, oddly enough you can convert from a hatch to a region using AcDbHatch::getRegionArea, but not vice versa.

Just something that might be helpful for you, maybe you already know about it...but you could use getRegionArea and then do a Brep on the region to determine if a point is within any closed boundary. It may be simpler for your needs than using AcDbMPolygon.

Thanks anyway for your suggestion...I noticed some other things in AcDbMPolygon that might be useful for me for other things.
0 Likes
Message 6 of 6

Anonymous
Not applicable
Thanks!

Yes, I know about that and have used the Brep too, I end up writing my own function for the internal point testing, since there is a bug in the AcDbMPolygon class for AutoCAD 2007 by the way 🙂

Have fun.
0 Likes