-
Notifications
You must be signed in to change notification settings - Fork 2
PathArea API Reference
🏠 Home | 📋 Current State | 📖 API Reference
Quick reference for Area functions. See PathArea-notes.md for comprehensive guide.
- Area.add() - Boolean operations on polygons
- Area.makeOffset() - Offset boundaries
- Area.makePocket() - Generate clearing patterns
- Area.makeSections() - Create 3D sections
add((shape...), op=0)Add TopoShape(s) with given operation code
Parameters:
-
op (0): Boolean operation code
- 0 = Union
- 1 = Difference
- 2 = Intersection
- 3 = Xor
- 4 = Compound
For the first four operations, see ClipperLib Boolean Operations.
'Compound' means no operation, normally used to do Area.sortWires().
Behavior:
The first shape's wires will be unioned together regardless of the op code given
(except for 'Compound'). Subsequent shape's wire will be combined using the op code.
All shape wires shall be coplanar, and are used to determine a working plane for face
making and offseting. You can call setPlane() to supply a reference shape to determine
the workplane in case the added shapes are all colinear lines.
makeOffset(index=-1, offset=0.0, extra_pass=0, stepover=0.0)Make a 2D offset of the shape.
Parameters:
-
index (-1): The index of the section. -1 means all sections. No effect on planar shape.
-
offset (0.0): Offset value, positive for expansion, negative for shrinking
-
extra_pass (0): Number of extra offset passes to generate.
-
stepover (0.0): Cutter diameter to step over on each pass. If =0, use Offset
makePocket(index=-1, mode=0, tool_radius=1.0, extra_offset=0.0,
stepover=0.0, from_center=true, angle=45,
angle_shift=0.0, shift=0.0)Generate pocket toolpath of the shape.
Parameters:
-
index (-1): The index of the section. -1 means all sections. No effect on planar shape.
-
mode (0): Pocket toolpath pattern
- 0 = None
- 1 = ZigZag
- 2 = Offset
- 3 = Spiral
- 4 = ZigZagOffset
- 5 = Line
- 6 = Grid
- 7 = Triangle
-
tool_radius (1.0): Tool radius for pocketing
-
extra_offset (0.0): Extra offset for pocketing
-
stepover (0.0): Cutter diameter to step over on each pass. If =0, use ToolRadius.
-
from_center (true): Start pocketing from center
-
angle (45): Pattern angle in degrees
-
angle_shift (0.0): Pattern angle shift for each section
-
shift (0.0): Pattern shift distance for each section. The pocket pattern will be shifted in orthogonal direction by this amount for each section. This gives a 3D pattern mainly for 3D printing. The shift only applies to 'Offset', 'Grid' and 'Triangle'
makeSections(mode=2, project=false, heights=[], plane=None)Make a list of area holding the sectioned children shapes on given heights
Parameters:
-
mode (2): Section offset coordinate mode
- 0 = Absolute - The absolute Z height (given in SectionOffset) to start slicing
- 1 = BoundBox - Relative Z height to the bounding box of all the children shapes
- 2 = Workplane - Relative to workplane, minus SectionOffset
Note: OCC has trouble getting the minimum bounding box of some solids, particularly those with non-planar surfaces. It is recommended to use Workplane to specify the intended starting z height.
-
project (false): The section is produced by normal projecting the outline of all added shapes to the section plane, instead of slicing.
-
heights ([]): A list of section heights, the meaning of the value is determined by 'mode'. If not specified, the current SectionCount and SectionOffset of this Area is used.
-
plane (None): Optional shape to specify a section plane. If not given, the current workplane of this Area is used if section mode is 'Workplane'.