|
|
|
|
@ -423,7 +423,7 @@ def _ensure_integer_property(obj, prop_name, description, value):
|
|
|
|
|
setattr(obj, prop_name, 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_route_carrier_semantics(obj, project_uuid="", kind=ROUTE_CARRIER_KIND):
|
|
|
|
|
def _set_route_carrier_semantics(obj, project_uuid="", kind=ROUTE_CARRIER_KIND, capacity=1):
|
|
|
|
|
TerminalObjects.ensure_string_property(
|
|
|
|
|
obj,
|
|
|
|
|
"QetRoutingRole",
|
|
|
|
|
@ -456,11 +456,22 @@ def _set_route_carrier_semantics(obj, project_uuid="", kind=ROUTE_CARRIER_KIND):
|
|
|
|
|
obj,
|
|
|
|
|
"QetRouteCarrierCapacity",
|
|
|
|
|
"How many routed wires can reuse this carrier segment before detouring is preferred",
|
|
|
|
|
1,
|
|
|
|
|
capacity,
|
|
|
|
|
)
|
|
|
|
|
return obj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _route_carrier_capacity_value(obj, default=1):
|
|
|
|
|
for property_name in ("QetRouteCarrierCapacity", "QetWireCapacity"):
|
|
|
|
|
try:
|
|
|
|
|
value = int(float(getattr(obj, property_name, 0) or 0))
|
|
|
|
|
except Exception:
|
|
|
|
|
value = 0
|
|
|
|
|
if value > 0:
|
|
|
|
|
return value
|
|
|
|
|
return int(default or 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_wire_duct_source_semantics(source):
|
|
|
|
|
if source is None:
|
|
|
|
|
return
|
|
|
|
|
@ -478,6 +489,12 @@ def _set_wire_duct_source_semantics(source):
|
|
|
|
|
"How routing connection collision checks should treat this object",
|
|
|
|
|
WIRE_DUCT_OBSTACLE_MODE,
|
|
|
|
|
)
|
|
|
|
|
_ensure_integer_property(
|
|
|
|
|
source,
|
|
|
|
|
"QetRouteCarrierCapacity",
|
|
|
|
|
"How many routed wires can reuse generated wire duct segments before detouring is preferred",
|
|
|
|
|
_route_carrier_capacity_value(source, default=1),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _set_support_surface_source_semantics(source):
|
|
|
|
|
@ -571,7 +588,7 @@ def _create_carrier_geometry(doc, name, points):
|
|
|
|
|
return obj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_route_carrier(doc, points, label="", project_uuid="", kind=ROUTE_CARRIER_KIND):
|
|
|
|
|
def create_route_carrier(doc, points, label="", project_uuid="", kind=ROUTE_CARRIER_KIND, capacity=1):
|
|
|
|
|
"""Create a routable carrier from ordered 3D points."""
|
|
|
|
|
if doc is None:
|
|
|
|
|
raise RoutingNetworkError("No FreeCAD document is available.")
|
|
|
|
|
@ -596,7 +613,7 @@ def create_route_carrier(doc, points, label="", project_uuid="", kind=ROUTE_CARR
|
|
|
|
|
"Ordered centerline points used by the 3D router",
|
|
|
|
|
)
|
|
|
|
|
carrier.Points = list(normalized)
|
|
|
|
|
_set_route_carrier_semantics(carrier, project_uuid=project_uuid, kind=kind)
|
|
|
|
|
_set_route_carrier_semantics(carrier, project_uuid=project_uuid, kind=kind, capacity=capacity)
|
|
|
|
|
|
|
|
|
|
group = WiringObjects.ensure_carrier_group(doc, project_uuid)
|
|
|
|
|
if carrier not in getattr(group, "Group", []):
|
|
|
|
|
@ -1607,12 +1624,14 @@ def create_wire_duct_carriers_from_document(
|
|
|
|
|
if len(points) < 2:
|
|
|
|
|
continue
|
|
|
|
|
label = getattr(source, "Label", "") or getattr(source, "Name", "") or "Wire Duct"
|
|
|
|
|
capacity = _route_carrier_capacity_value(source, default=1)
|
|
|
|
|
carrier = create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
points,
|
|
|
|
|
label="QET Auto Wire Duct Centerline {0}".format(label),
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
kind=ROUTE_CARRIER_KIND_WIRE_DUCT,
|
|
|
|
|
capacity=capacity,
|
|
|
|
|
)
|
|
|
|
|
_mark_wire_duct_source(source, carrier)
|
|
|
|
|
created.append(carrier)
|
|
|
|
|
@ -1626,6 +1645,7 @@ def create_wire_duct_carriers_from_document(
|
|
|
|
|
label="QET Auto Wire Duct Open End {0} {1}".format(label, end_index),
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
kind=ROUTE_CARRIER_KIND_WIRE_DUCT_OPEN_END,
|
|
|
|
|
capacity=capacity,
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
return created
|
|
|
|
|
@ -1908,12 +1928,14 @@ def create_wire_duct_carriers_from_selection(
|
|
|
|
|
if len(points) < 2:
|
|
|
|
|
continue
|
|
|
|
|
label = getattr(source, "Label", "") or getattr(source, "Name", "") or "Wire Duct"
|
|
|
|
|
capacity = _route_carrier_capacity_value(source, default=1)
|
|
|
|
|
carrier = create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
points,
|
|
|
|
|
label="QET Wire Duct Centerline {0}".format(label),
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
kind=ROUTE_CARRIER_KIND_WIRE_DUCT,
|
|
|
|
|
capacity=capacity,
|
|
|
|
|
)
|
|
|
|
|
_mark_wire_duct_source(source, carrier)
|
|
|
|
|
created.append(carrier)
|
|
|
|
|
@ -1927,6 +1949,7 @@ def create_wire_duct_carriers_from_selection(
|
|
|
|
|
label="QET Wire Duct Open End {0} {1}".format(label, end_index),
|
|
|
|
|
project_uuid=project_uuid,
|
|
|
|
|
kind=ROUTE_CARRIER_KIND_WIRE_DUCT_OPEN_END,
|
|
|
|
|
capacity=capacity,
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
return created
|
|
|
|
|
|