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
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
version: 2
|
||||
|
||||
sphinx:
|
||||
# Path to your Sphinx configuration file.
|
||||
configuration: doc/conf.py
|
||||
|
||||
|
||||
build:
|
||||
os: "ubuntu-20.04"
|
||||
tools:
|
||||
|
||||
@ -359,8 +359,8 @@ STEP can be loaded in all CAD tool, e.g. in FreeCAD and the XML be used in other
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
|
||||
door.save("door.step")
|
||||
door.save("door.xml")
|
||||
door.export("door.step")
|
||||
door.export("door.xml")
|
||||
.. image:: _static/door_assy_freecad.png
|
||||
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ preserve the color information from the assembly.
|
||||
Default
|
||||
--------
|
||||
|
||||
CadQuery assemblies have a :meth:`Assembly.save` method which can write an assembly to a STEP file. An example assembly
|
||||
CadQuery assemblies have a :meth:`Assembly.export` method which can write an assembly to a STEP file. An example assembly
|
||||
export with all defaults is shown below.
|
||||
|
||||
.. code-block:: python
|
||||
@ -192,7 +192,7 @@ Naming
|
||||
-------
|
||||
|
||||
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.
|
||||
This is done by setting the name property of the assembly before calling :meth:`Assembly.save`.
|
||||
This is done by setting the name property of the assembly before calling :meth:`Assembly.export`.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@ -210,7 +210,7 @@ Exporting Assemblies to glTF
|
||||
|
||||
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.
|
||||
|
||||
CadQuery assemblies have a :meth:`Assembly.save` method which can write an assembly to a glTF file. An example assembly
|
||||
CadQuery assemblies have a :meth:`Assembly.export` method which can write an assembly to a glTF file. An example assembly
|
||||
export with all defaults is shown below. To export to a binary glTF file, change the extension to ``glb``.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@ -3,7 +3,8 @@ import os
|
||||
from itertools import product
|
||||
from math import degrees
|
||||
import copy
|
||||
from pathlib import Path, PurePath
|
||||
from path import Path
|
||||
from pathlib import PurePath
|
||||
import re
|
||||
from pytest import approx
|
||||
|
||||
@ -38,7 +39,7 @@ from OCP.TopAbs import TopAbs_ShapeEnum
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def tmpdir(tmp_path_factory):
|
||||
return tmp_path_factory.mktemp("assembly")
|
||||
return Path(tmp_path_factory.mktemp("assembly"))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -623,7 +624,7 @@ def test_step_export(nested_assy, tmp_path_factory):
|
||||
],
|
||||
)
|
||||
def test_step_export_loc(assy_fixture, expected, request, tmpdir):
|
||||
stepfile = Path(tmpdir, assy_fixture).with_suffix(".step")
|
||||
stepfile = (Path(tmpdir) / assy_fixture).with_suffix(".step")
|
||||
if not stepfile.exists():
|
||||
assy = request.getfixturevalue(assy_fixture)
|
||||
assy.save(str(stepfile))
|
||||
@ -797,7 +798,7 @@ def test_save_gltf_boxes2(boxes2_assy, tmpdir, capfd):
|
||||
RWGltf_CafWriter skipped node '<name>' without triangulation data
|
||||
"""
|
||||
|
||||
boxes2_assy.save(str(Path(tmpdir, "boxes2_assy.glb")), "GLTF")
|
||||
boxes2_assy.save(str(Path(tmpdir) / "boxes2_assy.glb"), "GLTF")
|
||||
|
||||
output = capfd.readouterr()
|
||||
assert output.out == ""
|
||||
@ -1037,7 +1038,7 @@ def test_colors_assy1(assy_fixture, expected, request, tmpdir):
|
||||
check_nodes(doc, expected)
|
||||
|
||||
# repeat color check again - after STEP export round trip
|
||||
stepfile = Path(tmpdir, assy_fixture).with_suffix(".step")
|
||||
stepfile = (Path(tmpdir) / assy_fixture).with_suffix(".step")
|
||||
if not stepfile.exists():
|
||||
assy.save(str(stepfile))
|
||||
doc = read_step(stepfile)
|
||||
@ -1168,7 +1169,7 @@ def test_colors_fused_assy(assy_fixture, expected, request, tmpdir):
|
||||
check_nodes(doc, expected)
|
||||
|
||||
# repeat color check again - after STEP export round trip
|
||||
stepfile = Path(tmpdir, f"{assy_fixture}_fused").with_suffix(".step")
|
||||
stepfile = (Path(tmpdir) / f"{assy_fixture}_fused").with_suffix(".step")
|
||||
if not stepfile.exists():
|
||||
assy.save(str(stepfile), mode=cq.exporters.assembly.ExportModes.FUSED)
|
||||
doc = read_step(stepfile)
|
||||
@ -1699,7 +1700,7 @@ def test_step_export_filesize(tmpdir):
|
||||
assy.add(
|
||||
part, name=f"part{j}", loc=cq.Location(x=j * 1), color=copy.copy(color)
|
||||
)
|
||||
stepfile = Path(tmpdir, f"assy_step_filesize{i}.step")
|
||||
stepfile = Path(tmpdir) / f"assy_step_filesize{i}.step"
|
||||
assy.export(str(stepfile))
|
||||
filesize[i] = stepfile.stat().st_size
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
# core modules
|
||||
import os
|
||||
import io
|
||||
from pathlib import Path
|
||||
from path import Path
|
||||
import re
|
||||
import sys
|
||||
import math
|
||||
@ -833,7 +833,7 @@ def test_assy_vtk_rotation(tmpdir):
|
||||
v0, name="v0", loc=Location(Vector(0, 0, 0), Vector(1, 0, 0), 90),
|
||||
)
|
||||
|
||||
fwrl = Path(tmpdir, "v0.wrl")
|
||||
fwrl = Path(tmpdir) / "v0.wrl"
|
||||
assert not fwrl.exists()
|
||||
assy.save(str(fwrl), "VRML")
|
||||
assert fwrl.exists()
|
||||
@ -914,7 +914,11 @@ def test_dxf_text(tmpdir, testdatadir):
|
||||
.faces("<Y")
|
||||
.workplane()
|
||||
.text(
|
||||
",,", 10, -1, True, fontPath=str(Path(testdatadir, "OpenSans-Regular.ttf")),
|
||||
",,",
|
||||
10,
|
||||
-1,
|
||||
True,
|
||||
fontPath=str(Path(testdatadir) / "OpenSans-Regular.ttf"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user