PathArea notes - sliptonic/FreeCAD GitHub Wiki

Background

PathArea is a wrapper for libarea written by user Realthunder. LibArea is an implementation of the clipper lib for polygon offsetting. ClipperLib was written by Angus Johnson.

threads and links

Most discussion about the use of PathArea occurs in the new era thread

An older thread predates it and might have some tidbits.

Realthunder also created a topic for the Pull request which got some discussion.

The original pull Request on github has some comments.

Authoritative documentation on ClipperLib

Main Site

types of booleans

fill type

simplify pologons

distance

ClipperOffset end type

Round joint precision

Miter limit for joint type Miter

Simple Samples

# This is the profiling job
import Path
profile = Path.Area(Offset=1,SectionCount=-1)
profile.add(workpiece.Shape)
Path.show(Path.fromShapes(profile.getShape()))
# This is the pocketing job
import Path
pocket = Path.Area(PocketMode=4,SectionCount=-1)
pocket.add((workpiece.Shape,model.Shape),op=1)
Path.show(Path.fromShapes(pocket.getShape()))

Params helper

duplicate existing area object with params

new_area = Path.Area(**area.getParams())

set params to a dictionary

 setParams(**params)

workplane

workplane is optional. If not set, Area will guess and use the top face parallel to XY plane. Here's an easy way to set it to the XY plane itself.

area.setPlane(Part.makeCircle(10))

Docstring stuff:

setParam(key=value...): Set algorithm parameters. You can call getParamsDesc() to get a list of supported parameters and their descriptions.

  • Tolerance(Precision::Confusion()): Point coincidence tolerance

  • FitArcs(true): Enable arc fitting

  • Simplify(false): Simplify polygons after operation. See https://goo.gl/Mh9XK1

  • CleanDistance(0.0): Clean polygon smaller than this distance. See https://goo.gl/jox3JY

  • Accuracy(0.01): Arc fitting accuracy

  • Unit(1.0): Scaling factor for conversion to inch

  • MinArcPoints(4): Minimum segments for arc discretization

  • MaxArcPoints(100): Maximum segments for arc discretization

  • ClipperScale(10000.0): ClipperLib operate on intergers. This is the scale factor to convert floating points.

  • Fill(2): 0=None,1=Face,2=Auto. Fill the output wires to make a face. Auto means make a face if any of the children has a face.

  • Coplanar(2): 0=None,1=Check,2=Force. Specifies the way to check coplanar. 'Force' will discard non coplaner shapes, but 'Check' only gives warning.

  • Reorient(true): Re-orient closed wires in wire only shapes so that inner wires become holes.

  • Explode(false): If true, Area will explode the first shape into disconnected open edges, with all curves discretized, so that later operations like 'Difference' behave like wire cutting. Without exploding, 'Difference' in ClipperLib behave like face cutting.

  • OpenMode(0): 0=None,1=Union,2=Edges. Specify how to handle open wires. 'None' means combin without openeration. 'Edges' means separate to edges before Union. ClipperLib seems to have an. urge to close open wires.

  • Deflection(0.01): Deflection for non circular curve discretization. It also also used for discretizing circular wires when you 'Explode' the shape for wire operations

  • SubjectFill(0): 0=NonZero,1=EvenOdd,2=Positive,3=Negative. ClipperLib subject fill type. See https://goo.gl/5pYQQP

  • ClipFill(0): 0=NonZero,1=EvenOdd,2=Positive,3=Negative. ClipperLib clip fill type. See https://goo.gl/5pYQQP

  • Offset(0.0): Offset value, positive for expansion, negative for shrinking

  • ExtraPass(0): Number of extra offset pass to generate.

  • Stepover(0.0): Cutter diameter to step over on each pass. If =0, use Offset

  • JoinType(0): 0=Round,1=Square,2=Miter. ClipperOffset join type. See https://goo.gl/4odfQh

  • EndType(0): 0=OpenRound,1=ClosedPolygon,2=ClosedLine,3=OpenSquare,4=OpenButt. ClipperOffset end type. See https://goo.gl/tj7gkX

  • MiterLimit(2.0): Miter limit for joint type Miter. See https://goo.gl/K8xX9h

  • RoundPreceision(0.0): Round joint precision. If =0, it defaults to Accuracy. See https://goo.gl/4odfQh

  • PocketMode(0): 0=None,1=ZigZag,2=Offset,3=Spiral,4=ZigZagOffset,5=Line,6=Grid,7=Triangle. Selects the pocket toolpath pattern

  • ToolRadius(1.0): Tool radius for pocketing

  • PocketExtraOffset(0.0): Extra offset for pocketing

  • PocketStepover(0.0): Cutter diameter to step over on each pass. If =0, use ToolRadius.

  • FromCenter(true): Start pocketing from center

  • Angle(45): Pattern angle in degree

  • AngleShift(0.0): Pattern angle shift for each section

  • Shift(0.0): Pattern shift distance for each section. The pocket patter will be shifted in othgnal 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'

  • Thicken(false): Thicken the resulting wires with ToolRadius

  • SectionCount(0): Number of sections to generate. -1 means full sections.

  • Stepdown(1.0): Step down distance for each section. Positive value means going from top down, and negative the other way round

  • SectionOffset(0.0): Offset for the first section. The direction of the offset is determined by the section direction (i.e. the signess of Stepdown). If going from top down, a positive value means offset downward, and if bottom up, it means upward

  • SectionTolerance(1e-5): Offset value added when hitting the boundary. When the section hits or over the shape boundary, a section with the height of that boundary will be created. A small offset is usually required to avoid the tagnetial cut.

  • SectionMode(2): 0=Absolute,1=BoundBox,2=Workplane. Section offset coordinate mode. 'Absolute' means the absolute Z height (given in SectionOffset) to start slicing. 'BoundBox' means relative Z height to the bounding box of all the children shape. 'Workplane' means relative to workplane, minus SectionOffset. Note that OCC has trouble getting the minimum bounding box of some solids, particularly those with non-planar surface. It is recommended to use Workplane to specifiy the intended starting z height.

  • Project(false): The section is produced by normal pojecting the outline of all added shapes to the section plane, instead of slicing.