Skip to content

Commit f13f607

Browse files
Small doc fixes (#1749)
* Use export iso save * Reference correct method * Add path to docs/conf.py * Typo fix * use path.Path * Path related fixes * Get rid of pathlib * Path fixes * Another path related fix
1 parent d1e4cb6 commit f13f607

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

.readthedocs.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
version: 2
22

3+
sphinx:
4+
# Path to your Sphinx configuration file.
5+
configuration: doc/conf.py
6+
7+
38
build:
49
os: "ubuntu-20.04"
510
tools:

doc/assy.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ STEP can be loaded in all CAD tool, e.g. in FreeCAD and the XML be used in other
359359
.. code-block:: python
360360
:linenos:
361361
362-
door.save("door.step")
363-
door.save("door.xml")
362+
door.export("door.step")
363+
door.export("door.xml")
364364
.. image:: _static/door_assy_freecad.png
365365

366366

doc/importexport.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ preserve the color information from the assembly.
144144
Default
145145
--------
146146

147-
CadQuery assemblies have a :meth:`Assembly.save` method which can write an assembly to a STEP file. An example assembly
147+
CadQuery assemblies have a :meth:`Assembly.export` method which can write an assembly to a STEP file. An example assembly
148148
export with all defaults is shown below.
149149

150150
.. code-block:: python
@@ -192,7 +192,7 @@ Naming
192192
-------
193193

194194
It is also possible to set the name of the top level assembly object in the STEP file with either the DEFAULT or FUSED methods.
195-
This is done by setting the name property of the assembly before calling :meth:`Assembly.save`.
195+
This is done by setting the name property of the assembly before calling :meth:`Assembly.export`.
196196

197197
.. code-block:: python
198198
@@ -210,7 +210,7 @@ Exporting Assemblies to glTF
210210

211211
It is possible to export CadQuery assemblies to glTF format. glTF is a mesh-based format useful for viewing models on the web. Whether the resulting glTF file is binary (.glb) or text (.gltf) is set by the file extension.
212212

213-
CadQuery assemblies have a :meth:`Assembly.save` method which can write an assembly to a glTF file. An example assembly
213+
CadQuery assemblies have a :meth:`Assembly.export` method which can write an assembly to a glTF file. An example assembly
214214
export with all defaults is shown below. To export to a binary glTF file, change the extension to ``glb``.
215215

216216
.. code-block:: python

tests/test_assembly.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from itertools import product
44
from math import degrees
55
import copy
6-
from pathlib import Path, PurePath
6+
from path import Path
7+
from pathlib import PurePath
78
import re
89
from pytest import approx
910

@@ -38,7 +39,7 @@
3839

3940
@pytest.fixture(scope="function")
4041
def tmpdir(tmp_path_factory):
41-
return tmp_path_factory.mktemp("assembly")
42+
return Path(tmp_path_factory.mktemp("assembly"))
4243

4344

4445
@pytest.fixture
@@ -623,7 +624,7 @@ def test_step_export(nested_assy, tmp_path_factory):
623624
],
624625
)
625626
def test_step_export_loc(assy_fixture, expected, request, tmpdir):
626-
stepfile = Path(tmpdir, assy_fixture).with_suffix(".step")
627+
stepfile = (Path(tmpdir) / assy_fixture).with_suffix(".step")
627628
if not stepfile.exists():
628629
assy = request.getfixturevalue(assy_fixture)
629630
assy.save(str(stepfile))
@@ -797,7 +798,7 @@ def test_save_gltf_boxes2(boxes2_assy, tmpdir, capfd):
797798
RWGltf_CafWriter skipped node '<name>' without triangulation data
798799
"""
799800

800-
boxes2_assy.save(str(Path(tmpdir, "boxes2_assy.glb")), "GLTF")
801+
boxes2_assy.save(str(Path(tmpdir) / "boxes2_assy.glb"), "GLTF")
801802

802803
output = capfd.readouterr()
803804
assert output.out == ""
@@ -1037,7 +1038,7 @@ def check_nodes(doc, expected, is_STEP=False):
10371038
check_nodes(doc, expected)
10381039

10391040
# repeat color check again - after STEP export round trip
1040-
stepfile = Path(tmpdir, assy_fixture).with_suffix(".step")
1041+
stepfile = (Path(tmpdir) / assy_fixture).with_suffix(".step")
10411042
if not stepfile.exists():
10421043
assy.save(str(stepfile))
10431044
doc = read_step(stepfile)
@@ -1168,7 +1169,7 @@ def check_nodes(doc, expected):
11681169
check_nodes(doc, expected)
11691170

11701171
# repeat color check again - after STEP export round trip
1171-
stepfile = Path(tmpdir, f"{assy_fixture}_fused").with_suffix(".step")
1172+
stepfile = (Path(tmpdir) / f"{assy_fixture}_fused").with_suffix(".step")
11721173
if not stepfile.exists():
11731174
assy.save(str(stepfile), mode=cq.exporters.assembly.ExportModes.FUSED)
11741175
doc = read_step(stepfile)
@@ -1699,7 +1700,7 @@ def test_step_export_filesize(tmpdir):
16991700
assy.add(
17001701
part, name=f"part{j}", loc=cq.Location(x=j * 1), color=copy.copy(color)
17011702
)
1702-
stepfile = Path(tmpdir, f"assy_step_filesize{i}.step")
1703+
stepfile = Path(tmpdir) / f"assy_step_filesize{i}.step"
17031704
assy.export(str(stepfile))
17041705
filesize[i] = stepfile.stat().st_size
17051706

tests/test_exporters.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# core modules
55
import os
66
import io
7-
from pathlib import Path
7+
from path import Path
88
import re
99
import sys
1010
import math
@@ -833,7 +833,7 @@ def test_assy_vtk_rotation(tmpdir):
833833
v0, name="v0", loc=Location(Vector(0, 0, 0), Vector(1, 0, 0), 90),
834834
)
835835

836-
fwrl = Path(tmpdir, "v0.wrl")
836+
fwrl = Path(tmpdir) / "v0.wrl"
837837
assert not fwrl.exists()
838838
assy.save(str(fwrl), "VRML")
839839
assert fwrl.exists()
@@ -914,7 +914,11 @@ def test_dxf_text(tmpdir, testdatadir):
914914
.faces("<Y")
915915
.workplane()
916916
.text(
917-
",,", 10, -1, True, fontPath=str(Path(testdatadir, "OpenSans-Regular.ttf")),
917+
",,",
918+
10,
919+
-1,
920+
True,
921+
fontPath=str(Path(testdatadir) / "OpenSans-Regular.ttf"),
918922
)
919923
)
920924

0 commit comments

Comments
 (0)