MPolygons

autocad_entity: autocad_mpolygon

MPolygon features represent AutoCAD mpolygon entities. They are composed of two-dimensional polyline loops defining areas that can be filled with line patterns or color gradients. Since loops are closed lines that are considered area boundaries, they are essentially polygons. Geometrically, mpolygons are a group of one or more closed boundaries, which may form a polygon, a donut, or several of each.

The loops of each mpolygon are closed, simple, continuous, and are not self-intersecting except at their endpoints. This is very similar to the definition of hatch entities.

The AutoCAD Reader creates features with varied geometry depending on the geometry of the loops that compose each mpolygon. Features created may be of polygon, donut or aggregate geometry, where the aggregates may contain a combination of donuts and polygons.

Note   The AutoCAD Reader has the following limitations when reading mpolygon features: one pattern is allowed per hatch, only one- or two-color gradients are supported, unclosed boundary loops are closed, and splines are not supported for boundary loops.

The AutoCAD writer has the following limitations when writing mpolygon features: the features must be closed, area features of polygon, donut, or aggregate geometry according to how they were created by the AutoCAD Reader. In addition, their geometry must be 2D or planar 3D with a constant Z, which can be stored as an elevation value.

Hatch patterns for mpolygons exist in external pattern files. See the feature representation information for hatch entities for more information on the use of predefined and custom hatch patterns in the ACAD and REALDWG format writers.

The following attributes may be set when reading mpolygons.

Attribute Name

Content

autocad_mpolygon_associative

Used only for reading

The flag indicating if the mpolygon is associative.

Range: 0 for no | 1 for yes

Default: 0

autocad_mpolygon_gradient_
angle

The angle of the gradient fill for the mpolygon feature in degrees.

Range: Any 64-bit floating point number

Default: 0

autocad_mpolygon_gradient_
color1

The first color used to interpolate a two-color gradient fill, or the single color used in a one-color gradient fill. Specified as a character string of comma-separated red, green and blue values.

Range: 0..255,0..255,0..255.

Default: None.

autocad_mpolygon_gradient_
color2

The second color used to interpolate a two-color gradient fill. Specified as a character string of comma-separated red, green and blue values.

Range: 0..255,0..255,0..255

Default: None.

autocad_mpolygon_gradient_
name

 

The name of the gradient. Must be a predefined value for predefined gradients. This is mandatory for mpolygons with gradients.

Range:

  • Curved
  • Cylinder
  • Hemispherical
  • Linear
  • Spherical
  • Invcurved
  • Invcylinder
  • Invhemispherical
  • Invspherical

Default: None

autocad_mpolygon_gradient_one_
color_mode

 

The flag indicating whether only one color should be used in gradient calculation. Gradients can be two colors, or one color with a luminance value set by autocad_mpolygon_shade_tint_value.

Range: 0 for no | 1 for yes

Default: 0

autocad_mpolygon_gradient_
shift

The interpolation value between the default and shifted values of the gradient's definition.

Range: 0..1

Default: None

autocad_mpolygon_gradient_
type

The type of the gradient.

Currently this is set to 0 for predefined gradient. In the future a value of 1 may be supported for user-defined gradients. This is mandatory for mpolygons with gradients.

Range: 0 for predefined | 1 for user-defined

Default: None

autocad_mpolygon_object_type

The type of the mpolygon. This is mandatory for mpolygons with gradients and patterns other than SOLID.

Range: 0 for classic mpolygon | 1 for color gradient

Default: 0

autocad_mpolygon_origin_point_x

The x-axis coordinate of the origin of the mpolygon in world coordinates.

Range: Any 64-bit floating point number

Default: 0

autocad_mpolygon_origin_point_y

The y-axis coordinate of the origin of the mpolygon in world coordinates.

Range: Any 64-bit floating point number

Default: 0.

autocad_mpolygon_offset_x

Used only for reading

The offset along the x-axis coordinate of the center point of the mpolygon extents in world coordinates.

Range: Any 64-bit floating point number

Default: 0

autocad_mpolygon_offset_y

Used only for reading

The offset along the y-axis coordinate of the center point of the mpolygon extents in world coordinates.

Range: Any 64-bit floating point number

Default: 0.

autocad_mpolygon_pattern_
angle

The angle of the pattern fill for the mpolygon feature in degrees.

Range: Any 64-bit floating point number

Default: 0

autocad_mpolygon_pattern_
double

The flag indicating if the mpolygon pattern is doubled by adding a second set of lines at 90 degrees to the first. This is only used for user-defined patterns.

Range: 0 for no | 1 for yes

Default: 0

autocad_mpolygon_pattern_name

 

The name of the pattern. May be a predefined value for predefined patterns, a predefined value for custom patterns, or any string for user-defined patterns.

Range: Pre-defined or custom pattern name | any string

Default: SOLID

autocad_mpolygon_pattern_
scale

This represents the scaled size of the pattern for pre-defined and custom-defined patterns.

Range: positive floating point value > 0

Default: 1

autocad_mpolygon_pattern_
space

This represents the space between the parallel lines of the mpolygon pattern. This is only used for user-defined patterns.

Range: positive floating point value > 0

Default: 1

autocad_mpolygon_pattern_type

The type of the mpolygon pattern. Custom-defined patterns are pre-created patterns that must be present in the location of the predefined patterns. This is mandatory for mpolygons with patterns other than SOLID.

Range: 0 for user-defined | 1 for pre-defined | 2 for custom-defined

Default: 1

autocad_mpolygon_pixel_size

The size of pixels for intersection and ray casting when drawing the mpolygon.

Range: positive floating point value > 0

Default: 1

autocad_mpolygon_shade_tint_
value

The luminance value of the mpolygon. If the mpolygon has a gradient and is using one color mode, this value is applied to the first color.

Range: 0.0..1.0

Default: 0