Code Red => AutoLISP (Vanilla / Visual) => Topic started by: well20152016 on December 05, 2018, 12:53:38 AM
Title: Acquisition of three-point coordinates of a mpolygon
Post by: well20152016 on December 05, 2018, 12:53:38 AM
Acquisition of three-point coordinates of a mpolygon
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: kirby on December 05, 2018, 01:31:29 PM
Refer to DXF manual on Hatch / MPolygon entity and Bounadry Path Data
Relevant Dxf codes are as follows:
91 is the number of loops for the entire Mpolygon. You have 1 'loop'. Note Mpolygon is very similar to hatch, can have separate 'loops' or 'regions' or holes, or holes with islands.
92 is the boundary type (2=polyline)
93 is number of edges
10 are transformed coordinates The orientation of the DXF 10 coordinates determine if the molygon boundary is an Outer boundary (counter-clockwise, normal acad/cartesian angular measurement) or Inner (Clockwise). caution - this sometimes isn't true!?!
11 is the basepoint coordinate (or 'offset vector'). Add this vector to each of the DXF 10 coordinates to calculate the 'real' WCS coordinate. Having this coordinate permits the DXF 10 values to be smaller numbers. Reducing memory can be a big deal for hatch pattern fills (and mpolygons with hatch pattern) where each pattern line segment must be stored.
72 'has bulge' >0 indicates that polyarcs are present.
73 > 0 indicated polyline used to create mpolygon is closed (vs. force closed, where last coordinate = first coordinate). Mpolygons are always closed by default (unlike polylines)
70 is solid fill (1 = solid fill)
76 is hatch style (1 = predefined)
63 is pattern fill colour as Acad Colour Index (1 = red)
Also note that mpoly can have arc segments similar to a polyline. If this is the case, a DXF code 42 (bulge) follows each DXF 10 coordinate (even for the straight line segments) eg. 10 x y z 42 bulge or 0.0 10 x y z 42 bulge or 0.0 etc...
partial DXF extract of your triangular shaped mpolygon is as follows:
Unfortunately, unlike Region entities, Boolean operations (Union, Intersect, Subtract) will not work with Mpolygons.
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: kdub_nz on December 05, 2018, 01:37:59 PM
Looks like a well researched response Kirby
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: kirby on December 05, 2018, 03:05:55 PM
Thanks.
My context is a rural drainage guideline / study to simplify a bunch of rural land cover polygons (agricultural, prairie, forest, marsh, etc), clip them to a polyline catchment boundary, then work out the fraction of each land cover type within the catchment boundary. This would be used to estimate average hydrologic properties for the catchment based on the individual land cover characteristics.
Converting complex mpolygons to regions for the Boolean operations then back to mpolygons is this week's mental exercise...
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: ribarm on December 24, 2018, 08:22:38 AM
I don't know, but you can temporarily explode MPOLYGON to LWPOLYLINE and get vertices data from there...
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: well20152016 on December 24, 2018, 10:42:38 AM
Thank you, ribarm.
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: ribarm on December 24, 2018, 11:31:06 AM
OK... Now tell me it seems that MPOLYGON isn't standard AutoCAD entity... BTW. dumping data from VLA-OBJECT - MPOLYGON gives data where there are no Coordinates property... So my question : How did you get (create) MPOLYGON when there is no such entity under DRAW menu of AutoCAD?
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: well20152016 on December 24, 2018, 11:36:47 AM
MPOLYGON is a professional software generated, I want to post-processing.
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: didier on December 26, 2018, 08:13:45 AM
Coucou
Mpolygon is a native object drawing with Acad MAP
Amicalement
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: gile on December 26, 2018, 09:51:14 AM
You can 'entmake' MPolygon entities in AutoCAD Vanilla (requires acMPolygonObjXX.dbx to be loaded), see the following example.
Some times ago I tried to write some .NET custom command (http://www.theswamp.org/index.php?topic=29152.msg347035#msg347035) to convert Vanilla curves to MPolygons.
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: ribarm on December 26, 2018, 11:01:55 AM
Thanks gile, it works...
Title: Re: Acquisition of three-point coordinates of a mpolygon
Post by: Grrr1337 on December 26, 2018, 11:15:21 AM