python-cad-tools 0.1.25__py3-none-any.whl → 0.1.26__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.
@@ -9,6 +9,14 @@ from reportlab.pdfgen.canvas import Canvas
9
9
 
10
10
  from .primitives import DrawingScene
11
11
 
12
+ #: (stroke RGB, width in points, dash pattern or None) for each line layer.
13
+ _LINE_STYLES: dict[str, tuple[tuple[float, float, float], float, tuple[float, ...] | None]] = {
14
+ "VISIBLE": ((0.05, 0.05, 0.05), 1.0, None),
15
+ "HIDDEN": ((0.45, 0.45, 0.45), 0.6, (4, 2)),
16
+ "REFERENCE": ((0.3, 0.3, 0.6), 0.5, (8, 2, 2, 2)),
17
+ "ANNOTATION_SECTION": ((0.05, 0.05, 0.05), 1.4, None),
18
+ }
19
+
12
20
 
13
21
  def write_pdf(scenes: list[DrawingScene], path: Path) -> Path:
14
22
  path.parent.mkdir(parents=True, exist_ok=True)
@@ -47,13 +55,18 @@ def _draw_scene(canvas: Canvas, scene: DrawingScene, page_size: tuple[float, flo
47
55
  if polyline.closed:
48
56
  path.close()
49
57
  canvas.drawPath(path)
50
- canvas.saveState()
51
- canvas.setStrokeColorRGB(0.1, 0.35, 0.55)
52
- canvas.setDash(7, 3)
53
- canvas.setLineWidth(0.8)
58
+ # Lines follow drawing convention by layer, as the DXF layers do: visible
59
+ # edges and section cuts are solid; only hidden edges are dashed and
60
+ # reference lines dash-dotted.
54
61
  for line in scene.lines:
62
+ canvas.saveState()
63
+ style = _LINE_STYLES.get(line.layer, _LINE_STYLES["VISIBLE"])
64
+ canvas.setStrokeColorRGB(*style[0])
65
+ canvas.setLineWidth(style[1])
66
+ if style[2]:
67
+ canvas.setDash(list(style[2]))
55
68
  canvas.line(*point(line.start), *point(line.end))
56
- canvas.restoreState()
69
+ canvas.restoreState()
57
70
  canvas.saveState()
58
71
  canvas.setStrokeColorRGB(0.25, 0.25, 0.25)
59
72
  canvas.setFillColorRGB(0.15, 0.15, 0.15)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-cad-tools
3
- Version: 0.1.25
3
+ Version: 0.1.26
4
4
  Summary: Typed, headless Python tooling for CAD/BIM models and artifacts
5
5
  Author: Brandon Benge
6
6
  License: AGPL-3.0-only
@@ -213,7 +213,7 @@ python_cad_tools/exporters/drawings/__init__.py,sha256=fVYW-6UJy-Ts2XSTG_ajjyuTb
213
213
  python_cad_tools/exporters/drawings/annotations.py,sha256=l1HjTFK33J7j_UCEivaZUKV44xPxhyKsOAlrN-JRftg,18627
214
214
  python_cad_tools/exporters/drawings/dxf.py,sha256=6QdPcrnF_s6SP2TatUwaI_C7C7O7i9G5FQFd6xj-7cg,5138
215
215
  python_cad_tools/exporters/drawings/model.py,sha256=XNHaCxOXmTRYN9MleriYnvZxRZraEAER_fPsvjUrkBQ,2855
216
- python_cad_tools/exporters/drawings/pdf.py,sha256=KL1Z1Zl2qwnqQHpbiTiXX5CgDwVAK5FnWGb5vJPP5jo,5169
216
+ python_cad_tools/exporters/drawings/pdf.py,sha256=DhPX1wQlP8ArNTXKwz75WMfNLKvzUX-9JS80TVL14yQ,5865
217
217
  python_cad_tools/exporters/drawings/primitives.py,sha256=hsDR7EzVsrOZoD2rS44-cke64cyNc6-V522s2MQ8ybU,2199
218
218
  python_cad_tools/exporters/drawings/projection.py,sha256=DJavkNjmxf-f8gitoAJXd2u_Bjal1jzCYmPAUrrQIDw,2943
219
219
  python_cad_tools/exporters/drawings/svg.py,sha256=Hs8qF7NxMoO2rYmEcR11G7lZDfRPxD9WJDhlIwnh2G0,5854
@@ -233,9 +233,9 @@ python_cad_tools/templates/project/config.py,sha256=nhzK6fQJkzlA7qr6gU4NgC92QghW
233
233
  python_cad_tools/templates/project/drawing_annotations.py,sha256=6OY7qQUGtCV2sl-hjBKHABKvgcPvoiK96PHVFamAmVM,4063
234
234
  python_cad_tools/templates/project/model.py,sha256=B4ux3rwl8bSVl8V9egDRivVP6WutW4d7Hy8lJwMiZyg,4995
235
235
  python_cad_tools/templates/project/pyproject.toml,sha256=c2wqaOdiWTmk2mBnLbMvCFbLFTpBcwLlIB4mdxNyk4I,716
236
- python_cad_tools-0.1.25.dist-info/licenses/LICENSE,sha256=FqSceTmQgl-a1a4JK6fhf1yZdUf-inyBp5qdx4xZ73s,35282
237
- python_cad_tools-0.1.25.dist-info/METADATA,sha256=OfYLAMXyQaqE5D2BOaRl69fOO6Ys7MvvKo1xYUm7B34,8883
238
- python_cad_tools-0.1.25.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
239
- python_cad_tools-0.1.25.dist-info/entry_points.txt,sha256=jl-7a_ZJ5dRB0pxsIZx4LUkYZpkj9bGENqfU3VS7Xgo,57
240
- python_cad_tools-0.1.25.dist-info/top_level.txt,sha256=0ER82XyeYmT23LXXidp_s8El0xS4jQOpu7xnHeDwlXo,17
241
- python_cad_tools-0.1.25.dist-info/RECORD,,
236
+ python_cad_tools-0.1.26.dist-info/licenses/LICENSE,sha256=FqSceTmQgl-a1a4JK6fhf1yZdUf-inyBp5qdx4xZ73s,35282
237
+ python_cad_tools-0.1.26.dist-info/METADATA,sha256=HsGN4UqWABYh_Guft0pSgpcQkUQXQTtjCt71h4CtBNI,8883
238
+ python_cad_tools-0.1.26.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
239
+ python_cad_tools-0.1.26.dist-info/entry_points.txt,sha256=jl-7a_ZJ5dRB0pxsIZx4LUkYZpkj9bGENqfU3VS7Xgo,57
240
+ python_cad_tools-0.1.26.dist-info/top_level.txt,sha256=0ER82XyeYmT23LXXidp_s8El0xS4jQOpu7xnHeDwlXo,17
241
+ python_cad_tools-0.1.26.dist-info/RECORD,,