cadguide-cli 1.0.0__py3-none-any.whl
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.
cadguide_cli/__init__.py
ADDED
cadguide_cli/main.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
CADGuide CLI - Command Line Tool
|
|
4
|
+
https://cadguide.tools
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import os
|
|
9
|
+
import math
|
|
10
|
+
import argparse
|
|
11
|
+
|
|
12
|
+
DWG_HEADER_MAP = {
|
|
13
|
+
"AC1032": ("AutoCAD 2018 - 2026", "2018+", True),
|
|
14
|
+
"AC1027": ("AutoCAD 2013 - 2017", "2013", True),
|
|
15
|
+
"AC1024": ("AutoCAD 2010 - 2012", "2010", False),
|
|
16
|
+
"AC1021": ("AutoCAD 2007 - 2009", "2007", False),
|
|
17
|
+
"AC1018": ("AutoCAD 2004 - 2006", "2004", False),
|
|
18
|
+
"AC1015": ("AutoCAD 2000 - 2002", "2000", False),
|
|
19
|
+
"AC1014": ("AutoCAD Release 14", "R14", False),
|
|
20
|
+
"AC1012": ("AutoCAD Release 13", "R13", False),
|
|
21
|
+
"AC1009": ("AutoCAD Release 11 / 12", "R11/R12", False),
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def inspect_dwg(filepath: str):
|
|
25
|
+
if not os.path.exists(filepath):
|
|
26
|
+
print(f"❌ Error: File not found: {filepath}", file=sys.stderr)
|
|
27
|
+
sys.exit(1)
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
with open(filepath, "rb") as f:
|
|
31
|
+
header_bytes = f.read(6)
|
|
32
|
+
|
|
33
|
+
header_str = header_bytes.decode("ascii", errors="ignore")
|
|
34
|
+
|
|
35
|
+
print("=" * 60)
|
|
36
|
+
print(" 🔍 CADGuide DWG Binary Header Inspector")
|
|
37
|
+
print(" 🌐 https://cadguide.tools/toolbox/dwg-version-checker")
|
|
38
|
+
print("=" * 60)
|
|
39
|
+
print(f"File: {filepath}")
|
|
40
|
+
print(f"Magic Code: {header_str}")
|
|
41
|
+
|
|
42
|
+
if header_str in DWG_HEADER_MAP:
|
|
43
|
+
releases, year, is_modern = DWG_HEADER_MAP[header_str]
|
|
44
|
+
print(f"Compatible CAD Releases: {releases}")
|
|
45
|
+
print(f"Internal Format Era: {year}")
|
|
46
|
+
print(f"Modern 64-bit Object Stream: {'Yes (Supported)' if is_modern else 'Legacy Format'}")
|
|
47
|
+
print("=" * 60)
|
|
48
|
+
print("✅ Verified locally with 0 cloud uploads. 100% private.")
|
|
49
|
+
else:
|
|
50
|
+
print("⚠️ Unknown or non-standard DWG header magic bytes.")
|
|
51
|
+
print("Note: Valid AutoCAD drawing files must start with AC10xx.")
|
|
52
|
+
print("=" * 60)
|
|
53
|
+
except Exception as e:
|
|
54
|
+
print(f"❌ Error reading file: {e}", file=sys.stderr)
|
|
55
|
+
sys.exit(1)
|
|
56
|
+
|
|
57
|
+
def calculate_kfactor(thickness: float, radius: float, angle: float, k: float):
|
|
58
|
+
# BA = (pi / 180) * angle * (radius + k * thickness)
|
|
59
|
+
rad = math.radians(angle)
|
|
60
|
+
ba = rad * (radius + (k * thickness))
|
|
61
|
+
# Setback = tan(angle/2) * (thickness + radius)
|
|
62
|
+
setback = math.tan(math.radians(angle / 2)) * (thickness + radius)
|
|
63
|
+
# Bend Deduction = 2 * Setback - BA
|
|
64
|
+
bd = (2 * setback) - ba
|
|
65
|
+
|
|
66
|
+
print("=" * 60)
|
|
67
|
+
print(" 📐 CADGuide Sheet Metal K-Factor Calculator")
|
|
68
|
+
print(" 🌐 https://cadguide.tools/toolbox/k-factor-calculator")
|
|
69
|
+
print("=" * 60)
|
|
70
|
+
print(f"Inputs: Thickness={thickness}mm, Inside Radius={radius}mm, Angle={angle}°, K-Factor={k}")
|
|
71
|
+
print("-" * 60)
|
|
72
|
+
print(f"Bend Allowance (BA) : {ba:.4f} mm")
|
|
73
|
+
print(f"Outside Setback (OSB): {setback:.4f} mm")
|
|
74
|
+
print(f"Bend Deduction (BD) : {bd:.4f} mm")
|
|
75
|
+
print("=" * 60)
|
|
76
|
+
|
|
77
|
+
def dwg_check_entry():
|
|
78
|
+
if len(sys.argv) < 2:
|
|
79
|
+
print("Usage: dwg-check <path_to_dwg_file>")
|
|
80
|
+
sys.exit(1)
|
|
81
|
+
inspect_dwg(sys.argv[1])
|
|
82
|
+
|
|
83
|
+
def cli_entry():
|
|
84
|
+
parser = argparse.ArgumentParser(
|
|
85
|
+
description="CADGuide CLI - Offline CAD tools and calculators (https://cadguide.tools)"
|
|
86
|
+
)
|
|
87
|
+
subparsers = parser.add_subparsers(dest="command", help="Available subcommands")
|
|
88
|
+
|
|
89
|
+
# Subcommand: dwg
|
|
90
|
+
dwg_parser = subparsers.add_parser("dwg", help="Inspect binary header of AutoCAD DWG file")
|
|
91
|
+
dwg_parser.add_argument("file", help="Path to .dwg drawing file")
|
|
92
|
+
|
|
93
|
+
# Subcommand: kfactor
|
|
94
|
+
k_parser = subparsers.add_parser("kfactor", help="Calculate sheet metal K-Factor and Bend Allowance")
|
|
95
|
+
k_parser.add_argument("--thickness", "-t", type=float, required=True, help="Material thickness (mm)")
|
|
96
|
+
k_parser.add_argument("--radius", "-r", type=float, required=True, help="Inside bend radius (mm)")
|
|
97
|
+
k_parser.add_argument("--angle", "-a", type=float, default=90.0, help="Bend angle in degrees (default: 90)")
|
|
98
|
+
k_parser.add_argument("--k", "-k", type=float, default=0.44, help="K-Factor value (default: 0.44 for mild steel)")
|
|
99
|
+
|
|
100
|
+
# Subcommand: compare
|
|
101
|
+
compare_parser = subparsers.add_parser("compare", help="Compare CAD software alternatives")
|
|
102
|
+
compare_parser.add_argument("software_a", help="First software name (e.g., autocad)")
|
|
103
|
+
compare_parser.add_argument("software_b", help="Second software name (e.g., gstarcad)")
|
|
104
|
+
|
|
105
|
+
args = parser.parse_args()
|
|
106
|
+
|
|
107
|
+
if args.command == "dwg":
|
|
108
|
+
inspect_dwg(args.file)
|
|
109
|
+
elif args.command == "kfactor":
|
|
110
|
+
calculate_kfactor(args.thickness, args.radius, args.angle, args.k)
|
|
111
|
+
elif args.command == "compare":
|
|
112
|
+
print(f"🔗 Compare {args.software_a} vs {args.software_b} at https://cadguide.tools/compare/{args.software_a}-vs-{args.software_b}")
|
|
113
|
+
else:
|
|
114
|
+
parser.print_help()
|
|
115
|
+
|
|
116
|
+
if __name__ == "__main__":
|
|
117
|
+
cli_entry()
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cadguide-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Instant zero-upload AutoCAD DWG binary header inspector, sheet metal K-factor calculator, and CAD comparison CLI.
|
|
5
|
+
Author-email: CADGuide Engineering Team <contact@cadguide.tools>
|
|
6
|
+
Project-URL: Homepage, https://cadguide.tools
|
|
7
|
+
Project-URL: Documentation, https://cadguide.tools/guides
|
|
8
|
+
Project-URL: DWG Version Checker, https://cadguide.tools/toolbox/dwg-version-checker
|
|
9
|
+
Project-URL: K-Factor Calculator, https://cadguide.tools/toolbox/k-factor-calculator
|
|
10
|
+
Project-URL: Source Code, https://cadguide.tools
|
|
11
|
+
Project-URL: Bug Tracker, https://cadguide.tools/about
|
|
12
|
+
Keywords: cad,autocad,dwg,dwg-parser,k-factor,sheet-metal,bim,engineering
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# cadguide-cli
|
|
22
|
+
|
|
23
|
+
> **Zero-upload, client-side AutoCAD DWG binary header inspector, sheet metal K-factor calculator, and engineering toolbox.**
|
|
24
|
+
|
|
25
|
+
[](https://pypi.org/project/cadguide-cli/)
|
|
26
|
+
[](https://opensource.org/licenses/MIT)
|
|
27
|
+
[](https://cadguide.tools)
|
|
28
|
+
|
|
29
|
+
Developed by the [CADGuide.tools](https://cadguide.tools) engineering team.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## ⚡ Key Features
|
|
34
|
+
|
|
35
|
+
- 🔍 **Instant DWG Version Check**: Read the first 6 bytes of binary header in `< 3ms` without uploading confidential IP to third-party servers.
|
|
36
|
+
- 📐 **Sheet Metal K-Factor Calculator**: Calculate Bend Allowance ($BA$) and Bend Deduction ($BD$) for precision air bending and bottoming dies.
|
|
37
|
+
- 🧭 **Cross-CAD Shortcut Matcher**: Quick lookup for AutoCAD, GstarCAD, ZWCAD, BricsCAD, FreeCAD, and Rhino command mappings.
|
|
38
|
+
- 🛡️ **100% Private & Offline**: Operates purely on local file streams without telemetry or cloud uploads.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 📦 Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install cadguide-cli
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🚀 Quick Start
|
|
51
|
+
|
|
52
|
+
### 1. Inspect AutoCAD DWG Header Version
|
|
53
|
+
```bash
|
|
54
|
+
# Check a local DWG file
|
|
55
|
+
cadguide dwg sample_drawing.dwg
|
|
56
|
+
|
|
57
|
+
# Or using the dedicated shortcut command
|
|
58
|
+
dwg-check sample_drawing.dwg
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Output:**
|
|
62
|
+
```text
|
|
63
|
+
============================================================
|
|
64
|
+
🔍 CADGuide DWG Binary Header Inspector
|
|
65
|
+
============================================================
|
|
66
|
+
File: sample_drawing.dwg
|
|
67
|
+
Header Code: AC1032
|
|
68
|
+
Release Year: 2018+
|
|
69
|
+
Compatible CAD: AutoCAD 2018, 2021, 2024, 2026
|
|
70
|
+
Format Status: Modern 64-bit Object Streams (Supported)
|
|
71
|
+
============================================================
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 2. Sheet Metal K-Factor Calculation
|
|
75
|
+
```bash
|
|
76
|
+
# Calculate bend allowance for thickness=2.0mm, radius=2.0mm, angle=90, K-Factor=0.44
|
|
77
|
+
cadguide kfactor --thickness 2.0 --radius 2.0 --angle 90 --k 0.44
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 3. Quick CAD Alternative Comparison
|
|
81
|
+
```bash
|
|
82
|
+
cadguide compare autocad gstarcad
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 🔗 Official Links & Web Tools
|
|
88
|
+
|
|
89
|
+
- 🌐 **Interactive Web Version**: [https://cadguide.tools](https://cadguide.tools)
|
|
90
|
+
- 🧮 **DWG Version Web Checker**: [https://cadguide.tools/toolbox/dwg-version-checker](https://cadguide.tools/toolbox/dwg-version-checker)
|
|
91
|
+
- 📏 **K-Factor Calculator**: [https://cadguide.tools/toolbox/k-factor-calculator](https://cadguide.tools/toolbox/k-factor-calculator)
|
|
92
|
+
- 📚 **CAD Administrator Guides**: [https://cadguide.tools/guides](https://cadguide.tools/guides)
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 📄 License
|
|
97
|
+
|
|
98
|
+
MIT License © 2026 [CADGuide.tools](https://cadguide.tools)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
cadguide_cli/__init__.py,sha256=tUpNF1QTC-OC9wpEb3NDbyt5iGUrbhDq90-T7b2pmeg,156
|
|
2
|
+
cadguide_cli/main.py,sha256=QA_Bb7PZp8gRhm2psyvwIHtW1PsbYUYxbi3bSH-32Y4,4821
|
|
3
|
+
cadguide_cli-1.0.0.dist-info/METADATA,sha256=-vEh7A535-uxNlO2GLxEnAhciAjGp8LJBM6IrAWsVUs,3780
|
|
4
|
+
cadguide_cli-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
5
|
+
cadguide_cli-1.0.0.dist-info/entry_points.txt,sha256=0Jw-8QgYCTcvk4HH_IugFu-Dk5n4HYFr_hvOUhwppDQ,103
|
|
6
|
+
cadguide_cli-1.0.0.dist-info/top_level.txt,sha256=sosQobh0o249y3_EdATAHgzLwKMaIe5JyNQZv-5dcLk,13
|
|
7
|
+
cadguide_cli-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cadguide_cli
|