Author Topic: Acquisition of three-point coordinates of a mpolygon  (Read 164 times)

0 Members and 1 Guest are viewing this topic.

well20152016

  • Newt
  • Posts: 58
Acquisition of three-point coordinates of a mpolygon
« on: December 05, 2018, 12:53:38 AM »
Acquisition of three-point coordinates of a mpolygon

kirby

  • Newt
  • Posts: 31
Re: Acquisition of three-point coordinates of a mpolygon
« Reply #1 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:
Code: [Select]
(71 . 1)
 (91 . 1)
 (92 . 2)
 (73 . 0)
 (72 . 0)
 (93 . 3)
 (10 -169.233 -15.2715 0.0)
 (10 169.233 -253.277 0.0)
 (10 157.309 253.277 0.0)
 (76 . 1)
 (63 . 1)
 (11 -27170.6 305.577 0.0)


Unfortunately, unlike Region entities, Boolean operations (Union, Intersect, Subtract) will not work with Mpolygons.

kdub

  • SuperMod
  • Swamp Rat
  • Posts: 1138
  • class keyThumper<T>:ILazy<T>
Re: Acquisition of three-point coordinates of a mpolygon
« Reply #2 on: December 05, 2018, 01:37:59 PM »
Looks like a well researched response Kirby
called Kerry in my other life

Sometimes the question is more important than the answer.

kirby

  • Newt
  • Posts: 31
Re: Acquisition of three-point coordinates of a mpolygon
« Reply #3 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...

well20152016

  • Newt
  • Posts: 58
Re: Acquisition of three-point coordinates of a mpolygon
« Reply #4 on: December 05, 2018, 07:16:27 PM »
((-1 . <图元名: 7ffffb09260>) (0 . "MPOLYGON") (330 . <图元名: 7ffffb06820>) (5
. "9B3E") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1) (100
. "AcDbMPolygon") (70 . 1) (10 0.0 0.0 -51.9042) (210 -0.134866 -0.198512
0.970775) (2 . "SOLID") (71 . 1) (91 . 1) (92 . 2) (73 . 0) (72 . 0) (93 . 3)
(10 -169.233 -15.2715 0.0) (10 169.233 -253.277 0.0) (10 157.309 253.277 0.0)
(76 . 1) (63 . 1) (11 -27170.6 305.577 0.0) (99 . 0) (450 . 0) (451 . 0) (460 .
0.0) (461 . 0.0) (452 . 0) (462 . 0.0) (453 . 0) (470 . ""))