|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
import tempfile
|
|
|
|
import tempfile
|
|
|
|
@ -341,6 +342,40 @@ class WiringTest(unittest.TestCase):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.assertEqual("face", payload["route_nodes"][2]["anchor_kind"])
|
|
|
|
self.assertEqual("face", payload["route_nodes"][2]["anchor_kind"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_wire_payload_includes_auto_route_diagnostics_metadata(self):
|
|
|
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
|
|
|
terminal_objects, wiring_objects, _manual_wiring, _write_back = _reload_modules()
|
|
|
|
|
|
|
|
app = sys.modules["FreeCAD"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc = FakeDocument()
|
|
|
|
|
|
|
|
wire = doc.addObject("Part::Feature", "QETWire_auto")
|
|
|
|
|
|
|
|
wire.Shape = [app.Vector(0, 0, 0), app.Vector(100, 0, 0)]
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetProjectUuid", "QET Exchange", "", "project-1")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetWireUuid", "QET Exchange", "", "wire-1")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetWireLabel", "QET Exchange", "", "N4111")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetStartTerminalUuid", "QET Exchange", "", "terminal-start")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetEndTerminalUuid", "QET Exchange", "", "terminal-end")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetStartInstanceId", "QET Exchange", "", "instance-start")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetEndInstanceId", "QET Exchange", "", "instance-end")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "RouteType", "QET Exchange", "", "RoutedConnection")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "RouteStatus", "QET Exchange", "", "CollisionWarning")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "RouteMode", "QET Exchange", "", "EplanRoute")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetWireStyleId", "QET Exchange", "", "42")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(wire, "QetRouteLengthMm", "QET Exchange", "", "123.5")
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(
|
|
|
|
|
|
|
|
wire,
|
|
|
|
|
|
|
|
"QetRouteDiagnosticsJson",
|
|
|
|
|
|
|
|
"QET Exchange",
|
|
|
|
|
|
|
|
"",
|
|
|
|
|
|
|
|
json.dumps({"collision_count": 1, "wire_style_id": "42"}),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
payload = wiring_objects.wire_payload_from_object(wire)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual("42", payload["wire_style_id"])
|
|
|
|
|
|
|
|
self.assertEqual(123.5, payload["length_mm"])
|
|
|
|
|
|
|
|
self.assertEqual(1, payload["route_diagnostics"]["collision_count"])
|
|
|
|
|
|
|
|
|
|
|
|
def test_wire_writeback_omits_scene_routed_wire_payload(self):
|
|
|
|
def test_wire_writeback_omits_scene_routed_wire_payload(self):
|
|
|
|
_install_fake_freecad()
|
|
|
|
_install_fake_freecad()
|
|
|
|
terminal_objects, wiring_objects, manual_wiring, write_back = _reload_modules()
|
|
|
|
terminal_objects, wiring_objects, manual_wiring, write_back = _reload_modules()
|
|
|
|
|