Initial commit

This commit is contained in:
U-C4N
2026-04-27 12:20:57 +03:00
commit 7b121ab416
49 changed files with 9904 additions and 0 deletions
@@ -0,0 +1,72 @@
# Example: Basic Room Drawing
Create a simple room with walls, a door opening, dimensions, and labels.
## Setup
```
drawing_new()
layer_create("WALLS", color=7)
layer_create("DOORS", color=3)
layer_create("DIMENSIONS", color=1)
layer_create("TEXT", color=2)
```
## Draw Walls (5m x 4m room)
```
layer_set_current("WALLS")
# Outer walls as rectangle
entity_create_rectangle(x1=0, y1=0, x2=5000, y2=4000)
# Returns: {handle: "A1", type: "LWPOLYLINE", ...}
```
## Add Door Opening (0.9m wide on south wall)
```
layer_set_current("DOORS")
# Door opening represented as an arc (90° swing)
entity_create_arc(cx=2000, cy=0, radius=900, start_angle=0, end_angle=90)
# Returns: {handle: "B2", type: "ARC", ...}
# Door frame lines
entity_create_line(x1=2000, y1=0, x2=2000, y2=100)
entity_create_line(x1=2900, y1=0, x2=2900, y2=100)
```
## Add Dimensions
```
layer_set_current("DIMENSIONS")
# Room width
dimension_linear(x1=0, y1=0, x2=5000, y2=0, dim_x=2500, dim_y=-500)
# Room height
dimension_linear(x1=5000, y1=0, x2=5000, y2=4000, dim_x=5500, dim_y=2000)
# Door width
dimension_linear(x1=2000, y1=0, x2=2900, y2=0, dim_x=2450, dim_y=-300)
```
## Add Labels
```
layer_set_current("TEXT")
entity_create_text(text="BEDROOM", x=2500, y=2000, height=200)
entity_create_text(text="5000", x=2500, y=-800, height=150)
```
## Verify and Save
```
analysis_entity_stats()
# Expected: ~8 entities across 4 layers
validation_check(["empty_layers"])
# Should report no issues
drawing_save("C:/drawings/room.dxf")
```
@@ -0,0 +1,100 @@
# Example: Apartment Floor Plan
Create a 3-room apartment: living room, bedroom, kitchen with doors and windows.
## Setup
```
drawing_new()
template_apply_layers("architectural")
# Creates: WALLS, DOORS, WINDOWS, DIMENSIONS, TEXT, FURNITURE, PLUMBING, HVAC
```
## Draw Exterior Walls (12m x 8m)
```
layer_set_current("WALLS")
# Exterior boundary
entity_create_rectangle(x1=0, y1=0, x2=12000, y2=8000)
```
## Draw Interior Walls
```
# Living/bedroom divider (vertical at x=5000)
entity_create_line(x1=5000, y1=0, x2=5000, y2=8000)
# Kitchen divider (horizontal at y=4000, from x=5000)
entity_create_line(x1=5000, y1=4000, x2=12000, y2=4000)
```
## Add Doors (0.9m openings)
```
layer_set_current("DOORS")
# Living room door (south wall)
entity_create_arc(cx=2000, cy=0, radius=900, start_angle=0, end_angle=90)
# Bedroom door (on divider wall)
entity_create_arc(cx=5000, cy=2000, radius=900, start_angle=90, end_angle=180)
# Kitchen door (on divider wall)
entity_create_arc(cx=7000, cy=4000, radius=900, start_angle=0, end_angle=90)
```
## Add Windows (1.5m wide)
```
layer_set_current("WINDOWS")
# Living room window (north wall)
entity_create_line(x1=1500, y1=8000, x2=3000, y2=8000, color=5)
# Bedroom window (east wall)
entity_create_line(x1=12000, y1=5500, x2=12000, y2=7000, color=5)
# Kitchen window (east wall)
entity_create_line(x1=12000, y1=1500, x2=12000, y2=3000, color=5)
```
## Add Dimensions
```
layer_set_current("DIMENSIONS")
# Overall width
dimension_linear(x1=0, y1=0, x2=12000, y2=0, dim_x=6000, dim_y=-800)
# Overall height
dimension_linear(x1=0, y1=0, x2=0, y2=8000, dim_x=-800, dim_y=4000)
# Room widths
dimension_linear(x1=0, y1=8000, x2=5000, y2=8000, dim_x=2500, dim_y=8500)
dimension_linear(x1=5000, y1=8000, x2=12000, y2=8000, dim_x=8500, dim_y=8500)
```
## Add Room Labels
```
layer_set_current("TEXT")
entity_create_text(text="LIVING ROOM", x=2500, y=4000, height=300)
entity_create_mtext(text="12.0 m²", x=2500, y=3500, width=2000, height=200)
entity_create_text(text="BEDROOM", x=8500, y=6000, height=300)
entity_create_mtext(text="28.0 m²", x=8500, y=5500, width=2000, height=200)
entity_create_text(text="KITCHEN", x=8500, y=2000, height=300)
entity_create_mtext(text="28.0 m²", x=8500, y=1500, width=2000, height=200)
```
## Verify
```
analysis_entity_stats()
analysis_layer_stats()
validation_check(["empty_layers", "zero_length"])
drawing_save("C:/drawings/apartment.dxf")
```
@@ -0,0 +1,105 @@
# Example: Flange with Bolt Pattern
Create a circular flange plate with bolt holes using polar array.
## Setup
```
drawing_new()
template_apply_layers("mechanical")
# Creates: OUTLINE, CENTERLINE, HIDDEN, DIMENSIONS, NOTES, SECTION, DETAIL
```
## Draw Flange Outline
```
layer_set_current("OUTLINE")
# Outer flange circle (diameter 200mm)
entity_create_circle(cx=0, cy=0, radius=100)
# Returns: {handle: "F1", ...}
# Inner bore (diameter 50mm)
entity_create_circle(cx=0, cy=0, radius=25)
# Returns: {handle: "F2", ...}
```
## Add Centerlines
```
layer_set_current("CENTERLINE")
# Horizontal centerline
entity_create_line(x1=-120, y1=0, x2=120, y2=0, linetype="CENTER")
# Vertical centerline
entity_create_line(x1=0, y1=-120, x2=0, y2=120, linetype="CENTER")
```
## Create Bolt Hole Pattern
```
layer_set_current("OUTLINE")
# First bolt hole on bolt circle (PCD = 150mm diameter, so radius = 75mm)
entity_create_circle(cx=75, cy=0, radius=6)
# Returns: {handle: "B1", ...}
# Create polar array: 6 holes evenly spaced
entity_array_polar(handle="B1", center_x=0, center_y=0, count=6, angle=360)
# Returns: list of 5 new handles (original + 5 copies = 6 total)
```
## Add Dimensions
```
layer_set_current("DIMENSIONS")
# Outer diameter
dimension_diameter(x1=-100, y1=0, x2=100, y2=0)
# Inner bore diameter
dimension_diameter(x1=-25, y1=0, x2=25, y2=0)
# Bolt circle diameter
dimension_radius(center_x=0, center_y=0, radius=75, angle=45)
# Bolt hole diameter
dimension_diameter(x1=69, y1=0, x2=81, y2=0)
```
## Add Notes
```
layer_set_current("NOTES")
entity_create_mtext(
text="FLANGE PLATE\P6x M12 HOLES ON PCD 150\PMATERIAL: SS304",
x=-120, y=-140,
width=240, height=5
)
```
## Create Block from Bolt Hole
```
# Select all bolt hole entities and create a reusable block
# (Get handles from the array result)
block_create_from_entities(
name="BOLT_PATTERN_6x150",
handles=["B1", ...], # all bolt hole handles
base_x=0, base_y=0
)
```
## Verify
```
analysis_entity_stats()
# Expected: circles, lines, dimensions, mtext
analysis_bounding_box()
# Expected: approximately -120 to 120 in both axes
drawing_save("C:/drawings/flange.dxf")
```