Finalizing Python interface bindings for CAM.

This commit is contained in:
Ian 'z0r0' Abreu
2025-08-31 15:24:02 -04:00
parent c63ac5ffbc
commit 9008cdb8ee
26 changed files with 36 additions and 957 deletions

View File

@@ -4,19 +4,13 @@ from Base.BaseClass import BaseClass
from Base.Metadata import export
@export(
Father="BaseClassPy",
Name="AreaPy",
Twin="Area",
TwinPointer="Area",
Include="Mod/CAM/App/Area.h",
Namespace="Path",
FatherInclude="Base/BaseClassPy.h",
FatherNamespace="Base",
ReadOnly=["Sections", "Shapes"],
Constructor=True,
Delete=True,
)
class AreaPy(BaseClass):
class Area(BaseClass):
"""
FreeCAD python wrapper of libarea

View File

@@ -1,131 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="BaseClassPy"
Name="AreaPy"
Twin="Area"
TwinPointer="Area"
Include="Mod/CAM/App/Area.h"
Namespace="Path"
FatherInclude="Base/BaseClassPy.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="Zheng, Lei" EMail="realthunder.dev@gmail.com" />
<UserDocu>
FreeCAD python wrapper of libarea
Path.Area(key=value ...)
The constructor accepts the same parameters as setParams(...) to configure the object
All arguments are optional.
</UserDocu>
</Documentation>
<Methode Name="add" Keyword='true'>
<Documentation>
<UserDocu></UserDocu>
</Documentation>
</Methode>
<Methode Name="setPlane">
<Documentation>
<UserDocu>setPlane(shape): Set the 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</UserDocu>
</Documentation>
</Methode>
<Methode Name="getShape" Keyword='true'>
<Documentation>
<UserDocu>getShape(index=-1,rebuild=False): Return the resulting shape
* index (-1): the index of the section. -1 means all sections. No effect on planar shape.
* rebuild: clean the internal cache and rebuild</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeOffset" Keyword='true'>
<Documentation>
<UserDocu>Make an offset of the shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="makePocket" Keyword='true'>
<Documentation>
<UserDocu>Generate pocket toolpath of the shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeSections" Keyword="true">
<Documentation>
<UserDocu>Make a list of area holding the sectioned children shapes on given heights.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getClearedArea">
<Documentation>
<UserDocu>Gets the area cleared when a tool of the specified diameter follows the gcode represented in the path, ignoring cleared space above zmax and path segments that don't affect space within the x/y space of bbox.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getRestArea">
<Documentation>
<UserDocu>Rest machining: Gets the area left to be machined, assuming some of this area has already been cleared by previous tool paths.</UserDocu>
</Documentation>
</Methode>
<Methode Name="toTopoShape">
<Documentation>
<UserDocu>Convert the Area object to a TopoShape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setParams" Keyword="true">
<Documentation>
<UserDocu>Set algorithm parameters.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setDefaultParams" Keyword="true">
<Documentation>
<UserDocu>Static method to set the default parameters of all following Path.Area, plus the following additional parameters.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getDefaultParams">
<Documentation>
<UserDocu>Static method to return the current default parameters.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getParamsDesc" Keyword="true">
<Documentation>
<UserDocu>Returns a list of supported parameters and their descriptions.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getParams">
<Documentation>
<UserDocu>Get current algorithm parameters as a dictionary.</UserDocu>
</Documentation>
</Methode>
<Methode Name="abort" Keyword="true">
<Documentation>
<UserDocu>Abort the current operation.</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Sections" ReadOnly="true">
<Documentation>
<UserDocu>List of sections in this area.</UserDocu>
</Documentation>
<Parameter Name="Sections" Type="List"/>
</Attribute>
<Attribute Name="Workplane" ReadOnly="false">
<Documentation>
<UserDocu>The current workplane. If no plane is set, it is derived from the added shapes.</UserDocu>
</Documentation>
<Parameter Name="Workplane" Type="Object"/>
</Attribute>
<Attribute Name="Shapes" ReadOnly="true">
<Documentation>
<UserDocu>A list of tuple: [(shape,op), ...] containing the added shapes together with their operation code</UserDocu>
</Documentation>
<Parameter Name="Shapes" Type="List"/>
</Attribute>
</PythonExport>
</GenerateModel>

View File

@@ -21,44 +21,34 @@ set(Path_LIBS
FreeCADApp
)
generate_from_xml(CommandPy)
generate_from_xml(PathPy)
generate_from_xml(FeaturePathCompoundPy)
generate_from_xml(AreaPy)
generate_from_xml(FeatureAreaPy)
generate_from_xml(VoronoiPy)
generate_from_xml(VoronoiCellPy)
generate_from_xml(VoronoiEdgePy)
generate_from_xml(VoronoiVertexPy)
generate_from_py_(CommandPy)
generate_from_py_(PathPy)
generate_from_py_(FeaturePathCompoundPy)
generate_from_py_(AreaPy)
generate_from_py_(FeatureAreaPy)
generate_from_py_(VoronoiPy)
generate_from_py_(VoronoiCellPy)
generate_from_py_(VoronoiEdgePy)
generate_from_py_(VoronoiVertexPy)
generate_from_py(Command)
generate_from_py(Path)
generate_from_py(FeaturePathCompound)
generate_from_py(Area)
generate_from_py(FeatureArea)
generate_from_py(Voronoi)
generate_from_py(VoronoiCell)
generate_from_py(VoronoiEdge)
generate_from_py(VoronoiVertex)
SET(Python_SRCS
CommandPy.xml
Command.pyi
CommandPyImp.cpp
PathPy.xml
Path.pyi
PathPyImp.cpp
FeaturePathCompoundPy.xml
FeaturePathCompound.pyi
FeaturePathCompoundPyImp.cpp
AreaPy.xml
Area.pyi
AreaPyImp.cpp
FeatureAreaPy.xml
FeatureArea.pyi
FeatureAreaPyImp.cpp
VoronoiPy.xml
Voronoi.pyi
VoronoiPyImp.cpp
VoronoiCellPy.xml
VoronoiCell.pyi
VoronoiCellPyImp.cpp
VoronoiEdgePy.xml
VoronoiEdge.pyi
VoronoiEdgePyImp.cpp
VoronoiVertexPy.xml
VoronoiVertex.pyi
VoronoiVertexPyImp.cpp
)

View File

@@ -3,19 +3,13 @@ from Base.Persistence import Persistence
from Base.Placement import Placement
@export(
Father="PersistencePy",
Name="CommandPy",
Twin="Command",
TwinPointer="Command",
Include="Mod/CAM/App/Command.h",
Namespace="Path",
FatherInclude="Base/PersistencePy.h",
FatherNamespace="Base",
Delete=True,
Constructor=True,
)
@class_declarations("mutable Py::Dict parameters_copy_dict;")
class CommandPy(Persistence):
class Command(Persistence):
"""
Command([name],[parameters]): Represents a basic Gcode command
name (optional) is the name of the command, ex. G1

View File

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="PersistencePy"
Name="CommandPy"
Twin="Command"
TwinPointer="Command"
Include="Mod/CAM/App/Command.h"
Namespace="Path"
FatherInclude="Base/PersistencePy.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="Yorik van Havre" EMail="yorik@uncreated.net" />
<UserDocu>Command([name],[parameters]): Represents a basic Gcode command
name (optional) is the name of the command, ex. G1
parameters (optional) is a dictionary containing string:number
pairs, or a placement, or a vector</UserDocu>
</Documentation>
<Attribute Name="Name" ReadOnly="false">
<Documentation>
<UserDocu>The name of the command</UserDocu>
</Documentation>
<Parameter Name="Name" Type="String"/>
</Attribute>
<Attribute Name="Parameters" ReadOnly="false">
<Documentation>
<UserDocu>The parameters of the command</UserDocu>
</Documentation>
<Parameter Name="Parameters" Type="Dict"/>
</Attribute>
<Attribute Name="Placement" ReadOnly="false">
<Documentation>
<UserDocu>The coordinates of the endpoint of the command</UserDocu>
</Documentation>
<Parameter Name="Placement" Type="Object"/>
</Attribute>
<Methode Name="toGCode" Const="true">
<Documentation>
<UserDocu>toGCode(): returns a GCode representation of the command</UserDocu>
</Documentation>
</Methode>
<Methode Name="setFromGCode">
<Documentation>
<UserDocu>setFromGCode(): sets the path from the contents of the given GCode string</UserDocu>
</Documentation>
</Methode>
<Methode Name="transform">
<Documentation>
<UserDocu>transform(Placement): returns a copy of this command transformed by the given placement</UserDocu>
</Documentation>
</Methode>
<ClassDeclarations>mutable Py::Dict parameters_copy_dict;</ClassDeclarations>
</PythonExport>
</GenerateModel>

View File

@@ -5,16 +5,10 @@ from Base.Metadata import export
from App.DocumentObject import DocumentObject
@export(
Father="DocumentObjectPy",
Name="FeatureAreaPy",
Twin="FeatureArea",
TwinPointer="FeatureArea",
Include="Mod/CAM/App/FeatureArea.h",
Namespace="Path",
FatherInclude="App/DocumentObjectPy.h",
FatherNamespace="App",
)
class FeatureAreaPy(DocumentObject):
class FeatureArea(DocumentObject):
"""
This class handles Path Area features
"""

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="DocumentObjectPy"
Name="FeatureAreaPy"
Twin="FeatureArea"
TwinPointer="FeatureArea"
Include="Mod/CAM/App/FeatureArea.h"
Namespace="Path"
FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="App">
<Documentation>
<Author Licence="LGPL" Name="Zheng, Lei" EMail="realthunder.dev@gmail.com" />
<UserDocu>This class handles Path Area features</UserDocu>
</Documentation>
<Methode Name="getArea">
<Documentation>
<UserDocu>Return a copy of the encapsulated Python Area object.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setParams" Keyword="true">
<Documentation>
<UserDocu>setParams(key=value...): Convenient function to configure this feature.
Same usage as Path.Area.setParams(). This function stores the parameters in the properties.</UserDocu>
</Documentation>
</Methode>
<Attribute Name="WorkPlane" ReadOnly="false">
<Documentation>
<UserDocu>The current workplane. If no plane is set, it is derived from the added shapes.</UserDocu>
</Documentation>
<Parameter Name="WorkPlane" Type="Object"/>
</Attribute>
<CustomAttributes />
</PythonExport>
</GenerateModel>

View File

@@ -5,16 +5,11 @@ from Base.Metadata import export
from App.DocumentObject import DocumentObject
@export(
Father="DocumentObjectPy",
Name="FeaturePathCompoundPy",
Twin="FeaturePathCompound",
TwinPointer="FeatureCompound",
Include="Mod/CAM/App/FeaturePathCompound.h",
TwinPointer="FeatureCompound",
Namespace="Path",
FatherInclude="App/DocumentObjectPy.h",
FatherNamespace="App",
)
class FeaturePathCompoundPy(DocumentObject):
class FeaturePathCompound(DocumentObject):
"""
This class handles Path Compound features
"""

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="DocumentObjectPy"
Name="FeaturePathCompoundPy"
Twin="FeaturePathCompound"
TwinPointer="FeatureCompound"
Include="Mod/CAM/App/FeaturePathCompound.h"
Namespace="Path"
FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="App">
<Documentation>
<Author Licence="LGPL" Name="Yorik van Havre" EMail="yorik@uncreated.net" />
<UserDocu>This class handles Path Compound features</UserDocu>
</Documentation>
<Methode Name="addObject">
<Documentation>
<UserDocu>Add an object to the group</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeObject">
<Documentation>
<UserDocu>Remove an object from the group</UserDocu>
</Documentation>
</Methode>
<CustomAttributes />
</PythonExport>
</GenerateModel>

View File

@@ -4,19 +4,15 @@ from Base.Metadata import constmethod, export
from Base.Persistence import Persistence
@export(
Father="PersistencePy",
Name="PathPy",
Include="Mod/CAM/App/Path.h",
Twin="Toolpath",
TwinPointer="Toolpath",
Include="Mod/CAM/App/Path.h",
Namespace="Path",
FatherInclude="Base/PersistencePy.h",
FatherNamespace="Base",
ReadOnly=["Length", "Size", "BoundBox"],
Delete=True,
Constructor=True,
)
class PathPy(Persistence):
class Path(Persistence):
"""
Path([commands]): Represents a basic Gcode path
commands (optional) is a list of Path commands

View File

@@ -1,91 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="PersistencePy"
Name="PathPy"
Twin="Toolpath"
TwinPointer="Toolpath"
Include="Mod/CAM/App/Path.h"
Namespace="Path"
FatherInclude="Base/PersistencePy.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="Yorik van Havre" EMail="yorik@uncreated.net" />
<UserDocu>Path([commands]): Represents a basic Gcode path
commands (optional) is a list of Path commands</UserDocu>
</Documentation>
<Attribute Name="Length" ReadOnly="true">
<Documentation>
<UserDocu>the total length of this path in mm</UserDocu>
</Documentation>
<Parameter Name="Length" Type="Float"/>
</Attribute>
<Attribute Name="Size" ReadOnly="true">
<Documentation>
<UserDocu>the number of commands in this path</UserDocu>
</Documentation>
<Parameter Name="Size" Type="Long"/>
</Attribute>
<Attribute Name="Commands" ReadOnly="false">
<Documentation>
<UserDocu>the list of commands of this path</UserDocu>
</Documentation>
<Parameter Name="Commands" Type="List"/>
</Attribute>
<Attribute Name="Center" ReadOnly="false">
<Documentation>
<UserDocu>the center position for all rotational parameters</UserDocu>
</Documentation>
<Parameter Name="Center" Type="Object"/>
</Attribute>
<Attribute Name="BoundBox" ReadOnly="true">
<Documentation>
<UserDocu>the extent of this path</UserDocu>
</Documentation>
<Parameter Name="BoundBox" Type="Object"/>
</Attribute>
<Methode Name="addCommands">
<Documentation>
<UserDocu>adds a command or a list of commands at the end of the path</UserDocu>
</Documentation>
</Methode>
<Methode Name="insertCommand">
<Documentation>
<UserDocu>insertCommand(Command,[int]):
adds a command at the given position or at the end of the path</UserDocu>
</Documentation>
</Methode>
<Methode Name="deleteCommand">
<Documentation>
<UserDocu>deleteCommand([int]):
deletes the command found at the given position or from the end of the path</UserDocu>
</Documentation>
</Methode>
<Methode Name="setFromGCode">
<Documentation>
<UserDocu>sets the contents of the path from a gcode string</UserDocu>
</Documentation>
</Methode>
<Methode Name="toGCode" Const="true">
<Documentation>
<UserDocu>returns a gcode string representing the path</UserDocu>
</Documentation>
</Methode>
<Methode Name="copy" Const="true">
<Documentation>
<UserDocu>returns a copy of this path</UserDocu>
</Documentation>
</Methode>
<Methode Name="getCycleTime" Const="true">
<Documentation>
<UserDocu>return the cycle time estimation for this path in s</UserDocu>
</Documentation>
</Methode>
<!--<ClassDeclarations>
bool touched;
</ClassDeclarations>-->
</PythonExport>
</GenerateModel>

View File

@@ -4,19 +4,12 @@ from Base.BaseClass import BaseClass
from Base.Metadata import constmethod, export
@export(
Father="BaseClassPy",
Name="VoronoiPy",
PythonName="Path.Voronoi.Diagram",
Twin="Voronoi",
TwinPointer="Voronoi",
Include="Mod/CAM/App/Voronoi.h",
Namespace="Path",
FatherInclude="Base/BaseClassPy.h",
FatherNamespace="Base",
Constructor=True,
Delete=True,
)
class VoronoiPy(BaseClass):
class Voronoi(BaseClass):
"""
Voronoi([segments]): Create voronoi for given collection of line segments
"""

View File

@@ -4,20 +4,13 @@ from Base.BaseClass import BaseClass
from Base.Metadata import constmethod, export
@export(
Father="BaseClassPy",
Name="VoronoiCellPy",
Twin="VoronoiCell",
PythonName="Path.Voronoi.Cell",
TwinPointer="VoronoiCell",
Include="Mod/CAM/App/VoronoiCell.h",
Namespace="Path",
FatherInclude="Base/BaseClassPy.h",
FatherNamespace="Base",
Constructor=True,
RichCompare=True,
Delete=True,
)
class VoronoiCellPy(BaseClass):
class VoronoiCell(BaseClass):
"""
Cell of a Voronoi diagram
"""

View File

@@ -1,77 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="BaseClassPy"
Name="VoronoiCellPy"
PythonName="Path.Voronoi.Cell"
Twin="VoronoiCell"
TwinPointer="VoronoiCell"
Include="Mod/CAM/App/VoronoiCell.h"
FatherInclude="Base/BaseClassPy.h"
Namespace="Path"
FatherNamespace="Base"
Constructor="true"
RichCompare="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" />
<UserDocu>Cell of a Voronoi diagram</UserDocu>
</Documentation>
<Attribute Name="Index" ReadOnly="true">
<Documentation>
<UserDocu>Internal id of the element.</UserDocu>
</Documentation>
<Parameter Name="Index" Type="Long"/>
</Attribute>
<Attribute Name="Color" ReadOnly="false">
<Documentation>
<UserDocu>Assigned color of the receiver.</UserDocu>
</Documentation>
<Parameter Name="Color" Type="Long"/>
</Attribute>
<Attribute Name="SourceIndex" ReadOnly="true">
<Documentation>
<UserDocu>Returns the index of the cell's source</UserDocu>
</Documentation>
<Parameter Name="SourceIndex" Type="Long"/>
</Attribute>
<Attribute Name="SourceCategory" ReadOnly="true">
<Documentation>
<UserDocu>Returns the cell's category as an integer</UserDocu>
</Documentation>
<Parameter Name="SourceCategory" Type="Long"/>
</Attribute>
<Attribute Name="SourceCategoryName" ReadOnly="true">
<Documentation>
<UserDocu>Returns the cell's category as a string</UserDocu>
</Documentation>
<Parameter Name="SourceCategory" Type="String"/>
</Attribute>
<Attribute Name="IncidentEdge" ReadOnly="true">
<Documentation>
<UserDocu>Incident edge of the cell - if exists</UserDocu>
</Documentation>
<Parameter Name="IncidentEdge" Type="Object"/>
</Attribute>
<Methode Name="containsPoint" Const="true">
<Documentation>
<UserDocu>Returns true if the cell contains a point site</UserDocu>
</Documentation>
</Methode>
<Methode Name="containsSegment" Const="true">
<Documentation>
<UserDocu>Returns true if the cell contains a segment site</UserDocu>
</Documentation>
</Methode>
<Methode Name="isDegenerate" Const="true">
<Documentation>
<UserDocu>Returns true if the cell doesn't have an incident edge</UserDocu>
</Documentation>
</Methode>
<Methode Name="getSource" Const="true">
<Documentation>
<UserDocu>Returns the Source for the cell</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@@ -4,20 +4,13 @@ from Base.BaseClass import BaseClass
from Base.Metadata import constmethod, export
@export(
Father="BaseClassPy",
Name="VoronoiEdgePy",
Twin="VoronoiEdge",
TwinPointer="VoronoiEdge",
PythonName="Path.Voronoi.Edge",
Include="Mod/CAM/App/VoronoiEdge.h",
Namespace="Path",
FatherInclude="Base/BaseClassPy.h",
FatherNamespace="Base",
RichCompare=True,
Constructor=True,
Delete=True,
)
class VoronoiEdgePy(BaseClass):
class VoronoiEdge(BaseClass):
"""
Edge of a Voronoi diagram
"""

View File

@@ -1,125 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="BaseClassPy"
Name="VoronoiEdgePy"
PythonName="Path.Voronoi.Edge"
Twin="VoronoiEdge"
TwinPointer="VoronoiEdge"
Include="Mod/CAM/App/VoronoiEdge.h"
FatherInclude="Base/BaseClassPy.h"
Namespace="Path"
FatherNamespace="Base"
Constructor="true"
RichCompare="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" />
<UserDocu>Edge of a Voronoi diagram</UserDocu>
</Documentation>
<Attribute Name="Index" ReadOnly="true">
<Documentation>
<UserDocu>Internal id of the element.</UserDocu>
</Documentation>
<Parameter Name="Index" Type="Long"/>
</Attribute>
<Attribute Name="Color" ReadOnly="false">
<Documentation>
<UserDocu>Assigned color of the receiver.</UserDocu>
</Documentation>
<Parameter Name="Color" Type="Long"/>
</Attribute>
<Attribute Name="Cell" ReadOnly="true">
<Documentation>
<UserDocu>cell the edge belongs to</UserDocu>
</Documentation>
<Parameter Name="Cell" Type="Object"/>
</Attribute>
<Attribute Name="Vertices" ReadOnly="true">
<Documentation>
<UserDocu>Begin and End voronoi vertex</UserDocu>
</Documentation>
<Parameter Name="Vertices" Type="List"/>
</Attribute>
<Attribute Name="Next" ReadOnly="true">
<Documentation>
<UserDocu>CCW next edge within voronoi cell</UserDocu>
</Documentation>
<Parameter Name="Next" Type="Object"/>
</Attribute>
<Attribute Name="Prev" ReadOnly="true">
<Documentation>
<UserDocu>CCW previous edge within voronoi cell</UserDocu>
</Documentation>
<Parameter Name="Prev" Type="Object"/>
</Attribute>
<Attribute Name="RotNext" ReadOnly="true">
<Documentation>
<UserDocu>Rotated CCW next edge within voronoi cell</UserDocu>
</Documentation>
<Parameter Name="RotNext" Type="Object"/>
</Attribute>
<Attribute Name="RotPrev" ReadOnly="true">
<Documentation>
<UserDocu>Rotated CCW previous edge within voronoi cell</UserDocu>
</Documentation>
<Parameter Name="RotPrev" Type="Object"/>
</Attribute>
<Attribute Name="Twin" ReadOnly="true">
<Documentation>
<UserDocu>Twin edge</UserDocu>
</Documentation>
<Parameter Name="Twin" Type="Object"/>
</Attribute>
<Methode Name="isFinite" Const="true">
<Documentation>
<UserDocu>Returns true if both vertices are finite</UserDocu>
</Documentation>
</Methode>
<Methode Name="isInfinite" Const="true">
<Documentation>
<UserDocu>Returns true if the end vertex is infinite</UserDocu>
</Documentation>
</Methode>
<Methode Name="isLinear" Const="true">
<Documentation>
<UserDocu>Returns true if edge is straight</UserDocu>
</Documentation>
</Methode>
<Methode Name="isCurved" Const="true">
<Documentation>
<UserDocu>Returns true if edge is curved</UserDocu>
</Documentation>
</Methode>
<Methode Name="isPrimary" Const="true">
<Documentation>
<UserDocu>Returns false if edge goes through endpoint of the segment site</UserDocu>
</Documentation>
</Methode>
<Methode Name="isSecondary" Const="true">
<Documentation>
<UserDocu>Returns true if edge goes through endpoint of the segment site</UserDocu>
</Documentation>
</Methode>
<Methode Name="isBorderline" Const="true">
<Documentation>
<UserDocu>Returns true if the point is on the segment</UserDocu>
</Documentation>
</Methode>
<Methode Name="toShape" Const="true">
<Documentation>
<UserDocu>Returns a shape for the edge</UserDocu>
</Documentation>
</Methode>
<Methode Name="getDistances" Const="true">
<Documentation>
<UserDocu>Returns the distance of the vertices to the input source</UserDocu>
</Documentation>
</Methode>
<Methode Name="getSegmentAngle" Const="true">
<Documentation>
<UserDocu>Returns the angle (in degree) of the segments if the edge was formed by two segments</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="BaseClassPy"
Name="VoronoiPy"
PythonName="Path.Voronoi.Diagram"
Twin="Voronoi"
TwinPointer="Voronoi"
Include="Mod/CAM/App/Voronoi.h"
Namespace="Path"
FatherInclude="Base/BaseClassPy.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" />
<UserDocu>Voronoi([segments]): Create voronoi for given collection of line segments</UserDocu>
</Documentation>
<Attribute Name="Cells" ReadOnly="true">
<Documentation>
<UserDocu>List of all cells of the voronoi diagram</UserDocu>
</Documentation>
<Parameter Name="Cells" Type="List"/>
</Attribute>
<Attribute Name="Edges" ReadOnly="true">
<Documentation>
<UserDocu>List of all edges of the voronoi diagram</UserDocu>
</Documentation>
<Parameter Name="Edges" Type="List"/>
</Attribute>
<Attribute Name="Vertices" ReadOnly="true">
<Documentation>
<UserDocu>List of all vertices of the voronoi diagram</UserDocu>
</Documentation>
<Parameter Name="Vertices" Type="List"/>
</Attribute>
<Methode Name="numCells" Const="true">
<Documentation>
<UserDocu>Return number of cells</UserDocu>
</Documentation>
</Methode>
<Methode Name="numEdges" Const="true">
<Documentation>
<UserDocu>Return number of edges</UserDocu>
</Documentation>
</Methode>
<Methode Name="numVertices" Const="true">
<Documentation>
<UserDocu>Return number of vertices</UserDocu>
</Documentation>
</Methode>
<Methode Name="addPoint">
<Documentation>
<UserDocu>addPoint(vector|vector2d) add given point to input collection</UserDocu>
</Documentation>
</Methode>
<Methode Name="addSegment">
<Documentation>
<UserDocu>addSegment(vector|vector2d, vector|vector2d) add given segment to input collection</UserDocu>
</Documentation>
</Methode>
<Methode Name="construct">
<Documentation>
<UserDocu>constructs the voronoi diagram from the input collections</UserDocu>
</Documentation>
</Methode>
<Methode Name="colorExterior">
<Documentation>
<UserDocu>assign given color to all exterior edges and vertices</UserDocu>
</Documentation>
</Methode>
<Methode Name="colorTwins">
<Documentation>
<UserDocu>assign given color to all twins of edges (which one is considered a twin is arbitrary)</UserDocu>
</Documentation>
</Methode>
<Methode Name="colorColinear">
<Documentation>
<UserDocu>assign given color to all edges sourced by two segments almost in line with each other (optional angle in degrees)</UserDocu>
</Documentation>
</Methode>
<Methode Name="resetColor">
<Documentation>
<UserDocu>assign color 0 to all elements with the given color</UserDocu>
</Documentation>
</Methode>
<Methode Name="getPoints" Const="true">
<Documentation>
<UserDocu>Get list of all input points.</UserDocu>
</Documentation>
</Methode>
<Methode Name="numPoints" Const="true">
<Documentation>
<UserDocu>Return number of input points</UserDocu>
</Documentation>
</Methode>
<Methode Name="getSegments" Const="true">
<Documentation>
<UserDocu>Get list of all input segments.</UserDocu>
</Documentation>
</Methode>
<Methode Name="numSegments" Const="true">
<Documentation>
<UserDocu>Return number of input segments</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@@ -4,20 +4,13 @@ from Base.BaseClass import BaseClass
from Base.Metadata import constmethod, export
@export(
Father="BaseClassPy",
Name="VoronoiVertexPy",
PythonName="Path.Voronoi.Vertex",
Twin="VoronoiVertex",
TwinPointer="VoronoiVertex",
Include="Mod/CAM/App/VoronoiVertex.h",
Namespace="Path",
FatherInclude="Base/BaseClassPy.h",
FatherNamespace="Base",
Constructor=True,
RichCompare=True,
Delete=True,
)
class VoronoiVertexPy(BaseClass):
class VoronoiVertex(BaseClass):
"""
Vertex of a Voronoi diagram
"""

View File

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="BaseClassPy"
Name="VoronoiVertexPy"
PythonName="Path.Voronoi.Vertex"
Twin="VoronoiVertex"
TwinPointer="VoronoiVertex"
Include="Mod/CAM/App/VoronoiVertex.h"
FatherInclude="Base/BaseClassPy.h"
Namespace="Path"
FatherNamespace="Base"
Constructor="true"
RichCompare="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" />
<UserDocu>Vertex of a Voronoi diagram</UserDocu>
</Documentation>
<Attribute Name="Index" ReadOnly="true">
<Documentation>
<UserDocu>Internal id of the element.</UserDocu>
</Documentation>
<Parameter Name="Index" Type="Long"/>
</Attribute>
<Attribute Name="Color" ReadOnly="false">
<Documentation>
<UserDocu>Assigned color of the receiver.</UserDocu>
</Documentation>
<Parameter Name="Color" Type="Long"/>
</Attribute>
<Attribute Name="X" ReadOnly="true">
<Documentation>
<UserDocu>X position</UserDocu>
</Documentation>
<Parameter Name="X" Type="Float"/>
</Attribute>
<Attribute Name="Y" ReadOnly="true">
<Documentation>
<UserDocu>Y position</UserDocu>
</Documentation>
<Parameter Name="Y" Type="Float"/>
</Attribute>
<Attribute Name="IncidentEdge" ReadOnly="true">
<Documentation>
<UserDocu>Y position</UserDocu>
</Documentation>
<Parameter Name="IncidentEdge" Type="Object"/>
</Attribute>
<Methode Name="toPoint" Const="true">
<Documentation>
<UserDocu>Returns a Vector - or None if not possible</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@@ -14,7 +14,7 @@ set(PathSimulator_LIBS
)
SET(Python_SRCS
PathSimPy.xml
PathSim.pyi
PathSimPyImp.cpp
)
@@ -30,8 +30,7 @@ SET(PathSimulator_SRCS
${Python_SRCS}
)
generate_from_xml(PathSimPy)
generate_from_py_(PathSimPy)
generate_from_py(PathSim)
SOURCE_GROUP("Python" FILES ${Python_SRCS})

View File

@@ -4,19 +4,14 @@ from Base.BaseClass import BaseClass
from Base.Metadata import export
@export(
Father="BaseClassPy",
Name="PathSimPy",
Twin="PathSim",
TwinPointer="PathSim",
FatherInclude="Base/BaseClassPy.h",
FatherNamespace="Base",
Include="Mod/CAM/PathSimulator/App/PathSim.h",
Namespace="PathSimulator",
ReadOnly=["Tool"],
Constructor=True,
Delete=True,
)
class PathSimPy(BaseClass):
class PathSim(BaseClass):
"""
FreeCAD python wrapper of PathSimulator

View File

@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="BaseClassPy"
Name="PathSimPy"
Twin="PathSim"
TwinPointer="PathSim"
Include="Mod/CAM/PathSimulator/App/PathSim.h"
Namespace="PathSimulator"
FatherInclude="Base/BaseClassPy.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="Shai Seger" EMail="shaise_at_g-mail" />
<UserDocu>FreeCAD python wrapper of PathSimulator
PathSimulator.PathSim():
Create a path simulator object
</UserDocu>
</Documentation>
<Methode Name="BeginSimulation" Keyword='true'>
<Documentation>
<UserDocu>BeginSimulation(stock, resolution):
Start a simulation process on a box shape stock with given resolution
</UserDocu>
</Documentation>
</Methode>
<Methode Name="SetToolShape">
<Documentation>
<UserDocu>SetToolShape(shape):
Set the shape of the tool to be used for simulation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="GetResultMesh">
<Documentation>
<UserDocu>
GetResultMesh():
Return the current mesh result of the simulation.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="ApplyCommand" Keyword='true'>
<Documentation>
<UserDocu>
ApplyCommand(placement, command):
Apply a single path command on the stock starting from placement.
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Tool" ReadOnly="true">
<Documentation>
<UserDocu>Return current simulation tool.</UserDocu>
</Documentation>
<Parameter Name="Tool" Type="Object"/>
</Attribute>
</PythonExport>
</GenerateModel>

View File

@@ -5,18 +5,13 @@ from Base.Metadata import export
from Metadata import no_args
@export(
Father="BaseClassPy",
Name="CAMSimPy",
Twin="CAMSim",
TwinPointer="CAMSim",
Include="Mod/CAM/PathSimulator/AppGL/CAMSim.h",
FatherInclude="Base/BaseClassPy.h",
FatherNamespace="Base",
Namespace="CAMSimulator",
Constructor=True,
Delete=True,
)
class CAMSimPy(BaseClass):
class CAMSim(BaseClass):
"""
FreeCAD python wrapper of CAMSimulator

View File

@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="BaseClassPy"
Name="CAMSimPy"
Twin="CAMSim"
TwinPointer="CAMSim"
Include="Mod/CAM/PathSimulator/AppGL/CAMSim.h"
Namespace="CAMSimulator"
FatherInclude="Base/BaseClassPy.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="Shai Seger" EMail="shaise_at_g-mail" />
<UserDocu>
FreeCAD python wrapper of CAMSimulator
CAMSimulator.CAMSim():
Create a path simulator object
</UserDocu>
</Documentation>
<Methode Name="BeginSimulation" Keyword='true'>
<Documentation>
<UserDocu>
BeginSimulation(stock, resolution):
Start a simulation process on a box shape stock with given resolution
</UserDocu>
</Documentation>
</Methode>
<Methode Name="ResetSimulation" NoArgs="true">
<Documentation>
<UserDocu>
ResetSimulation():
Clear the simulation and all gcode commands
</UserDocu>
</Documentation>
</Methode>
<Methode Name="AddTool" Keyword='true'>
<Documentation>
<UserDocu>
AddTool(shape, toolnumber, diameter, resolution):
Set the shape of the tool to be used for simulation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="SetBaseShape" Keyword='true'>
<Documentation>
<UserDocu>
SetBaseShape(shape, resolution):
Set the shape of the base object of the job
</UserDocu>
</Documentation>
</Methode>
<Methode Name="AddCommand">
<Documentation>
<UserDocu>
AddCommand(command):
Add a path command to the simulation.
</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@@ -16,7 +16,7 @@ set(CAMSimulator_LIBS
)
SET(CAMSimulator_SRCS_Python
CAMSimPy.xml
CAMSim.pyi
CAMSimPyImp.cpp
)
@@ -66,9 +66,7 @@ SET(CAMSimulator_SRCS_Core
TextureLoader.h
)
generate_from_xml(CAMSimPy)
generate_from_py_(CAMSimPy)
generate_from_py(CAMSim)
SOURCE_GROUP("Module" FILES ${CAMSimulator_SRCS_Module})
SOURCE_GROUP("Python" FILES ${CAMSimulator_SRCS_Python})

View File

@@ -41,6 +41,7 @@ class TemplateClassPyExport(template.ModelTemplate):
"Base",
"App",
"Assembly",
"CAM",
"Gui",
"Part",
"PartDesign",