mirror of
https://github.com/gittrahan/support-fins.git
synced 2026-10-19 02:10:52 -05:00
plugins: gap review fixes -- Blender's float32 gap at 0.4 is in range, Onshape's gap bounds are the site's 0.1-0.4, Cura README
This commit is contained in:
1 parent
93bb5565f4
commit
93c36f9561
4 files changed
+14
-5
No files matched your search
@@ -72,7 +72,10 @@ def dialog_values(schema, read):
|
||||
for s in specs(schema):
|
||||
v = read(s["name"])
|
||||
if s["kind"] == "float":
|
||||
v = float(v) / 100.0 if s["percent"] else float(v)
|
||||
# Blender keeps a FloatProperty as float32: the gap's 0.4 max reads back as
|
||||
# 0.4000000059604645, which the engine refuses as out of range. Six places
|
||||
# drops that noise and nothing a dialog can set.
|
||||
v = round(float(v) / 100.0 if s["percent"] else float(v), 6)
|
||||
elif s["kind"] == "bool":
|
||||
v = bool(v)
|
||||
values[s["key"]] = v
|
||||
|
||||
@@ -14,6 +14,7 @@ Pinned:
|
||||
"""
|
||||
import json
|
||||
import pathlib
|
||||
import struct
|
||||
import sys
|
||||
import zipfile
|
||||
import xml.etree.ElementTree as ET
|
||||
@@ -90,10 +91,14 @@ def test_the_engine_takes_what_the_panel_sends(engine):
|
||||
by_name = {s["name"]: s for s in SPECS}
|
||||
defaults = host.host_options(ctx, schema.dialog_values(SCHEMA, lambda n: by_name[n]["default"]))
|
||||
assert defaults["gap"] == 0.2 and "sway" not in defaults # sway off: not sent
|
||||
tops = {s["name"]: s.get("max", s.get("soft_max")) if s["kind"] == "float" else s["default"] for s in SPECS}
|
||||
# as Blender hands them back: a FloatProperty is float32, so the gap's 0.4 max
|
||||
# reads as 0.4000000059604645 -- and must still be in range
|
||||
f32 = lambda x: struct.unpack("f", struct.pack("f", x))[0]
|
||||
tops = {s["name"]: f32(s.get("max", s.get("soft_max"))) if s["kind"] == "float" else s["default"] for s in SPECS}
|
||||
tops["sway_on"] = True
|
||||
opts = host.host_options(ctx, schema.dialog_values(SCHEMA, lambda n: tops[n]))
|
||||
assert opts["coverage"] == 1.0 and opts["sway"]["reach"] == 0.5 # 100 % and 50 % arrive / 100
|
||||
assert opts["gap"] == 0.4
|
||||
|
||||
|
||||
def test_a_key_clash_is_refused():
|
||||
|
||||
@@ -83,8 +83,8 @@ python3 plugins/cura/build.py && python3 -m pytest -q plugins/cura/tests/
|
||||
```
|
||||
|
||||
The tests cover the frame mapping (Cura is Y-up, the engine Z-up), the part → engine → fins
|
||||
round trip, and the settings layer (`SupportFins/settings.py`: saved values, Match Cura, the
|
||||
dialog's rows, stale fins), without Cura. For the Cura side (menu, background job, scene, undo), drop a
|
||||
round trip, and the settings layer (`SupportFins/settings.py`: saved values, the dialog's rows,
|
||||
stale fins), without Cura. For the Cura side (menu, background job, scene, undo), drop a
|
||||
`dev_autorun.json` next to the built plugin and open a model:
|
||||
|
||||
```sh
|
||||
|
||||
@@ -101,9 +101,10 @@ const NOZZLE_BOUNDS =
|
||||
(inch) : 0.016
|
||||
} as LengthBoundSpec;
|
||||
|
||||
// the site's Support gap field: 0.1-0.4 mm, default 0.2
|
||||
const GAP_BOUNDS =
|
||||
{
|
||||
(millimeter) : [0.05, 0.2, 2.0],
|
||||
(millimeter) : [0.1, 0.2, 0.4],
|
||||
(inch) : 0.008
|
||||
} as LengthBoundSpec;
|
||||
|
||||
|
||||
Reference in new issue
Block a user