Draft Split: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
(Updated Scripting)
Line 58: Line 58:


<!--T:9-->
<!--T:9-->
To split wires use the {{incode|split}} method of the Draft module. This method returns {{incode|None}}.
The Split tool can be used in [[Macros|macros]] and from the [[Python|Python]] console by using the following function:


</translate>
</translate>
{{Code|code=
{{Code|code=
split(wire, newPoint, edgeIndex)
split(wire, newPoint, edgeIndex)
}}
<translate>

* {{incode|wire}} the wire object to be split.
* {{incode|newPoint}} the point where the split should occur.
* {{incode|edgeIndex}} index of the edge where the split should occur (1-based).

Example:

</translate>
{{Code|code=
import FreeCAD as App
import Draft

doc = App.newDocument()

p1 = App.Vector(0, 0, 0)
p2 = App.Vector(500, 0, 0)
p3 = App.Vector(250, 0, 0)

wire = Draft.make_wire([p1, p2])

Draft.split(wire, p3, 1)
doc.recompute()
}}
}}
<translate>
<translate>

Revision as of 09:06, 25 May 2021

This documentation is a work in progress. Please don't mark it as translatable since it will change in the next hours and days.

Draft Split

Menu location
Modification → Split
Workbenches
Draft
Default shortcut
S P
Introduced in version
0.18
See also
Draft Join

Description

The Draft Split tool attempts to split an existing Draft Wire or Draft Line at a specified edge.

Usage

  1. Press the Draft Split button or press S then P keys.
  2. Hover over or near a wire at the point where you want to split it. The wire is highlighted. Click to split.

If the wire is open, you will create two wires, each ending at the point at which you clicked.

If the wire is closed, the edge which you clicked will be turned into its own open wire, and the remainder will convert into an open wire. You can think of this as "detaching" the selected wire.

Options

There are no options for this tool. Either it works with the selected objects or not.

Notes

  • If an open wire is split and the clicked point does not lie exactly on the selected edge, the new point will not be collinear with that former edge. Use an appropriate Draft Snap option to prevent this.
  • To split objects that are not Draft Lines or Draft Wires you can try using Draft Upgrade on them one or more times first.
  • The counterpart to this tool is the Draft Join operation.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To split wires use the split method of the Draft module. This method returns None.

split(wire, newPoint, edgeIndex)
  • wire the wire object to be split.
  • newPoint the point where the split should occur.
  • edgeIndex index of the edge where the split should occur (1-based).

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

p1 = App.Vector(0, 0, 0)
p2 = App.Vector(500, 0, 0)
p3 = App.Vector(250, 0, 0)

wire = Draft.make_wire([p1, p2])

Draft.split(wire, p3, 1)
doc.recompute()