|
|
|
|
@ -502,7 +502,17 @@ def _route_carrier_capacity_value(obj, default=1):
|
|
|
|
|
return int(default or 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_wire_duct_source_semantics(source):
|
|
|
|
|
def _wire_duct_end_margin_value(source, default=DEFAULT_WIRE_DUCT_MARGIN):
|
|
|
|
|
try:
|
|
|
|
|
value = float(getattr(source, "QetWireDuctEndMarginMm", default) or 0.0)
|
|
|
|
|
except Exception:
|
|
|
|
|
value = float(default or 0.0)
|
|
|
|
|
if value < 0.0:
|
|
|
|
|
return 0.0
|
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_wire_duct_source_semantics(source, end_margin=DEFAULT_WIRE_DUCT_MARGIN):
|
|
|
|
|
if source is None:
|
|
|
|
|
return
|
|
|
|
|
TerminalObjects.ensure_string_property(
|
|
|
|
|
@ -525,6 +535,12 @@ def _set_wire_duct_source_semantics(source):
|
|
|
|
|
"How many routed wires can reuse generated wire duct segments before detouring is preferred",
|
|
|
|
|
_route_carrier_capacity_value(source, default=1),
|
|
|
|
|
)
|
|
|
|
|
_ensure_float_property(
|
|
|
|
|
source,
|
|
|
|
|
"QetWireDuctEndMarginMm",
|
|
|
|
|
"How far generated wire duct centerlines stay inside each duct end",
|
|
|
|
|
_wire_duct_end_margin_value(source, default=end_margin),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_support_surface_source_semantics(source):
|
|
|
|
|
@ -1463,7 +1479,14 @@ def _wire_duct_centerline_from_bbox(bbox, margin=DEFAULT_WIRE_DUCT_MARGIN, min_a
|
|
|
|
|
).get("centerline", [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _sync_wire_duct_source_carriers(doc, source, spec, project_uuid="", capacity=1):
|
|
|
|
|
def _sync_wire_duct_source_carriers(
|
|
|
|
|
doc,
|
|
|
|
|
source,
|
|
|
|
|
spec,
|
|
|
|
|
project_uuid="",
|
|
|
|
|
capacity=1,
|
|
|
|
|
end_margin=DEFAULT_WIRE_DUCT_MARGIN,
|
|
|
|
|
):
|
|
|
|
|
carriers = _live_source_carriers(doc, source)
|
|
|
|
|
if not carriers:
|
|
|
|
|
return False
|
|
|
|
|
@ -1489,7 +1512,7 @@ def _sync_wire_duct_source_carriers(doc, source, spec, project_uuid="", capacity
|
|
|
|
|
updated.append(carrier)
|
|
|
|
|
|
|
|
|
|
if updated:
|
|
|
|
|
_mark_wire_duct_source(source, updated[0], updated)
|
|
|
|
|
_mark_wire_duct_source(source, updated[0], updated, end_margin=end_margin)
|
|
|
|
|
try:
|
|
|
|
|
doc.recompute()
|
|
|
|
|
except Exception:
|
|
|
|
|
@ -1627,11 +1650,11 @@ def _remember_source_carriers(source, carriers):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _mark_wire_duct_source(source, carrier, carriers=None):
|
|
|
|
|
def _mark_wire_duct_source(source, carrier, carriers=None, end_margin=DEFAULT_WIRE_DUCT_MARGIN):
|
|
|
|
|
if source is None:
|
|
|
|
|
return
|
|
|
|
|
try:
|
|
|
|
|
_set_wire_duct_source_semantics(source)
|
|
|
|
|
_set_wire_duct_source_semantics(source, end_margin=end_margin)
|
|
|
|
|
if carrier is not None:
|
|
|
|
|
TerminalObjects.ensure_string_property(
|
|
|
|
|
source,
|
|
|
|
|
@ -1876,9 +1899,10 @@ def create_wire_duct_carriers_from_document(
|
|
|
|
|
bbox = _bound_box_from_object(source)
|
|
|
|
|
if bbox is None:
|
|
|
|
|
continue
|
|
|
|
|
source_margin = _wire_duct_end_margin_value(source, default=margin)
|
|
|
|
|
spec = _wire_duct_centerline_spec_from_bbox(
|
|
|
|
|
bbox,
|
|
|
|
|
margin=margin,
|
|
|
|
|
margin=source_margin,
|
|
|
|
|
min_aspect=min_aspect,
|
|
|
|
|
)
|
|
|
|
|
points = spec.get("centerline", [])
|
|
|
|
|
@ -1892,6 +1916,7 @@ def create_wire_duct_carriers_from_document(
|
|
|
|
|
spec,
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
capacity=capacity,
|
|
|
|
|
end_margin=source_margin,
|
|
|
|
|
):
|
|
|
|
|
continue
|
|
|
|
|
carrier = create_route_carrier(
|
|
|
|
|
@ -1917,7 +1942,7 @@ def create_wire_duct_carriers_from_document(
|
|
|
|
|
)
|
|
|
|
|
source_created.append(open_end_carrier)
|
|
|
|
|
created.append(open_end_carrier)
|
|
|
|
|
_mark_wire_duct_source(source, carrier, source_created)
|
|
|
|
|
_mark_wire_duct_source(source, carrier, source_created, end_margin=source_margin)
|
|
|
|
|
return created
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2247,9 +2272,10 @@ def create_wire_duct_carriers_from_selection(
|
|
|
|
|
bbox = _bound_box_from_object(source)
|
|
|
|
|
if bbox is None:
|
|
|
|
|
continue
|
|
|
|
|
source_margin = _wire_duct_end_margin_value(source, default=margin)
|
|
|
|
|
spec = _wire_duct_centerline_spec_from_bbox(
|
|
|
|
|
bbox,
|
|
|
|
|
margin=margin,
|
|
|
|
|
margin=source_margin,
|
|
|
|
|
min_aspect=min_aspect,
|
|
|
|
|
)
|
|
|
|
|
points = spec.get("centerline", [])
|
|
|
|
|
@ -2263,6 +2289,7 @@ def create_wire_duct_carriers_from_selection(
|
|
|
|
|
spec,
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
capacity=capacity,
|
|
|
|
|
end_margin=source_margin,
|
|
|
|
|
):
|
|
|
|
|
continue
|
|
|
|
|
carrier = create_route_carrier(
|
|
|
|
|
@ -2288,7 +2315,7 @@ def create_wire_duct_carriers_from_selection(
|
|
|
|
|
)
|
|
|
|
|
source_created.append(open_end_carrier)
|
|
|
|
|
created.append(open_end_carrier)
|
|
|
|
|
_mark_wire_duct_source(source, carrier, source_created)
|
|
|
|
|
_mark_wire_duct_source(source, carrier, source_created, end_margin=source_margin)
|
|
|
|
|
return created
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|