Skip to content

Commit 665815b

Browse files
Sphinx extension remove unused code (#1227)
* Sphinx extension remove unused code * Change channel order --------- Co-authored-by: AU <[email protected]>
1 parent 7143ead commit 665815b

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

cadquery/cq_directive.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@
66
import traceback
77

88
from json import dumps
9-
from pathlib import Path
10-
from uuid import uuid1 as uuid
11-
from textwrap import indent
129

1310
from cadquery import exporters, Assembly, Compound, Color, Sketch
1411
from cadquery import cqgi
1512
from cadquery.occ_impl.assembly import toJSON
16-
from cadquery.occ_impl.jupyter_tools import (
17-
TEMPLATE_RENDER,
18-
DEFAULT_COLOR,
19-
)
13+
from cadquery.occ_impl.jupyter_tools import DEFAULT_COLOR
2014
from docutils.parsers.rst import directives, Directive
2115

2216
template = """
@@ -30,7 +24,6 @@
3024
</div>
3125
3226
"""
33-
template_content_indent = " "
3427

3528
rendering_code = """
3629
const RENDERERS = {};
@@ -216,10 +209,8 @@ class cq_directive(Directive):
216209

217210
has_content = True
218211
required_arguments = 0
219-
optional_arguments = 2
212+
optional_arguments = 0
220213
option_spec = {
221-
"height": directives.length_or_unitless,
222-
"width": directives.length_or_percentage_or_unitless,
223214
"align": directives.unchanged,
224215
}
225216

@@ -278,7 +269,7 @@ class cq_directive_vtk(Directive):
278269

279270
has_content = True
280271
required_arguments = 0
281-
optional_arguments = 2
272+
optional_arguments = 0
282273
option_spec = {
283274
"height": directives.length_or_unitless,
284275
"width": directives.length_or_percentage_or_unitless,
@@ -291,9 +282,6 @@ def run(self):
291282
options = self.options
292283
content = self.content
293284
state_machine = self.state_machine
294-
env = self.state.document.settings.env
295-
build_path = Path(env.app.builder.outdir)
296-
out_path = build_path / "_static"
297285

298286
# only consider inline snippets
299287
plot_code = "\n".join(content)
@@ -321,21 +309,14 @@ def run(self):
321309
traceback.print_exc()
322310
assy = Assembly(Compound.makeText("CQGI error", 10, 5))
323311

324-
# save vtkjs to static
325-
fname = Path(str(uuid()))
326-
exporters.assembly.exportVTKJS(assy, out_path / fname)
327-
fname = str(fname) + ".zip"
328-
329312
# add the output
330313
lines = []
331314

332315
data = dumps(toJSON(assy))
333316

334317
lines.extend(
335318
template_vtk.format(
336-
code=indent(TEMPLATE_RENDER.format(), " "),
337319
data=data,
338-
ratio="null",
339320
element="document.currentScript.parentNode",
340321
txt_align=options.get("align", "left"),
341322
width=options.get("width", "100%"),

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: cadquery
22
channels:
3-
- cadquery
43
- conda-forge
4+
- cadquery
55
dependencies:
66
- python>=3.8
77
- ipython

0 commit comments

Comments
 (0)