Base class for FreeCAD wrapping of libarea. More...
#include <Area.h>
Classes | |
struct | Shape |
Public Member Functions | |
void | add (const TopoDS_Shape &shape, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OPCODE)) |
Add a child shape with given operation code. More... | |
Area (const Area &other, bool deep_copy=true) | |
Area (const AreaParams *params=NULL) | |
Declare all parameters defined in #AREA_PARAMS_ALL as member variable. More... | |
void | clean (bool deleteShapes=false) |
Clean internal caches. More... | |
const std::list< Shape > | getChildren () const |
const AreaParams & | getParams () const |
Get the current configuration. More... | |
TopoDS_Shape | getPlane (gp_Trsf *trsf=0) |
Return the current active workplane. More... | |
std::size_t | getSectionCount () |
Return the number of sections. More... | |
TopoDS_Shape | getShape (int index=-1) |
Get the combined shape. More... | |
bool | isBuilt () const |
TopoDS_Shape | makeOffset (int index=-1, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OFFSET), int reoirent=0, bool from_center=false) |
Generate an offset of the combined shape. More... | |
TopoDS_Shape | makePocket (int index=-1, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_POCKET)) |
Make a pocket of the combined shape. More... | |
std::vector< std::shared_ptr< Area > > | makeSections (PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_SECTION_EXTRA), const std::vector< double > &heights=std::vector< double >(), const TopoDS_Shape &plane=TopoDS_Shape()) |
Make a pocket of the combined shape. More... | |
void | setParams (const AreaParams ¶ms) |
Config this Area object. More... | |
void | setPlane (const TopoDS_Shape &shape) |
Set a working plane. More... | |
virtual | ~Area () |
Public Member Functions inherited from Base::BaseClass | |
BaseClass () | |
Construction. More... | |
virtual PyObject * | getPyObject (void) |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId (void) const |
bool | isDerivedFrom (const Type type) const |
virtual void | setPyObject (PyObject *) |
virtual | ~BaseClass () |
Destruction. More... | |
Static Public Member Functions | |
static void | abort (bool aborting) |
static bool | aborting () |
static int | addShape (CArea &area, const TopoDS_Shape &shape, const gp_Trsf *trsf=NULL, double deflection=0.01, const TopoDS_Shape *plane=NULL, bool force_coplanar=true, CArea *areaOpen=NULL, bool to_edges=false, bool reorient=true) |
Add a OCC generic shape to CArea. More... | |
static void | addWire (CArea &area, const TopoDS_Wire &wire, const gp_Trsf *trsf=NULL, double deflection=0.01, bool to_edges=false) |
Add a OCC wire shape to CArea. More... | |
static const AreaStaticParams & | getDefaultParams () |
static bool | isCoplanar (const TopoDS_Shape &s1, const TopoDS_Shape &s2) |
Check if two OCC shape is coplanar. More... | |
static int | project (TopoDS_Shape &out, const TopoDS_Shape &in, const AreaParams *params=0) |
static void | setDefaultParams (const AreaStaticParams ¶ms) |
static void | setWireOrientation (TopoDS_Wire &wire, const gp_Dir &dir, bool ccw) |
static void | showShape (const TopoDS_Shape &shape, const char *name, const char *fmt=0,...) |
static std::list< TopoDS_Shape > | sortWires (const std::list< TopoDS_Shape > &shapes, bool has_start=false, gp_Pnt *pstart=NULL, gp_Pnt *pend=NULL, double *stepdown_hint=NULL, short *arc_plane=NULL, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_SORT)) |
Group shapes by their plane, and return a list of sorted wires. More... | |
static void | toPath (Toolpath &path, const std::list< TopoDS_Shape > &shapes, const gp_Pnt *pstart=NULL, gp_Pnt *pend=NULL, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_PATH)) |
Convert a list of wires to gcode. More... | |
static TopoDS_Shape | toShape (const CArea &area, bool fill, const gp_Trsf *trsf=NULL, int reoirent=0) |
Convert curves in CArea into an OCC shape. More... | |
static TopoDS_Shape | toShape (const CCurve &curve, const gp_Trsf *trsf=NULL, int reorient=0) |
Convert a single curve into an OCC wire. More... | |
Static Public Member Functions inherited from Base::BaseClass | |
static void * | create (void) |
static Type | getClassTypeId (void) |
static void | init (void) |
Protected Member Functions | |
void | addToBuild (CArea &area, const TopoDS_Shape &shape) |
Called by build() to add children shape. More... | |
void | build () |
Called internally to combine children shapes for further processing. More... | |
void | explode (const TopoDS_Shape &shape) |
TopoDS_Shape | findPlane (const TopoDS_Shape &shape, gp_Trsf &trsf) |
std::list< Shape > | getProjectedShapes (const gp_Trsf &trsf, bool inverse=true) const |
void | makeOffset (std::list< std::shared_ptr< CArea > > &areas, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OFFSET), bool from_center=false) |
Obtain a list of offset areas. More... | |
TopoDS_Shape | makePocket () |
Make a pocket of the combined shape. More... | |
TopoDS_Shape | toShape (CArea &area, short fill, int reorient=0) |
Called internally to obtain the combined children shapes. More... | |
Protected Attributes | |
std::unique_ptr< CArea > | myArea |
std::unique_ptr< CArea > | myAreaOpen |
bool | myHaveFace |
bool | myHaveSolid |
AreaParams | myParams |
bool | myProjecting |
std::vector< std::shared_ptr< Area > > | mySections |
TopoDS_Shape | myShape |
bool | myShapeDone |
TopoDS_Shape | myShapePlane |
std::list< Shape > | myShapes |
int | mySkippedShapes |
gp_Trsf | myTrsf |
TopoDS_Shape | myWorkPlane |
Static Protected Attributes | |
static bool | s_aborting |
static AreaStaticParams | s_params |
Additional Inherited Members | |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
Detailed Description
Base class for FreeCAD wrapping of libarea.
Constructor & Destructor Documentation
◆ Area() [1/2]
Path::Area::Area | ( | const AreaParams * | params = NULL | ) |
Declare all parameters defined in #AREA_PARAMS_ALL as member variable.
◆ Area() [2/2]
◆ ~Area()
|
virtual |
References clean().
Member Function Documentation
◆ abort()
|
static |
References aborting(), and s_aborting.
◆ aborting()
|
static |
References s_aborting.
Referenced by abort().
◆ add()
void Area::add | ( | const TopoDS_Shape & | shape, |
PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OPCODE) | |||
) |
Add a child shape with given operation code.
No validation is done at this point. Exception will be thrown when asking for output shape, if any of the children shapes is not valid or not coplanar
shape:
the child shapeop:
operation code, see #AREA_PARAMS_OPCODE
References clean(), myHaveSolid, and myShapes.
Referenced by Path::AreaPy::add(), build(), Path::FeatureArea::execute(), getShape(), and project().
◆ addShape()
|
static |
Add a OCC generic shape to CArea.
area:
output converted curved object to hereshape:
input shape objecttrsf:
optional transform matrix to transform the wire shape into XY0 plane.deflection:
for defecting non circular curvesplane:
a shape for testing coplanarforce_coplaner:
if true, discard non-coplanar shapes.areaOpen:
for collecting open curves. If not supplied, open curves are added toarea
to_edges:
separate open wires to individual edgesreorient:
reorient closed wires for wire only shape
- Returns
- Returns the number of non coplaner. Planar testing only happens if
plane
is supplied
References addWire(), isCoplanar(), CArea::m_curves, and CArea::Reorder().
Referenced by addToBuild().
◆ addToBuild()
|
protected |
Called by build() to add children shape.
Mainly for checking if there is any faces for auto fill
References addShape(), getPlane(), CArea::m_curves, myArea, myAreaOpen, myHaveFace, myHaveSolid, myParams, myProjecting, mySkippedShapes, and myTrsf.
Referenced by build().
◆ addWire()
|
static |
Add a OCC wire shape to CArea.
area:
output converted curved object to herewire:
input wire objecttrsf:
optional transform matrix to transform the wire shape into XY0 plane.deflection:
for discretizing non circular curvesto_edges:
if true, discretize all curves, and insert as open line segments
References CArea::append(), CCurve::append(), CCurve::IsClosed(), CCurve::m_vertices, CArea::move(), and CCurve::UnFitArcs().
Referenced by addShape(), and explode().
◆ build()
|
protected |
Called internally to combine children shapes for further processing.
References add(), WireJoiner::add(), addToBuild(), build(), clean(), WireJoiner::comp, explode(), getPlane(), getProjectedShapes(), isBuilt(), WireJoiner::join(), CArea::m_curves, makeSections(), myArea, myAreaOpen, myHaveSolid, myParams, myProjecting, mySections, myShapes, mySkippedShapes, myTrsf, myWorkPlane, PARAM_FIELDS, PARAM_FNAME, and toShape().
Referenced by build(), and getShape().
◆ clean()
void Area::clean | ( | bool | deleteShapes = false | ) |
Clean internal caches.
The combined shapes is cached internally to make other operation more efficient, such as makeOffset() and makePocket()
deleteShapes:
if true, delete all children shapes.
References myArea, myAreaOpen, myHaveFace, myHaveSolid, mySections, myShape, myShapeDone, myShapePlane, and myShapes.
Referenced by add(), build(), Path::FeatureArea::execute(), Path::AreaPy::getShape(), shipOutlineDraw.Preview.Preview::reinit(), shipCreateShip.Preview.Preview::reinit(), setParams(), setPlane(), shipAreasCurve.Preview.Preview::update(), shipOutlineDraw.Preview.Preview::update(), shipCreateShip.Preview.Preview::update(), and ~Area().
◆ explode()
|
protected |
References addWire(), getPlane(), isCoplanar(), myArea, myParams, mySkippedShapes, and myTrsf.
Referenced by build().
◆ findPlane()
|
protected |
Referenced by makeSections(), and setPlane().
◆ getChildren()
const std::list<Shape> Path::Area::getChildren | ( | ) | const |
Referenced by Path::AreaPy::getShapes().
◆ getDefaultParams()
|
static |
References s_params.
◆ getParams()
const AreaParams& Path::Area::getParams | ( | ) | const |
Get the current configuration.
Referenced by Path::AreaPy::getParams(), and Path::AreaPy::setParams().
◆ getPlane()
TopoDS_Shape Area::getPlane | ( | gp_Trsf * | trsf = 0 | ) |
Return the current active workplane.
trsf:
optional return of a transformation matrix that will bring the found plane to XY0 plane.
If no workplane is set using setPlane(), the active workplane is derived from the added children shapes using the same algorithm empolyed by setPlane().
References myShapePlane, myShapes, myTrsf, and myWorkPlane.
Referenced by addToBuild(), build(), explode(), and makeSections().
◆ getProjectedShapes()
|
protected |
References myParams, myShapes, mySkippedShapes, and project().
Referenced by build(), and makeSections().
◆ getSectionCount()
std::size_t Path::Area::getSectionCount | ( | ) |
Return the number of sections.
Referenced by Path::FeatureArea::execute(), and Path::AreaPy::getSections().
◆ getShape()
TopoDS_Shape Area::getShape | ( | int | index = -1 | ) |
Get the combined shape.
index:
index of the section, -1 for all sections. No effect on non-sectioned area.
References add(), build(), makeOffset(), makePocket(), myArea, myParams, myShape, myShapeDone, PARAM_FIELDS, CArea::Thicken(), and toShape().
Referenced by Path::FeatureArea::execute(), and project().
◆ isBuilt()
bool Area::isBuilt | ( | ) | const |
References myArea, and mySections.
Referenced by build(), and Path::FeatureArea::mustExecute().
◆ isCoplanar()
|
static |
Check if two OCC shape is coplanar.
Referenced by addShape(), and explode().
◆ makeOffset() [1/2]
TopoDS_Shape Path::Area::makeOffset | ( | int | index = -1 , |
PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OFFSET) | , | ||
int | reoirent = 0 , |
||
bool | from_center = false |
||
) |
Generate an offset of the combined shape.
See #AREA_PARAMS_OFFSET for description of the arguments. If more than one offset is requested, a compound shape is return containing all offset shapes as wires regardless of Fill
setting.
◆ makeOffset() [2/2]
|
protected |
Obtain a list of offset areas.
See #AREA_PARAMS_OFFSET for description of the arguments.
Referenced by getShape(), and Path::AreaPy::makeOffset().
◆ makePocket() [1/2]
|
protected |
Make a pocket of the combined shape.
User #AREA_PARAMS_POCKET setting in myParams.
Referenced by getShape(), and Path::AreaPy::makePocket().
◆ makePocket() [2/2]
TopoDS_Shape Path::Area::makePocket | ( | int | index = -1 , |
PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_POCKET) | |||
) |
Make a pocket of the combined shape.
See #AREA_PARAMS_POCKET for description of the arguments.
◆ makeSections()
std::vector< shared_ptr< Area > > Area::makeSections | ( | PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_SECTION_EXTRA) | , |
const std::vector< double > & | heights = std::vector<double>() , |
||
const TopoDS_Shape & | plane = TopoDS_Shape() |
||
) |
Make a pocket of the combined shape.
heights:
optional customized heights of each section. The meaning of each height depends on section mode. If none is given, the section heights is determined by the section settings in this Area object (configured through setParams()).plane:
the section plane if the section mode is SectionModeWorkplane, otherwise ignored
See #AREA_PARAMS_EXTRA for description of the arguments. Currently, there is only one argument, namely mode
for section mode.
References Part::FaceMaker::addWire(), Part::FaceMaker::Build(), findPlane(), getPlane(), getProjectedShapes(), myParams, myShapes, project(), Part::FaceMakerBullseye::setPlane(), and showShape().
Referenced by build(), and Path::AreaPy::makeSections().
◆ project()
|
static |
References add(), WireJoiner::comp, Path::AreaParams::dump(), WireJoiner::edges, WireJoiner::findClosedWires(), getShape(), myParams, myProjecting, showShape(), and WireJoiner::splitEdges().
Referenced by getProjectedShapes(), and makeSections().
◆ setDefaultParams()
|
static |
References s_params.
Referenced by PathScripts.PathPreferencesPathJob.JobPreferencesPage::saveSettings().
◆ setParams()
void Area::setParams | ( | const AreaParams & | params | ) |
Config this Area object.
References clean(), and myParams.
Referenced by Path::FeatureArea::execute(), and Path::AreaPy::setParams().
◆ setPlane()
void Area::setPlane | ( | const TopoDS_Shape & | shape | ) |
Set a working plane.
shape:
a shape defining a working plane.
The supplied shape does not need to be planar. Area will try to find planar sub-shape (face, wire or edge). If more than one planar sub-shape is found, it will prefer the top plane parallel to XY0 plane.
If no working plane are set, Area will try to find a working plane from the added children shape using the same algorithm
References clean(), findPlane(), myTrsf, and myWorkPlane.
Referenced by Path::FeatureArea::execute(), Path::AreaPy::setPlane(), and Path::AreaPy::setWorkplane().
◆ setWireOrientation()
|
static |
◆ showShape()
|
static |
◆ sortWires()
|
static |
Group shapes by their plane, and return a list of sorted wires.
The output wires is ordered by its occupied plane, and sorted to minimize traval distance
shapes:
input list of shapes.has_start:
if false or pstart is 0, then a start point will be auto selected.pstart:
optional start point. If has_start is false, then the auto selected start point will be returned with this point if not NULL.pend:
optional output containing the ending point of the returnedstepdown_hint:
optional output of a hint of step down as the max distance between two sections.arc_plane:
optional arc plane selection, if given the found plane will be returned. See #AREA_PARAMS_ARC_PLANE for more details.
See #AREA_PARAMS_SORT for other arguments
- Returns
- sorted wires
Referenced by toPath().
◆ toPath()
|
static |
Convert a list of wires to gcode.
path:
output toolpathshapes:
input list of shapespstart:
output start point,pend:
optional output containing the ending point of the returned
See #AREA_PARAMS_PATH for other arguments
References PARAM_FARG, PARAM_FIELDS, PARAM_REF, and sortWires().
Referenced by Path::FeatureShape::execute().
◆ toShape() [1/3]
|
protected |
Called internally to obtain the combined children shapes.
Referenced by build(), and getShape().
◆ toShape() [2/3]
|
static |
Convert curves in CArea into an OCC shape.
area:
input area objectfill:
if true, create a face object from the wirestrsf:
optional transform matrix to transform the shape back into its original position.
◆ toShape() [3/3]
|
static |
Convert a single curve into an OCC wire.
curve:
input curve objecttrsf:
optional transform matrix to transform the shape back into its original position.
Member Data Documentation
◆ myArea
|
protected |
Referenced by addToBuild(), build(), clean(), explode(), getShape(), and isBuilt().
◆ myAreaOpen
|
protected |
Referenced by addToBuild(), build(), and clean().
◆ myHaveFace
|
protected |
Referenced by addToBuild(), and clean().
◆ myHaveSolid
|
protected |
Referenced by add(), addToBuild(), build(), and clean().
◆ myParams
|
protected |
Referenced by addToBuild(), build(), explode(), getProjectedShapes(), getShape(), makeSections(), project(), and setParams().
◆ myProjecting
|
protected |
Referenced by addToBuild(), build(), and project().
◆ mySections
|
protected |
◆ myShape
|
protected |
Referenced by clean(), and getShape().
◆ myShapeDone
|
protected |
Referenced by clean(), and getShape().
◆ myShapePlane
|
protected |
Referenced by clean(), and getPlane().
◆ myShapes
|
protected |
Referenced by add(), build(), clean(), getPlane(), getProjectedShapes(), and makeSections().
◆ mySkippedShapes
|
mutableprotected |
Referenced by addToBuild(), build(), explode(), and getProjectedShapes().
◆ myTrsf
|
protected |
Referenced by addToBuild(), build(), explode(), getPlane(), and setPlane().
◆ myWorkPlane
|
protected |
Referenced by build(), getPlane(), and setPlane().
◆ s_aborting
|
staticprotected |
Referenced by abort(), and aborting().
◆ s_params
|
staticprotected |
Referenced by getDefaultParams(), and setDefaultParams().
The documentation for this class was generated from the following files:
- src/Mod/Path/App/Area.h
- src/Mod/Path/App/Area.cpp