2D Drawings¶
Multi-format (SVG, DXF, FCMacro) 2D technical drawing generation with dimension annotations for magnetic core shapes.
Module¶
OpenMagneticsVirtualBuilder.drawing_2d ¶
2D Drawing Generation Module for OpenMagneticsVirtualBuilder.
Provides multi-format (SVG, DXF, FCMacro) 2D technical drawings with dimension annotations for magnetic core shapes.
Enums¶
OpenMagneticsVirtualBuilder.drawing_2d.ViewPlane ¶
Bases: Enum
OpenMagneticsVirtualBuilder.drawing_2d.ViewType ¶
Bases: Enum
Data Classes¶
OpenMagneticsVirtualBuilder.drawing_2d.DimensionAnnotation
dataclass
¶
OpenMagneticsVirtualBuilder.drawing_2d.DrawingView
dataclass
¶
Functions¶
OpenMagneticsVirtualBuilder.drawing_2d.cross_section_at_plane ¶
Slice a 3D shape at the given plane and offset.
Uses OCP BRepAlgoAPI_Section to create a cross-section wire.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
CadQuery shape/compound to slice. |
required | |
plane
|
ViewPlane
|
Which principal plane to slice on. |
required |
offset
|
float
|
Offset from origin along the plane normal. |
0.0
|
Returns:
| Type | Description |
|---|---|
|
A CadQuery Compound of the section edges, or None on failure. |
OpenMagneticsVirtualBuilder.drawing_2d.create_dimension_svg ¶
create_dimension_svg(starting_coordinates, ending_coordinates, dimension_type, dimension_label, view_x, view_y, colors, dimension_font_size=20, dimension_line_thickness=1, label_offset=0, label_alignment=0, arrow_size=6, arrow_length=15)
Create SVG markup for a dimension annotation.
This is a pure-SVG implementation ported from FreeCADBuilder._create_dimension_svg.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
starting_coordinates
|
[x, y] start point in shape coordinates. |
required | |
ending_coordinates
|
[x, y] end point in shape coordinates. |
required | |
dimension_type
|
'DistanceX' or 'DistanceY'. |
required | |
dimension_label
|
Text label for the dimension. |
required | |
view_x
|
X origin of the view in SVG space. |
required | |
view_y
|
Y origin of the view in SVG space. |
required | |
colors
|
Dict with 'dimension_color' key. |
required | |
dimension_font_size
|
Font size for labels. |
20
|
|
dimension_line_thickness
|
Stroke width for dimension lines. |
1
|
|
label_offset
|
Offset for placing the dimension line away from the shape. |
0
|
|
label_alignment
|
Additional alignment offset for the label text. |
0
|
|
arrow_size
|
Width of arrowhead. |
6
|
|
arrow_length
|
Length of arrowhead. |
15
|
Returns:
| Type | Description |
|---|---|
|
SVG string for the dimension annotation. |