Draft: Draft_Split: apply original view props to split off object

Fixes #16210.

Note that `Draft.format_object` is called from gui_split.py (in the commit). This is not consistent with other tools where this is handled in the `make_*` functions. In this case the new object is formatted twice. The 1st time by the `make_wire` code which (wrongly) applies the current default props.
This commit is contained in:
Roy-043
2024-11-28 15:21:08 +01:00
committed by Yorik van Havre
parent 8d54fdc0bc
commit de137c6efd
2 changed files with 18 additions and 21 deletions

View File

@@ -33,22 +33,22 @@ import draftmake.make_wire as make_wire
def split(wire, newPoint, edgeIndex):
if utils.get_type(wire) != "Wire":
return
elif wire.Closed:
split_closed_wire(wire, edgeIndex)
else:
split_open_wire(wire, newPoint, edgeIndex)
return None
if wire.Closed:
return split_closed_wire(wire, edgeIndex)
return split_open_wire(wire, newPoint, edgeIndex)
def split_closed_wire(wire, edgeIndex):
wire.Closed = False
if edgeIndex == len(wire.Points):
make_wire.make_wire([wire.Placement.multVec(wire.Points[0]),
new = make_wire.make_wire([wire.Placement.multVec(wire.Points[0]),
wire.Placement.multVec(wire.Points[-1])], placement=wire.Placement)
else:
make_wire.make_wire([wire.Placement.multVec(wire.Points[edgeIndex-1]),
new = make_wire.make_wire([wire.Placement.multVec(wire.Points[edgeIndex-1]),
wire.Placement.multVec(wire.Points[edgeIndex])], placement=wire.Placement)
wire.Points = list(reversed(wire.Points[0:edgeIndex])) + list(reversed(wire.Points[edgeIndex:]))
return new
splitClosedWire = split_closed_wire
@@ -67,7 +67,7 @@ def split_open_wire(wire, newPoint, edgeIndex):
elif index > edgeIndex:
wire2Points.append(wire.Placement.multVec(point))
wire.Points = wire1Points
make_wire.make_wire(wire2Points, placement=wire.Placement)
return make_wire.make_wire(wire2Points, placement=wire.Placement)
splitOpenWire = split_open_wire