|
|
|
|
@ -429,6 +429,30 @@ def _ensure_integer_property(obj, prop_name, description, value):
|
|
|
|
|
setattr(obj, prop_name, 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _ensure_float_property(obj, prop_name, description, value):
|
|
|
|
|
if prop_name not in getattr(obj, "PropertiesList", []):
|
|
|
|
|
obj.addProperty(
|
|
|
|
|
"App::PropertyFloat",
|
|
|
|
|
prop_name,
|
|
|
|
|
PROPERTY_GROUP,
|
|
|
|
|
description,
|
|
|
|
|
)
|
|
|
|
|
try:
|
|
|
|
|
setattr(obj, prop_name, float(value))
|
|
|
|
|
except Exception:
|
|
|
|
|
setattr(obj, prop_name, 0.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _wiring_cut_out_bridge_extension_value(source, default=DEFAULT_WIRING_CUT_OUT_BRIDGE_EXTENSION):
|
|
|
|
|
try:
|
|
|
|
|
value = float(getattr(source, "QetWiringCutOutBridgeExtensionMm", default) or 0.0)
|
|
|
|
|
except Exception:
|
|
|
|
|
value = float(default or 0.0)
|
|
|
|
|
if value < 0.0:
|
|
|
|
|
return 0.0
|
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_route_carrier_semantics(obj, project_uuid="", kind=ROUTE_CARRIER_KIND, capacity=1):
|
|
|
|
|
TerminalObjects.ensure_string_property(
|
|
|
|
|
obj,
|
|
|
|
|
@ -522,7 +546,7 @@ def _set_support_surface_source_semantics(source):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_wiring_cut_out_source_semantics(source):
|
|
|
|
|
def _set_wiring_cut_out_source_semantics(source, bridge_extension=DEFAULT_WIRING_CUT_OUT_BRIDGE_EXTENSION):
|
|
|
|
|
if source is None:
|
|
|
|
|
return
|
|
|
|
|
TerminalObjects.ensure_string_property(
|
|
|
|
|
@ -539,6 +563,12 @@ def _set_wiring_cut_out_source_semantics(source):
|
|
|
|
|
"How routing connection collision checks should treat this object",
|
|
|
|
|
WIRE_DUCT_OBSTACLE_MODE,
|
|
|
|
|
)
|
|
|
|
|
_ensure_float_property(
|
|
|
|
|
source,
|
|
|
|
|
"QetWiringCutOutBridgeExtensionMm",
|
|
|
|
|
"How far the generated wiring cut-out carrier extends beyond each side of the opening",
|
|
|
|
|
_wiring_cut_out_bridge_extension_value(source, default=bridge_extension),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _style_route_carrier(carrier, kind):
|
|
|
|
|
@ -1632,11 +1662,11 @@ def _mark_support_surface_source(source, carriers):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _mark_wiring_cut_out_source(source, carrier):
|
|
|
|
|
def _mark_wiring_cut_out_source(source, carrier, bridge_extension=DEFAULT_WIRING_CUT_OUT_BRIDGE_EXTENSION):
|
|
|
|
|
if source is None or carrier is None:
|
|
|
|
|
return
|
|
|
|
|
try:
|
|
|
|
|
_set_wiring_cut_out_source_semantics(source)
|
|
|
|
|
_set_wiring_cut_out_source_semantics(source, bridge_extension=bridge_extension)
|
|
|
|
|
TerminalObjects.ensure_string_property(
|
|
|
|
|
source,
|
|
|
|
|
"QetRouteCarrierName",
|
|
|
|
|
@ -1903,7 +1933,8 @@ def create_wiring_cut_out_carriers_from_document(
|
|
|
|
|
bbox = _bound_box_from_object(source)
|
|
|
|
|
if bbox is None:
|
|
|
|
|
continue
|
|
|
|
|
points = _wiring_cut_out_points_from_bbox(bbox, bridge_extension=bridge_extension)
|
|
|
|
|
source_bridge_extension = _wiring_cut_out_bridge_extension_value(source, default=bridge_extension)
|
|
|
|
|
points = _wiring_cut_out_points_from_bbox(bbox, bridge_extension=source_bridge_extension)
|
|
|
|
|
if len(points) < 2:
|
|
|
|
|
continue
|
|
|
|
|
live_carrier = _live_source_carrier(doc, source)
|
|
|
|
|
@ -1914,7 +1945,7 @@ def create_wiring_cut_out_carriers_from_document(
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
kind=ROUTE_CARRIER_KIND_WIRING_CUT_OUT,
|
|
|
|
|
):
|
|
|
|
|
_mark_wiring_cut_out_source(source, live_carrier)
|
|
|
|
|
_mark_wiring_cut_out_source(source, live_carrier, bridge_extension=source_bridge_extension)
|
|
|
|
|
try:
|
|
|
|
|
doc.recompute()
|
|
|
|
|
except Exception:
|
|
|
|
|
@ -1928,7 +1959,7 @@ def create_wiring_cut_out_carriers_from_document(
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
kind=ROUTE_CARRIER_KIND_WIRING_CUT_OUT,
|
|
|
|
|
)
|
|
|
|
|
_mark_wiring_cut_out_source(source, carrier)
|
|
|
|
|
_mark_wiring_cut_out_source(source, carrier, bridge_extension=source_bridge_extension)
|
|
|
|
|
created.append(carrier)
|
|
|
|
|
return created
|
|
|
|
|
|
|
|
|
|
|