Core: Fixing missing python bindings. (#23054)

* Adding missing python interfaces.

* fixing interface includes.

* attempting fix for CI build error related to path resolution.

* testing build

* More testing via Github Actions...

* renaming files

* fixing comparison operator.

* reverting...

* fixing CMakeLists

* fixing binding generation issue
This commit is contained in:
Ian Abreu
2025-08-24 23:43:39 -04:00
committed by GitHub
parent d77a070bc8
commit 8533b4fbb8
8 changed files with 256 additions and 83 deletions

View File

@@ -31,6 +31,7 @@ SET(PathSimulator_SRCS
)
generate_from_xml(PathSimPy)
generate_from_py_(PathSimPy)
SOURCE_GROUP("Python" FILES ${Python_SRCS})

View File

@@ -0,0 +1,54 @@
from typing import Any, Final
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):
"""
FreeCAD python wrapper of PathSimulator
PathSimulator.PathSim():
Create a path simulator object
"""
def BeginSimulation(self, **kwargs) -> Any:
"""BeginSimulation(stock, resolution):
Start a simulation process on a box shape stock with given resolution"""
...
def SetToolShape(self) -> Any:
"""SetToolShape(shape):
Set the shape of the tool to be used for simulation"""
...
def GetResultMesh(self) -> Any:
"""
GetResultMesh():
Return the current mesh result of the simulation."""
...
def ApplyCommand(self, **kwargs) -> Any:
"""
ApplyCommand(placement, command):
Apply a single path command on the stock starting from placement."""
...
Tool: Final[Any]
"""Return current simulation tool."""

View File

@@ -0,0 +1,62 @@
from typing import Any
from Base.BaseClass import BaseClass
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):
"""
FreeCAD python wrapper of CAMSimulator
CAMSimulator.CAMSim():
Create a path simulator object
"""
def BeginSimulation(self, **kwargs) -> Any:
"""
BeginSimulation(stock, resolution):
Start a simulation process on a box shape stock with given resolution"""
...
@no_args
def ResetSimulation(self) -> Any:
"""
ResetSimulation():
Clear the simulation and all gcode commands"""
...
def AddTool(self, **kwargs) -> Any:
"""
AddTool(shape, toolnumber, diameter, resolution):
Set the shape of the tool to be used for simulation"""
...
def SetBaseShape(self, **kwargs) -> Any:
"""
SetBaseShape(shape, resolution):
Set the shape of the base object of the job"""
...
def AddCommand(self) -> Any:
"""
AddCommand(command):
Add a path command to the simulation."""
...

View File

@@ -68,7 +68,7 @@ SET(CAMSimulator_SRCS_Core
generate_from_xml(CAMSimPy)
generate_from_py_(CAMSimPy)
SOURCE_GROUP("Module" FILES ${CAMSimulator_SRCS_Module})
SOURCE_GROUP("Python" FILES ${CAMSimulator_SRCS_Python})