plancaliber-cad 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: plancaliber-cad
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: US imperial IRC clearance, roof pitch rafter, ANSI Z765 GLA, and AutoCAD R12 (AC1009) DXF geometry helpers from PlanCaliber.
|
|
5
|
+
Author: PlanCaliber
|
|
6
|
+
Author-email: clara@plancaliber.com
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: cad,dxf,floor-plan,irc,rafter,stairs,imperial,ansi-z765
|
|
9
|
+
Project-URL: Homepage, https://www.plancaliber.com
|
|
10
|
+
Project-URL: CAD Studio, https://www.plancaliber.com/
|
|
11
|
+
Project-URL: PDF to CAD Converter, https://www.plancaliber.com/pdf-to-cad-floor-plan
|
|
12
|
+
Project-URL: 50 US Code Calculators, https://www.plancaliber.com/calculators
|
|
13
|
+
Project-URL: 40 US CAD Templates, https://www.plancaliber.com/templates
|
|
14
|
+
Project-URL: 24x32 Cabin Floor Plans, https://www.plancaliber.com/templates/cabin_24x32
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# plancaliber-cad
|
|
24
|
+
|
|
25
|
+
Zero-dependency Python utilities for US residential imperial floor-plan math, IRC R311.7 stair rise/run geometry, roof pitch rafter multipliers, ANSI Z765 finished floor area checks, and minimal AutoCAD R12 (`AC1009`) ASCII `.DXF` (`$INSUNITS=1` US inches, 8 AIA layers) generation.
|
|
26
|
+
|
|
27
|
+
Built by [PlanCaliber](https://www.plancaliber.com), a US browser-based 2D/3D Floor Plan, AI Sketch/PDF-to-CAD, Site Plan & Blueprint Studio.
|
|
28
|
+
|
|
29
|
+
## Quickstart
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from plancaliber_cad import calc_roof_rafter, calc_irc_stair, build_minimal_r12_dxf
|
|
33
|
+
|
|
34
|
+
rafter = calc_roof_rafter(span_ft=24.0, pitch_in_per_ft=6.0, overhang_in=12.0)
|
|
35
|
+
print(rafter) # common rafter length in feet & inches
|
|
36
|
+
|
|
37
|
+
stair = calc_irc_stair(total_rise_in=108.0, tread_depth_in=10.5)
|
|
38
|
+
print(stair) # risers, riser height <= 7.75 in, total run
|
|
39
|
+
|
|
40
|
+
dxf_text = build_minimal_r12_dxf(width_ft=24.0, depth_ft=32.0)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Browser CAD & Interactive Calculators
|
|
44
|
+
|
|
45
|
+
- **Free Browser 2D/3D CAD Studio**: https://www.plancaliber.com/
|
|
46
|
+
- **PDF to CAD Floor Plan (.DXF)**: https://www.plancaliber.com/pdf-to-cad-floor-plan
|
|
47
|
+
- **24x32 Cabin Floor Plans**: https://www.plancaliber.com/templates/cabin_24x32
|
|
48
|
+
- **30x40 Barndominium Floor Plans**: https://www.plancaliber.com/templates/barndominium_30x40
|
|
49
|
+
- **Roof Pitch & Rafter Calculator**: https://www.plancaliber.com/calculators/roof-pitch-rafter-length-calculator
|
|
50
|
+
- **50 US Code Calculators**: https://www.plancaliber.com/calculators
|
|
51
|
+
|
|
52
|
+
## Honest Tiers
|
|
53
|
+
|
|
54
|
+
- **Free Studio Draft ($0)**: Full 2D/3D browser drafting, 2 free AI sketch/PDF/text-to-CAD scans/day, 40 US templates, 50 US code calculators, and instant `1400x1050` Watermarked Proof PNG export.
|
|
55
|
+
- **$9 Print Pass (One-Time)**: Unwatermarked 2-sheet `1/4"=1'-0"` vector PDF (`A-101`, `M-101`), `2400px` PNG, vector SVG, and unbranded 2D/3D share link.
|
|
56
|
+
- **$19+ CAD Packs**: Full 5-sheet vector PDF (`A-101`, `A-102`, `E-101`, `A-201`, `M-101`), layered AutoCAD R12 `.DXF` (`$INSUNITS=1` US inches, 8 AIA layers), 3D `.OBJ`/`.MTL`, and Framing & Drywall Takeoff `.CSV`. Backed by 14-day instant no-questions-asked refunds.
|
|
57
|
+
|
|
58
|
+
## Preliminary Planning Disclaimer
|
|
59
|
+
|
|
60
|
+
All calculations and exported CAD files are for preliminary space-planning and estimating only. Verify all dimensions, structural spans, setbacks, and local building codes with your Authority Having Jurisdiction (AHJ), a licensed Professional Engineer (PE), or qualified licensed trades before construction or permitting.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# plancaliber-cad
|
|
2
|
+
|
|
3
|
+
Zero-dependency Python utilities for US residential imperial floor-plan math, IRC R311.7 stair rise/run geometry, roof pitch rafter multipliers, ANSI Z765 finished floor area checks, and minimal AutoCAD R12 (`AC1009`) ASCII `.DXF` (`$INSUNITS=1` US inches, 8 AIA layers) generation.
|
|
4
|
+
|
|
5
|
+
Built by [PlanCaliber](https://www.plancaliber.com), a US browser-based 2D/3D Floor Plan, AI Sketch/PDF-to-CAD, Site Plan & Blueprint Studio.
|
|
6
|
+
|
|
7
|
+
## Quickstart
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from plancaliber_cad import calc_roof_rafter, calc_irc_stair, build_minimal_r12_dxf
|
|
11
|
+
|
|
12
|
+
rafter = calc_roof_rafter(span_ft=24.0, pitch_in_per_ft=6.0, overhang_in=12.0)
|
|
13
|
+
print(rafter) # common rafter length in feet & inches
|
|
14
|
+
|
|
15
|
+
stair = calc_irc_stair(total_rise_in=108.0, tread_depth_in=10.5)
|
|
16
|
+
print(stair) # risers, riser height <= 7.75 in, total run
|
|
17
|
+
|
|
18
|
+
dxf_text = build_minimal_r12_dxf(width_ft=24.0, depth_ft=32.0)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Browser CAD & Interactive Calculators
|
|
22
|
+
|
|
23
|
+
- **Free Browser 2D/3D CAD Studio**: https://www.plancaliber.com/
|
|
24
|
+
- **PDF to CAD Floor Plan (.DXF)**: https://www.plancaliber.com/pdf-to-cad-floor-plan
|
|
25
|
+
- **24x32 Cabin Floor Plans**: https://www.plancaliber.com/templates/cabin_24x32
|
|
26
|
+
- **30x40 Barndominium Floor Plans**: https://www.plancaliber.com/templates/barndominium_30x40
|
|
27
|
+
- **Roof Pitch & Rafter Calculator**: https://www.plancaliber.com/calculators/roof-pitch-rafter-length-calculator
|
|
28
|
+
- **50 US Code Calculators**: https://www.plancaliber.com/calculators
|
|
29
|
+
|
|
30
|
+
## Honest Tiers
|
|
31
|
+
|
|
32
|
+
- **Free Studio Draft ($0)**: Full 2D/3D browser drafting, 2 free AI sketch/PDF/text-to-CAD scans/day, 40 US templates, 50 US code calculators, and instant `1400x1050` Watermarked Proof PNG export.
|
|
33
|
+
- **$9 Print Pass (One-Time)**: Unwatermarked 2-sheet `1/4"=1'-0"` vector PDF (`A-101`, `M-101`), `2400px` PNG, vector SVG, and unbranded 2D/3D share link.
|
|
34
|
+
- **$19+ CAD Packs**: Full 5-sheet vector PDF (`A-101`, `A-102`, `E-101`, `A-201`, `M-101`), layered AutoCAD R12 `.DXF` (`$INSUNITS=1` US inches, 8 AIA layers), 3D `.OBJ`/`.MTL`, and Framing & Drywall Takeoff `.CSV`. Backed by 14-day instant no-questions-asked refunds.
|
|
35
|
+
|
|
36
|
+
## Preliminary Planning Disclaimer
|
|
37
|
+
|
|
38
|
+
All calculations and exported CAD files are for preliminary space-planning and estimating only. Verify all dimensions, structural spans, setbacks, and local building codes with your Authority Having Jurisdiction (AHJ), a licensed Professional Engineer (PE), or qualified licensed trades before construction or permitting.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "plancaliber-cad"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "US imperial IRC clearance, roof pitch rafter, ANSI Z765 GLA, and AutoCAD R12 (AC1009) DXF geometry helpers from PlanCaliber."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [{name = "PlanCaliber", email = "clara@plancaliber.com"}]
|
|
13
|
+
keywords = ["cad", "dxf", "floor-plan", "irc", "rafter", "stairs", "imperial", "ansi-z765"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 5 - Production/Stable",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Topic :: Scientific/Engineering"
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://www.plancaliber.com"
|
|
24
|
+
"CAD Studio" = "https://www.plancaliber.com/"
|
|
25
|
+
"PDF to CAD Converter" = "https://www.plancaliber.com/pdf-to-cad-floor-plan"
|
|
26
|
+
"50 US Code Calculators" = "https://www.plancaliber.com/calculators"
|
|
27
|
+
"40 US CAD Templates" = "https://www.plancaliber.com/templates"
|
|
28
|
+
"24x32 Cabin Floor Plans" = "https://www.plancaliber.com/templates/cabin_24x32"
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""US imperial floor-plan, IRC geometry, and AutoCAD R12 DXF helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
import math
|
|
5
|
+
from typing import Dict, Any
|
|
6
|
+
|
|
7
|
+
AIA_LAYERS = (
|
|
8
|
+
("A-WALL", 7),
|
|
9
|
+
("A-DOOR", 30),
|
|
10
|
+
("A-GLAZ", 4),
|
|
11
|
+
("A-CABN", 8),
|
|
12
|
+
("A-FURN", 9),
|
|
13
|
+
("E-POWR", 2),
|
|
14
|
+
("A-ROOM", 3),
|
|
15
|
+
("A-DIMS", 6),
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def calc_roof_rafter(
|
|
20
|
+
span_ft: float,
|
|
21
|
+
pitch_in_per_ft: float,
|
|
22
|
+
overhang_in: float = 12.0,
|
|
23
|
+
ridge_thickness_in: float = 1.5,
|
|
24
|
+
) -> Dict[str, Any]:
|
|
25
|
+
"""Compute common gable rafter slope length (feet & inches) for a US imperial roof."""
|
|
26
|
+
if span_ft <= 0 or pitch_in_per_ft < 0 or overhang_in < 0:
|
|
27
|
+
raise ValueError("Dimensions must be positive")
|
|
28
|
+
half_span_in = (span_ft * 12.0) / 2.0 - (ridge_thickness_in / 2.0)
|
|
29
|
+
total_run_in = half_span_in + overhang_in
|
|
30
|
+
slope_factor = math.hypot(12.0, pitch_in_per_ft) / 12.0
|
|
31
|
+
rafter_in = total_run_in * slope_factor
|
|
32
|
+
return {
|
|
33
|
+
"pitch": f"{pitch_in_per_ft:g}:12",
|
|
34
|
+
"slope_deg": round(math.degrees(math.atan(pitch_in_per_ft / 12.0)), 2),
|
|
35
|
+
"slope_factor": round(slope_factor, 4),
|
|
36
|
+
"total_run_in": round(total_run_in, 2),
|
|
37
|
+
"rafter_length_in": round(rafter_in, 2),
|
|
38
|
+
"rafter_length_ft": round(rafter_in / 12.0, 2),
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def calc_irc_stair(
|
|
43
|
+
total_rise_in: float,
|
|
44
|
+
tread_depth_in: float = 10.5,
|
|
45
|
+
max_riser_in: float = 7.75,
|
|
46
|
+
) -> Dict[str, Any]:
|
|
47
|
+
"""Compute IRC R311.7 residential stair riser count, riser height, and total run."""
|
|
48
|
+
if total_rise_in <= 0 or tread_depth_in < 10.0:
|
|
49
|
+
raise ValueError("total_rise_in must be > 0 and tread_depth_in >= 10.0 (IRC R311.7.5.2)")
|
|
50
|
+
risers = max(1, math.ceil(total_rise_in / max_riser_in))
|
|
51
|
+
riser_height = total_rise_in / risers
|
|
52
|
+
treads = max(0, risers - 1)
|
|
53
|
+
total_run_in = treads * tread_depth_in
|
|
54
|
+
return {
|
|
55
|
+
"risers": risers,
|
|
56
|
+
"treads": treads,
|
|
57
|
+
"riser_height_in": round(riser_height, 3),
|
|
58
|
+
"tread_depth_in": round(tread_depth_in, 2),
|
|
59
|
+
"total_run_in": round(total_run_in, 2),
|
|
60
|
+
"irc_r311_compliant": riser_height <= 7.75 and tread_depth_in >= 10.0,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def build_minimal_r12_dxf(width_ft: float, depth_ft: float) -> str:
|
|
65
|
+
"""Build a valid minimal AutoCAD R12 (AC1009) ASCII DXF perimeter in US inches ($INSUNITS=1)."""
|
|
66
|
+
if width_ft <= 0 or depth_ft <= 0:
|
|
67
|
+
raise ValueError("width_ft and depth_ft must be positive")
|
|
68
|
+
w = width_ft * 12.0
|
|
69
|
+
d = depth_ft * 12.0
|
|
70
|
+
lines = [
|
|
71
|
+
"0", "SECTION", "2", "HEADER",
|
|
72
|
+
"9", "$ACADVER", "1", "AC1009",
|
|
73
|
+
"9", "$INSUNITS", "70", "1",
|
|
74
|
+
"0", "ENDSEC",
|
|
75
|
+
"0", "SECTION", "2", "TABLES",
|
|
76
|
+
"0", "TABLE", "2", "LAYER", "70", str(len(AIA_LAYERS)),
|
|
77
|
+
]
|
|
78
|
+
for name, aci in AIA_LAYERS:
|
|
79
|
+
lines.extend(["0", "LAYER", "2", name, "70", "0", "62", str(aci), "6", "CONTINUOUS"])
|
|
80
|
+
lines.extend(["0", "ENDTAB", "0", "ENDSEC", "0", "SECTION", "2", "ENTITIES"])
|
|
81
|
+
pts = [(0.0, 0.0, w, 0.0), (w, 0.0, w, d), (w, d, 0.0, d), (0.0, d, 0.0, 0.0)]
|
|
82
|
+
for x1, y1, x2, y2 in pts:
|
|
83
|
+
lines.extend([
|
|
84
|
+
"0", "LINE", "8", "A-WALL",
|
|
85
|
+
"10", f"{x1:.2f}", "20", f"{y1:.2f}", "30", "0.00",
|
|
86
|
+
"11", f"{x2:.2f}", "21", f"{y2:.2f}", "31", "0.00",
|
|
87
|
+
])
|
|
88
|
+
lines.extend(["0", "ENDSEC", "0", "EOF"])
|
|
89
|
+
return "\n".join(lines) + "\n"
|