cwapi3d-starter 0.1.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.
- cwapi3d_starter-0.1.0/.github/workflows/publish.yml +27 -0
- cwapi3d_starter-0.1.0/.gitignore +8 -0
- cwapi3d_starter-0.1.0/PKG-INFO +94 -0
- cwapi3d_starter-0.1.0/README.md +75 -0
- cwapi3d_starter-0.1.0/pyproject.toml +36 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/__init__.py +1 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/cli.py +36 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/generator.py +145 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/.gitignore +8 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/README.md +33 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/entry_point_py.template +15 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/example_geometry.py +45 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/main_py.template +11 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/pyproject.toml +16 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/test_placeholder.py +7 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/vscode/launch.json +19 -0
- cwapi3d_starter-0.1.0/src/cwapi3d_starter/templates/vscode/settings.json +6 -0
- cwapi3d_starter-0.1.0/uv.lock +115 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-publish:
|
|
9
|
+
name: Build and publish to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment:
|
|
12
|
+
name: pypi
|
|
13
|
+
url: https://pypi.org/p/cwapi3d-starter
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v3
|
|
22
|
+
|
|
23
|
+
- name: Build package
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Publish to PyPI
|
|
27
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cwapi3d-starter
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Project scaffolding for cwapi3d Python projects
|
|
5
|
+
Project-URL: Homepage, https://github.com/yourusername/cwapi3d-starter
|
|
6
|
+
Project-URL: Repository, https://github.com/yourusername/cwapi3d-starter
|
|
7
|
+
Project-URL: Issues, https://github.com/yourusername/cwapi3d-starter/issues
|
|
8
|
+
Author-email: Your Name <your.email@example.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
15
|
+
Requires-Python: >=3.12
|
|
16
|
+
Requires-Dist: rich>=13.0.0
|
|
17
|
+
Requires-Dist: typer>=0.12.0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# cwapi3d-starter
|
|
21
|
+
|
|
22
|
+
Project scaffolding CLI for cwapi3d users.
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
- [uv](https://github.com/astral-sh/uv) installed.
|
|
27
|
+
- Python 3.12+
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
### Global Installation (User)
|
|
32
|
+
|
|
33
|
+
You can install the tool globally to use it anywhere on your system.
|
|
34
|
+
|
|
35
|
+
**Using uv (Recommended):**
|
|
36
|
+
```bash
|
|
37
|
+
# Run from the project root
|
|
38
|
+
uv tool install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Using pip:**
|
|
42
|
+
```bash
|
|
43
|
+
# Run from the project root
|
|
44
|
+
pip install .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### From Source (Development)
|
|
48
|
+
|
|
49
|
+
1. **Clone the repository:**
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com/Brunner246/cwapi3d-starter.git
|
|
52
|
+
cd cwapi3d-starter
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. **Install dependencies:**
|
|
56
|
+
```bash
|
|
57
|
+
uv sync
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
### If installed globally
|
|
63
|
+
|
|
64
|
+
Once installed, you can run the `cwapi3d-starter` command directly from anywhere:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cwapi3d-starter <project_name> --directory <target_directory>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### If running from source
|
|
71
|
+
|
|
72
|
+
To generate a new project using the CLI from the source:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv run cwapi3d-starter <project_name> --directory <target_directory>
|
|
76
|
+
```
|
|
77
|
+
Or simply:
|
|
78
|
+
```bash
|
|
79
|
+
uv run cwapi3d-starter <project_name> # Directory defaults to <project_name> in current folder
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Example
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Generate a project named "my_script" in the specified directory
|
|
86
|
+
# Note: name and directory name need to be the same name for the generated project to work correctly.
|
|
87
|
+
uv run cwapi3d-starter my_script --directory "D:\cadwork\userprofil_2026\3d\API.x64\my_script"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This will generate a ready-to-use project structure for developing Python scripts using the `cwapi3d` Python stubs for cadwork 3d, including:
|
|
91
|
+
- Virtual environment setup (`uv`)
|
|
92
|
+
- VS Code configuration (`settings.json`)
|
|
93
|
+
- Sample code (`main.py`, `example_geometry.py`)
|
|
94
|
+
- Python package structure
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# cwapi3d-starter
|
|
2
|
+
|
|
3
|
+
Project scaffolding CLI for cwapi3d users.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- [uv](https://github.com/astral-sh/uv) installed.
|
|
8
|
+
- Python 3.12+
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
### Global Installation (User)
|
|
13
|
+
|
|
14
|
+
You can install the tool globally to use it anywhere on your system.
|
|
15
|
+
|
|
16
|
+
**Using uv (Recommended):**
|
|
17
|
+
```bash
|
|
18
|
+
# Run from the project root
|
|
19
|
+
uv tool install .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Using pip:**
|
|
23
|
+
```bash
|
|
24
|
+
# Run from the project root
|
|
25
|
+
pip install .
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### From Source (Development)
|
|
29
|
+
|
|
30
|
+
1. **Clone the repository:**
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/Brunner246/cwapi3d-starter.git
|
|
33
|
+
cd cwapi3d-starter
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. **Install dependencies:**
|
|
37
|
+
```bash
|
|
38
|
+
uv sync
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
### If installed globally
|
|
44
|
+
|
|
45
|
+
Once installed, you can run the `cwapi3d-starter` command directly from anywhere:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cwapi3d-starter <project_name> --directory <target_directory>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### If running from source
|
|
52
|
+
|
|
53
|
+
To generate a new project using the CLI from the source:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
uv run cwapi3d-starter <project_name> --directory <target_directory>
|
|
57
|
+
```
|
|
58
|
+
Or simply:
|
|
59
|
+
```bash
|
|
60
|
+
uv run cwapi3d-starter <project_name> # Directory defaults to <project_name> in current folder
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Example
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Generate a project named "my_script" in the specified directory
|
|
67
|
+
# Note: name and directory name need to be the same name for the generated project to work correctly.
|
|
68
|
+
uv run cwapi3d-starter my_script --directory "D:\cadwork\userprofil_2026\3d\API.x64\my_script"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This will generate a ready-to-use project structure for developing Python scripts using the `cwapi3d` Python stubs for cadwork 3d, including:
|
|
72
|
+
- Virtual environment setup (`uv`)
|
|
73
|
+
- VS Code configuration (`settings.json`)
|
|
74
|
+
- Sample code (`main.py`, `example_geometry.py`)
|
|
75
|
+
- Python package structure
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cwapi3d-starter"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Project scaffolding for cwapi3d Python projects"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Your Name", email = "your.email@example.com" }
|
|
10
|
+
]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Topic :: Software Development :: Code Generators",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"typer>=0.12.0",
|
|
20
|
+
"rich>=13.0.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/yourusername/cwapi3d-starter"
|
|
25
|
+
Repository = "https://github.com/yourusername/cwapi3d-starter"
|
|
26
|
+
Issues = "https://github.com/yourusername/cwapi3d-starter/issues"
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
cwapi3d-starter = "cwapi3d_starter.cli:app"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["hatchling"]
|
|
33
|
+
build-backend = "hatchling.build"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/cwapi3d_starter"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
from .generator import ProjectGenerator
|
|
6
|
+
|
|
7
|
+
app = typer.Typer(help="cwapi3d Project Scaffolding CLI")
|
|
8
|
+
console = Console()
|
|
9
|
+
|
|
10
|
+
@app.command()
|
|
11
|
+
def init(
|
|
12
|
+
project_name: str = typer.Argument(..., help="Name of the project to create"),
|
|
13
|
+
directory: Optional[Path] = typer.Option(
|
|
14
|
+
None, "--directory", "-d", help="Target directory (defaults to project name)"
|
|
15
|
+
),
|
|
16
|
+
):
|
|
17
|
+
"""
|
|
18
|
+
Initialize a new cwapi3d project.
|
|
19
|
+
"""
|
|
20
|
+
if directory is None:
|
|
21
|
+
target_dir = Path.cwd() / project_name
|
|
22
|
+
else:
|
|
23
|
+
target_dir = directory
|
|
24
|
+
|
|
25
|
+
if target_dir.exists() and any(target_dir.iterdir()):
|
|
26
|
+
console.print(f"[bold red]Error:[/] Directory '{target_dir}' is not empty.")
|
|
27
|
+
raise typer.Exit(code=1)
|
|
28
|
+
|
|
29
|
+
generator = ProjectGenerator(project_name, target_dir)
|
|
30
|
+
generator.generate()
|
|
31
|
+
|
|
32
|
+
def main():
|
|
33
|
+
app()
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
main()
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import subprocess
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from string import Template
|
|
6
|
+
import importlib.resources
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
from rich.panel import Panel
|
|
9
|
+
|
|
10
|
+
console = Console()
|
|
11
|
+
|
|
12
|
+
class ProjectGenerator:
|
|
13
|
+
def __init__(self, project_name: str, target_dir: Path):
|
|
14
|
+
self.project_name = project_name
|
|
15
|
+
self.target_dir = target_dir
|
|
16
|
+
self.package_name = project_name.lower().replace("-", "_").replace(" ", "_")
|
|
17
|
+
self.files = importlib.resources.files("cwapi3d_starter").joinpath("templates")
|
|
18
|
+
|
|
19
|
+
def display_success(self):
|
|
20
|
+
console.print(Panel.fit(
|
|
21
|
+
f"[bold green]Successfully created {self.project_name}![/bold green]\n\n"
|
|
22
|
+
f"cd {self.project_name}\n"
|
|
23
|
+
f"uv sync\n"
|
|
24
|
+
f"code .",
|
|
25
|
+
title="Next Steps"
|
|
26
|
+
))
|
|
27
|
+
|
|
28
|
+
def generate(self):
|
|
29
|
+
console.print(f"[bold green]Creating project: {self.project_name}[/bold green]")
|
|
30
|
+
|
|
31
|
+
self.create_directories()
|
|
32
|
+
self.create_files()
|
|
33
|
+
|
|
34
|
+
self.init_git()
|
|
35
|
+
self.setup_environment()
|
|
36
|
+
|
|
37
|
+
self.display_success()
|
|
38
|
+
|
|
39
|
+
def create_directories(self):
|
|
40
|
+
console.print("Creating directories...")
|
|
41
|
+
dirs = [
|
|
42
|
+
self.target_dir,
|
|
43
|
+
self.target_dir / "src" / self.package_name,
|
|
44
|
+
self.target_dir / "src" / self.package_name / "cad",
|
|
45
|
+
self.target_dir / ".vscode",
|
|
46
|
+
self.target_dir / "tests",
|
|
47
|
+
self.target_dir / "docs",
|
|
48
|
+
]
|
|
49
|
+
for d in dirs:
|
|
50
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
51
|
+
|
|
52
|
+
def _read_template(self, *parts: str) -> str:
|
|
53
|
+
"""Reads a template file relative to the templates directory."""
|
|
54
|
+
template_file = self.files
|
|
55
|
+
for part in parts:
|
|
56
|
+
template_file = template_file.joinpath(part)
|
|
57
|
+
|
|
58
|
+
if hasattr(template_file, "is_file") and not template_file.is_file():
|
|
59
|
+
raise FileNotFoundError(f"Template {'/'.join(parts)} not found.")
|
|
60
|
+
|
|
61
|
+
return template_file.read_text(encoding="utf-8")
|
|
62
|
+
|
|
63
|
+
def _write_file(self, path: Path, content: str):
|
|
64
|
+
console.print(f"Writing {path.relative_to(self.target_dir)}...")
|
|
65
|
+
path.write_text(content, encoding="utf-8")
|
|
66
|
+
|
|
67
|
+
def create_files(self):
|
|
68
|
+
context = {
|
|
69
|
+
"project_name": self.project_name,
|
|
70
|
+
"package_name": self.package_name,
|
|
71
|
+
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
self._write_file(
|
|
75
|
+
self.target_dir / "pyproject.toml",
|
|
76
|
+
Template(self._read_template("pyproject.toml")).substitute(context)
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
self._write_file(
|
|
80
|
+
self.target_dir / "README.md",
|
|
81
|
+
Template(self._read_template("README.md")).substitute(context)
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
self._write_file(
|
|
85
|
+
self.target_dir / ".gitignore",
|
|
86
|
+
self._read_template(".gitignore")
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
self._write_file(
|
|
90
|
+
self.target_dir / f"{self.project_name}.py",
|
|
91
|
+
Template(self._read_template("entry_point_py.template")).substitute(context)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
(self.target_dir / "src" / self.package_name / "__init__.py").touch()
|
|
95
|
+
|
|
96
|
+
self._write_file(
|
|
97
|
+
self.target_dir / "src" / self.package_name / "main.py",
|
|
98
|
+
Template(self._read_template("main_py.template")).substitute(context)
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
self._write_file(
|
|
102
|
+
self.target_dir / "src" / self.package_name / "cad" / "example_geometry.py",
|
|
103
|
+
self._read_template("example_geometry.py")
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
self._write_file(
|
|
107
|
+
self.target_dir / ".vscode" / "settings.json",
|
|
108
|
+
self._read_template("vscode", "settings.json")
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
# self._write_file(
|
|
112
|
+
# self.target_dir / ".vscode" / "launch.json",
|
|
113
|
+
# self._read_template("vscode", "launch.json")
|
|
114
|
+
# )
|
|
115
|
+
|
|
116
|
+
self._write_file(
|
|
117
|
+
self.target_dir / "tests" / "test_placeholder.py",
|
|
118
|
+
self._read_template("test_placeholder.py")
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
(self.target_dir / "docs" / "README.md").touch()
|
|
122
|
+
|
|
123
|
+
def init_git(self):
|
|
124
|
+
console.print("Initializing git repository...")
|
|
125
|
+
try:
|
|
126
|
+
subprocess.run(["git", "init"], cwd=self.target_dir, check=False)
|
|
127
|
+
except FileNotFoundError:
|
|
128
|
+
console.print("[yellow]Warning: git command not found. Skipping git init.[/yellow]")
|
|
129
|
+
except Exception as e:
|
|
130
|
+
console.print(f"[yellow]Warning: git init failed: {e}[/yellow]")
|
|
131
|
+
|
|
132
|
+
def setup_environment(self):
|
|
133
|
+
try:
|
|
134
|
+
subprocess.run(["uv", "--version"], capture_output=True, check=True)
|
|
135
|
+
except Exception:
|
|
136
|
+
console.print("[yellow]Warning: 'uv' not found. Skipping environment setup.[/yellow]")
|
|
137
|
+
return
|
|
138
|
+
|
|
139
|
+
console.print("Creating virtual environment...")
|
|
140
|
+
try:
|
|
141
|
+
subprocess.run(["uv", "venv"], cwd=self.target_dir, check=True)
|
|
142
|
+
console.print("Installing dependencies...")
|
|
143
|
+
subprocess.run(["uv", "sync"], cwd=self.target_dir, check=True)
|
|
144
|
+
except Exception as e:
|
|
145
|
+
console.print(f"[yellow]Warning: environment setup failed: {e}[/yellow]")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# $project_name
|
|
2
|
+
|
|
3
|
+
This project was generated with `cwapi3d-starter`.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Ensure you have [uv](https://github.com/astral-sh/uv) installed.
|
|
8
|
+
|
|
9
|
+
1. Initialize the environment and install dependencies:
|
|
10
|
+
```bash
|
|
11
|
+
uv sync
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. Activate the environment:
|
|
15
|
+
- Windows: `.venv\Scripts\activate`
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
To run the example script:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv run python -m scripts.run_example
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or directly with Python in the active environment:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python scripts/run_example.py
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Development
|
|
32
|
+
|
|
33
|
+
This project uses `cwapi3d` for cadwork 3d. The stubs provide auto-completion in VS Code.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
current_dir = Path(__file__).resolve().parent
|
|
5
|
+
source_dir = Path(__file__).parent.absolute() / "src"
|
|
6
|
+
site_packages_dir = Path(__file__).parent / ".venv" / "Lib" / "site-packages"
|
|
7
|
+
|
|
8
|
+
sys.path.insert(0, str(current_dir))
|
|
9
|
+
sys.path.insert(0, str(source_dir))
|
|
10
|
+
sys.path.insert(0, str(site_packages_dir))
|
|
11
|
+
|
|
12
|
+
from $package_name.main import main
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import element_controller as ec
|
|
2
|
+
import cadwork
|
|
3
|
+
from cadwork import point_3d
|
|
4
|
+
|
|
5
|
+
def create_beams_example():
|
|
6
|
+
# --- METHOD 1: Using Vectors ---
|
|
7
|
+
width = 200.0
|
|
8
|
+
height = 400.0
|
|
9
|
+
length = 3000.0
|
|
10
|
+
|
|
11
|
+
start_pt_vec = point_3d(0, 0, 0)
|
|
12
|
+
|
|
13
|
+
# Define the local X axis (Direction of the beam's length)
|
|
14
|
+
x_dir = point_3d(1, 0, 0)
|
|
15
|
+
|
|
16
|
+
# Define the local Z axis (Direction of the beam's height/depth)
|
|
17
|
+
z_dir = point_3d(0, 0, 1)
|
|
18
|
+
|
|
19
|
+
beam_id_vectors = ec.create_rectangular_beam_vectors(
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
length,
|
|
23
|
+
start_pt_vec,
|
|
24
|
+
x_dir,
|
|
25
|
+
z_dir
|
|
26
|
+
)
|
|
27
|
+
print(f"Created beam with vectors: {beam_id_vectors}")
|
|
28
|
+
|
|
29
|
+
# --- METHOD 2: Using Points ---
|
|
30
|
+
p1 = point_3d(0, 1000, 0) # Start point
|
|
31
|
+
p2 = point_3d(3000, 1000, 0) # End point
|
|
32
|
+
|
|
33
|
+
# The 3rd point defines the beam's internal Z-axis orientation
|
|
34
|
+
# (usually "up" relative to the beam)
|
|
35
|
+
p3 = point_3d(0, 1000, 100)
|
|
36
|
+
|
|
37
|
+
beam_id_points = ec.create_rectangular_beam_points(
|
|
38
|
+
width,
|
|
39
|
+
height,
|
|
40
|
+
p1,
|
|
41
|
+
p2,
|
|
42
|
+
p3
|
|
43
|
+
)
|
|
44
|
+
print(f"Created beam with points: {beam_id_points}")
|
|
45
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "$project_name"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A cwapi3d Python project"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=$python_version"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"cwapi3d",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
[build-system]
|
|
12
|
+
requires = ["hatchling"]
|
|
13
|
+
build-backend = "hatchling.build"
|
|
14
|
+
|
|
15
|
+
[tool.hatch.build.targets.wheel]
|
|
16
|
+
packages = ["src/$package_name"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Python: Current File",
|
|
6
|
+
"type": "python",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"program": "${file}",
|
|
9
|
+
"console": "integratedTerminal"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "Run Project Entry Point",
|
|
13
|
+
"type": "python",
|
|
14
|
+
"request": "launch",
|
|
15
|
+
"program": "${workspaceFolder}/${workspaceFolderBasename}.py",
|
|
16
|
+
"console": "integratedTerminal"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
version = 1
|
|
2
|
+
revision = 3
|
|
3
|
+
requires-python = ">=3.12"
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "annotated-doc"
|
|
7
|
+
version = "0.0.4"
|
|
8
|
+
source = { registry = "https://pypi.org/simple" }
|
|
9
|
+
sdist = { url = "https://files.pythonhosted.org/packages/57/ba/046ceea27344560984e26a590f90bc7f4a75b06701f653222458922b558c/annotated_doc-0.0.4.tar.gz", hash = "sha256:fbcda96e87e9c92ad167c2e53839e57503ecfda18804ea28102353485033faa4", size = 7288, upload-time = "2025-11-10T22:07:42.062Z" }
|
|
10
|
+
wheels = [
|
|
11
|
+
{ url = "https://files.pythonhosted.org/packages/1e/d3/26bf1008eb3d2daa8ef4cacc7f3bfdc11818d111f7e2d0201bc6e3b49d45/annotated_doc-0.0.4-py3-none-any.whl", hash = "sha256:571ac1dc6991c450b25a9c2d84a3705e2ae7a53467b5d111c24fa8baabbed320", size = 5303, upload-time = "2025-11-10T22:07:40.673Z" },
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "click"
|
|
16
|
+
version = "8.3.1"
|
|
17
|
+
source = { registry = "https://pypi.org/simple" }
|
|
18
|
+
dependencies = [
|
|
19
|
+
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
|
20
|
+
]
|
|
21
|
+
sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065, upload-time = "2025-11-15T20:45:42.706Z" }
|
|
22
|
+
wheels = [
|
|
23
|
+
{ url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274, upload-time = "2025-11-15T20:45:41.139Z" },
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "colorama"
|
|
28
|
+
version = "0.4.6"
|
|
29
|
+
source = { registry = "https://pypi.org/simple" }
|
|
30
|
+
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
|
31
|
+
wheels = [
|
|
32
|
+
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "cwapi3d-starter"
|
|
37
|
+
version = "0.1.0"
|
|
38
|
+
source = { editable = "." }
|
|
39
|
+
dependencies = [
|
|
40
|
+
{ name = "rich" },
|
|
41
|
+
{ name = "typer" },
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[package.metadata]
|
|
45
|
+
requires-dist = [
|
|
46
|
+
{ name = "rich", specifier = ">=13.0.0" },
|
|
47
|
+
{ name = "typer", specifier = ">=0.12.0" },
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[[package]]
|
|
51
|
+
name = "markdown-it-py"
|
|
52
|
+
version = "4.0.0"
|
|
53
|
+
source = { registry = "https://pypi.org/simple" }
|
|
54
|
+
dependencies = [
|
|
55
|
+
{ name = "mdurl" },
|
|
56
|
+
]
|
|
57
|
+
sdist = { url = "https://files.pythonhosted.org/packages/5b/f5/4ec618ed16cc4f8fb3b701563655a69816155e79e24a17b651541804721d/markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3", size = 73070, upload-time = "2025-08-11T12:57:52.854Z" }
|
|
58
|
+
wheels = [
|
|
59
|
+
{ url = "https://files.pythonhosted.org/packages/94/54/e7d793b573f298e1c9013b8c4dade17d481164aa517d1d7148619c2cedbf/markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147", size = 87321, upload-time = "2025-08-11T12:57:51.923Z" },
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "mdurl"
|
|
64
|
+
version = "0.1.2"
|
|
65
|
+
source = { registry = "https://pypi.org/simple" }
|
|
66
|
+
sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" }
|
|
67
|
+
wheels = [
|
|
68
|
+
{ url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" },
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "pygments"
|
|
73
|
+
version = "2.19.2"
|
|
74
|
+
source = { registry = "https://pypi.org/simple" }
|
|
75
|
+
sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631, upload-time = "2025-06-21T13:39:12.283Z" }
|
|
76
|
+
wheels = [
|
|
77
|
+
{ url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" },
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "rich"
|
|
82
|
+
version = "14.3.3"
|
|
83
|
+
source = { registry = "https://pypi.org/simple" }
|
|
84
|
+
dependencies = [
|
|
85
|
+
{ name = "markdown-it-py" },
|
|
86
|
+
{ name = "pygments" },
|
|
87
|
+
]
|
|
88
|
+
sdist = { url = "https://files.pythonhosted.org/packages/b3/c6/f3b320c27991c46f43ee9d856302c70dc2d0fb2dba4842ff739d5f46b393/rich-14.3.3.tar.gz", hash = "sha256:b8daa0b9e4eef54dd8cf7c86c03713f53241884e814f4e2f5fb342fe520f639b", size = 230582, upload-time = "2026-02-19T17:23:12.474Z" }
|
|
89
|
+
wheels = [
|
|
90
|
+
{ url = "https://files.pythonhosted.org/packages/14/25/b208c5683343959b670dc001595f2f3737e051da617f66c31f7c4fa93abc/rich-14.3.3-py3-none-any.whl", hash = "sha256:793431c1f8619afa7d3b52b2cdec859562b950ea0d4b6b505397612db8d5362d", size = 310458, upload-time = "2026-02-19T17:23:13.732Z" },
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[[package]]
|
|
94
|
+
name = "shellingham"
|
|
95
|
+
version = "1.5.4"
|
|
96
|
+
source = { registry = "https://pypi.org/simple" }
|
|
97
|
+
sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310, upload-time = "2023-10-24T04:13:40.426Z" }
|
|
98
|
+
wheels = [
|
|
99
|
+
{ url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" },
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
[[package]]
|
|
103
|
+
name = "typer"
|
|
104
|
+
version = "0.24.1"
|
|
105
|
+
source = { registry = "https://pypi.org/simple" }
|
|
106
|
+
dependencies = [
|
|
107
|
+
{ name = "annotated-doc" },
|
|
108
|
+
{ name = "click" },
|
|
109
|
+
{ name = "rich" },
|
|
110
|
+
{ name = "shellingham" },
|
|
111
|
+
]
|
|
112
|
+
sdist = { url = "https://files.pythonhosted.org/packages/f5/24/cb09efec5cc954f7f9b930bf8279447d24618bb6758d4f6adf2574c41780/typer-0.24.1.tar.gz", hash = "sha256:e39b4732d65fbdcde189ae76cf7cd48aeae72919dea1fdfc16593be016256b45", size = 118613, upload-time = "2026-02-21T16:54:40.609Z" }
|
|
113
|
+
wheels = [
|
|
114
|
+
{ url = "https://files.pythonhosted.org/packages/4a/91/48db081e7a63bb37284f9fbcefda7c44c277b18b0e13fbc36ea2335b71e6/typer-0.24.1-py3-none-any.whl", hash = "sha256:112c1f0ce578bfb4cab9ffdabc68f031416ebcc216536611ba21f04e9aa84c9e", size = 56085, upload-time = "2026-02-21T16:54:41.616Z" },
|
|
115
|
+
]
|