Table of Contents

Method Explode

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

Explode()

Gets the entities an MLINE breaks into, as AutoCAD's Explode, as ezdxf's virtual_entities gives them, from the geometry its record holds and the MLINESTYLE it names: for an open one its start caps, then a LINE for each element along each segment, the miter lines at each joint where its style draws them, then its end caps. A cap across the elements is two LINEs, from the outer elements to the point halfway between them; an outer cap a half circle from the outer element on the left round to the one on the right, two quarter ARCs where their colours differ; inner arcs join each pair of inner elements, the second and the last but one, the third and the last but two, as AutoCAD's MLSTYLE draws them. A LINE has the element's colour and linetype, an ARC its colour, each the MLINE's look besides, its true colour left off. An element broken along a segment (MLEDIT) gives a LINE for each piece left, and caps the MLINE leaves off (flags 4 and 8 of its group 71) are not drawn; a line of no length is left out, and the fill of a filled style too. The MLINE of the style Standard, two elements 0.5 either side, through four vertices gives six LINEs. A MESH not smoothed (level 0) breaks into a 3DFACE for each face, in the order of its list of faces, each with the MESH's look and every edge drawn, as AutoCAD's EXPLODE breaks one and ezdxf's MeshBuilder renders it: a face of four corners a 3DFACE of them, of three one ending on its third; a cube 10 by 10 by 10 of eight vertices and six faces gives six 3DFACEs. A face of more than four corners breaks into a strip of triangles, as AutoCAD 2021's Explode breaks one: from two corners on, the rest taken by turns from the far end and the near one, each triangle after the first the other way round; from the face's first two corners, or from its last two back the other way where it faces into a closed MESH whose other faces face out, as AutoCAD turns every face of a closed mesh to face out. The face of the corners 0 to 4 alone, or one of an open MESH, gives the triangles (0, 1, 4), (2, 4, 1) and (4, 2, 3), and as the base of a pyramid facing up into it (4, 3, 0), (2, 0, 3) and (0, 2, 1); of 0 to 5, (0, 1, 5), (2, 5, 1), (5, 2, 4) and (3, 4, 2) alone and (5, 4, 0), (3, 0, 4), (0, 3, 1) and (2, 1, 3) as such a base. A face of four corners or three that faces into a closed MESH is turned as well, its corners read from its last back, as AutoCAD 2021 explodes one: the square base (0, 1, 2, 3) of a pyramid facing up into it gives the 3DFACE of (3, 2, 1, 0), a side (0, 3, 4) facing in (4, 3, 0); every other is given as the file holds it. A face given a colour of its own (an override of the MESH, its subentity 1 the first face) keeps it on its 3DFACEs, as AutoCAD keeps it. A MESH smoothed, and one that gives a face a material or a transparency of its own, or an edge or a vertex anything of its own, is refused. A REGION breaks into the curves of its loops, a hole before the loop it is cut from, as AutoCAD's Explode gives them: a box 40 by 30 with a circular hole gives a circle and four lines, a stadium two lines and two arcs, each with the REGION's look; a REGION of several faces (the union of two regions far apart) breaks into a REGION for each face, as AutoCAD's does, and its arcs run counter-clockwise about the face's normal. Any other type refuses: a 3DSOLID, a BODY and a surface, which AutoCAD breaks with its solid modeler, and every type AutoCAD does not break.

public override IReadOnlyList<DxfEntity> Explode()

Returns

IReadOnlyList<DxfEntity>

The entities, in no file, to be added to a drawing by AppendEntity(DxfEntity).

Exceptions

InvalidOperationException

Thrown for an MLINE whose drawing has no MLINESTYLE of its handle or name, or whose vertices hold another count of elements than its style; and for a MESH missing the count of its vertices, faces, edges or creases, or holding fewer than it counts, as ezdxf refuses one, or with a face of fewer than three corners, past the end of its list of faces or naming a vertex it has not.

NotSupportedException

Thrown for a MESH smoothed, or with overrides other than the colours of its faces, for a REGION whose ACIS data is not readable flat faces (GetRegionShape() gives null), and for any other type.