Class CADLoader
Provides functionality to load and process CAD documents, converting their entities into drawable line batches and text representations.
Namespace: Evergine.Runtimes.CAD
Assembly: Evergine.Runtimes.CAD.dll
Syntax
public class CADLoader
Methods
LoadCadDocument(CadDocument, bool, int, float, float?, bool, GraphicsContext)
Loads a CAD document asynchronously, processes its entities, and returns a tuple containing a DrawableLineBatch for line rendering and an array of CADText for text entities.
Declaration
public static Task<(DrawableLineBatch, CADText[])> LoadCadDocument(CadDocument cadDocument, bool isDXF, int precision, float maxMTextSize = 0.5, float? customMetersPerUnit = null, bool enableTextRendering = true, GraphicsContext graphicsContext = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CadDocument | cadDocument | The CAD document to load and process. |
| bool | isDXF | Indicates whether the document is in DXF format. |
| int | precision | The precision to use for polygonal approximations of curves. |
| float | maxMTextSize | The maximum size for MText entities (used for DXF). Default is 0.5f. |
| float? | customMetersPerUnit | The manual scale factor to re-size. |
| bool | enableTextRendering | Indicates whether text rendering is enabled. |
| GraphicsContext | graphicsContext | The graphics context used for rendering operations. If null, the line batch will create it. |
Returns
| Type | Description |
|---|---|
| Task<(DrawableLineBatch, CADText[])> | A task that represents the asynchronous operation. The task result contains a tuple with:
|
ProcessEntity(Entity, int, ref DrawableLineBatch, List<CADText>, bool, Insert, Transform, float, bool)
Processes a single CAD entity, converting it into drawable line batches and/or text representations. Handles transformation, color, and layer inheritance, as well as nested inserts and hatches.
Declaration
public static void ProcessEntity(Entity entity, int precision, ref DrawableLineBatch linebatch, List<CADText> texts, bool isDXF, Insert parentInsert = null, Transform parentTransform = null, float maxMTextSize = 0.5, bool enableTextRendering = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | entity | The CAD entity to process. |
| int | precision | The precision to use for polygonal approximations of curves. |
| DrawableLineBatch | linebatch | Reference to the DrawableLineBatch where lines will be added. |
| List<CADText> | texts | A list to collect CADText objects for text entities. |
| bool | isDXF | Indicates whether the document is in DXF format. |
| Insert | parentInsert | Optional parent ACadSharp.Entities.Insert for nested transformations. Default is null. |
| Transform | parentTransform | Optional parent transformation matrix. Default is null. |
| float | maxMTextSize | The maximum size for MText entities (used for DXF). Default is 0.5f. |
| bool | enableTextRendering | Indicates whether text rendering is enabled. |