From ab225f5672cbe45404299437d1613c308b68900b Mon Sep 17 00:00:00 2001 From: Ian 'z0r0' Abreu Date: Sun, 20 Jul 2025 18:55:33 -0400 Subject: [PATCH] fixing unnecessary list import --- src/Mod/Import/App/CMakeLists.txt | 1 + src/Mod/Import/App/StepShapePy.pyi | 27 ++++++++ src/Mod/Measure/App/CMakeLists.txt | 3 + src/Mod/Measure/App/MeasureBasePy.pyi | 19 ++++++ src/Mod/Measure/App/MeasurementPy.pyi | 68 +++++++++++++++++++ src/Mod/Measure/Gui/CMakeLists.txt | 1 + src/Mod/Measure/Gui/QuickMeasurePy.pyi | 19 ++++++ src/Mod/Points/App/CMakeLists.txt | 1 + src/Mod/Points/App/PointsPy.pyi | 65 ++++++++++++++++++ src/Mod/Points/App/PointsPy.xml | 3 - src/Mod/Robot/App/CMakeLists.txt | 6 ++ src/Mod/Robot/App/Robot6AxisPy.pyi | 49 +++++++++++++ src/Mod/Robot/App/RobotObjectPy.pyi | 25 +++++++ src/Mod/Robot/App/RobotObjectPy.xml | 4 +- src/Mod/Robot/App/TrajectoryPy.pyi | 48 +++++++++++++ src/Mod/Robot/App/TrajectoryPy.xml | 4 +- src/Mod/Robot/App/WaypointPy.pyi | 45 ++++++++++++ src/Mod/Surface/App/Blending/BlendCurvePy.pyi | 36 ++++++++++ src/Mod/Surface/App/Blending/BlendCurvePy.xml | 12 ++-- src/Mod/Surface/App/Blending/BlendPointPy.pyi | 46 +++++++++++++ src/Mod/Surface/App/Blending/BlendPointPy.xml | 18 ++--- src/Mod/Surface/App/CMakeLists.txt | 3 + 22 files changed, 481 insertions(+), 22 deletions(-) create mode 100644 src/Mod/Import/App/StepShapePy.pyi create mode 100644 src/Mod/Measure/App/MeasureBasePy.pyi create mode 100644 src/Mod/Measure/App/MeasurementPy.pyi create mode 100644 src/Mod/Measure/Gui/QuickMeasurePy.pyi create mode 100644 src/Mod/Points/App/PointsPy.pyi create mode 100644 src/Mod/Robot/App/Robot6AxisPy.pyi create mode 100644 src/Mod/Robot/App/RobotObjectPy.pyi create mode 100644 src/Mod/Robot/App/TrajectoryPy.pyi create mode 100644 src/Mod/Robot/App/WaypointPy.pyi create mode 100644 src/Mod/Surface/App/Blending/BlendCurvePy.pyi create mode 100644 src/Mod/Surface/App/Blending/BlendPointPy.pyi diff --git a/src/Mod/Import/App/CMakeLists.txt b/src/Mod/Import/App/CMakeLists.txt index 55ef13e6ae..823aae31da 100644 --- a/src/Mod/Import/App/CMakeLists.txt +++ b/src/Mod/Import/App/CMakeLists.txt @@ -77,6 +77,7 @@ SET(SCL_Resources SOURCE_GROUP("SCL" FILES ${SCL_Resources}) generate_from_xml(StepShapePy) +generate_from_py_(StepShapePy) add_library(Import SHARED ${Import_SRCS}) target_link_libraries(Import ${Import_LIBS}) diff --git a/src/Mod/Import/App/StepShapePy.pyi b/src/Mod/Import/App/StepShapePy.pyi new file mode 100644 index 0000000000..5a0b319c94 --- /dev/null +++ b/src/Mod/Import/App/StepShapePy.pyi @@ -0,0 +1,27 @@ +from typing import Any + +from Base.Metadata import export +from Base.PyObjectBase import PyObjectBase + +@export( + Father="PyObjectBase", + Name="StepShapePy", + Twin="StepShape", + TwinPointer="StepShape", + Include="Mod/Import/App/StepShape.h", + Namespace="Import", + FatherInclude="Base/PyObjectBase.h", + FatherNamespace="Base", + Constructor=True, + Delete=True, +) +class StepShapePy(PyObjectBase): + """ + StepShape in Import + This class gives a interface to retrieve TopoShapes out of an loaded STEP file of any kind. + """ + + def read(self) -> Any: + """method read() + Read a STEP file into memory and make it accessible""" + ... diff --git a/src/Mod/Measure/App/CMakeLists.txt b/src/Mod/Measure/App/CMakeLists.txt index 95e762229a..c10dfd202a 100644 --- a/src/Mod/Measure/App/CMakeLists.txt +++ b/src/Mod/Measure/App/CMakeLists.txt @@ -13,6 +13,9 @@ set(Measure_LIBS generate_from_xml(MeasurementPy) generate_from_xml(MeasureBasePy) +generate_from_py_(MeasurementPy) +generate_from_py_(MeasureBasePy) + SET(Python_SRCS MeasurementPy.xml MeasurementPyImp.cpp diff --git a/src/Mod/Measure/App/MeasureBasePy.pyi b/src/Mod/Measure/App/MeasureBasePy.pyi new file mode 100644 index 0000000000..6337c2b977 --- /dev/null +++ b/src/Mod/Measure/App/MeasureBasePy.pyi @@ -0,0 +1,19 @@ +from Base.Metadata import export + +from App.DocumentObject import DocumentObject + +@export( + Father="DocumentObjectPy", + Name="MeasureBasePy", + Twin="MeasureBase", + TwinPointer="MeasureBase", + Include="Mod/Measure/App/MeasureBase.h", + Namespace="Measure", + FatherInclude="App/DocumentObjectPy.h", + FatherNamespace="App", + Constructor=True, +) +class MeasureBasePy(DocumentObject): + """ + User documentation here + """ diff --git a/src/Mod/Measure/App/MeasurementPy.pyi b/src/Mod/Measure/App/MeasurementPy.pyi new file mode 100644 index 0000000000..5aee411fff --- /dev/null +++ b/src/Mod/Measure/App/MeasurementPy.pyi @@ -0,0 +1,68 @@ +from typing import Any + +from Base.BaseClass import BaseClass +from Base.Metadata import export + +@export( + Father="BaseClassPy", + Name="MeasurementPy", + Twin="Measurement", + TwinPointer="Measurement", + Include="Mod/Measure/App/Measurement.h", + Namespace="Measure", + FatherInclude="Base/BaseClassPy.h", + FatherNamespace="Base", + Constructor=True, +) +class MeasurementPy(BaseClass): + """ + Make a measurement + """ + + def addReference3D(self) -> Any: + """add a geometric reference""" + ... + + def has3DReferences(self) -> Any: + """does Measurement have links to 3D geometry""" + ... + + def clear(self) -> Any: + """measure the difference between references to obtain resultant vector""" + ... + + def delta(self) -> Any: + """measure the difference between references to obtain resultant vector""" + ... + + def length(self) -> Any: + """measure the length of the references""" + ... + + def volume(self) -> Any: + """measure the volume of the references""" + ... + + def area(self) -> Any: + """measure the area of the references""" + ... + + def lineLineDistance(self) -> Any: + """measure the line-Line Distance of the references. Returns 0 if references are not 2 lines.""" + ... + + def planePlaneDistance(self) -> Any: + """measure the plane-plane distance of the references. Returns 0 if references are not 2 planes.""" + ... + + def angle(self) -> Any: + """measure the angle between two edges""" + ... + + def radius(self) -> Any: + """measure the radius of an arc or circle edge""" + ... + + def com(self) -> Any: + """measure the center of mass for selected volumes""" + ... diff --git a/src/Mod/Measure/Gui/CMakeLists.txt b/src/Mod/Measure/Gui/CMakeLists.txt index 68acddfbbe..3650f0cb7b 100644 --- a/src/Mod/Measure/Gui/CMakeLists.txt +++ b/src/Mod/Measure/Gui/CMakeLists.txt @@ -29,6 +29,7 @@ SET(MeasureGui_UIC_SRCS ) generate_from_xml(QuickMeasurePy) +generate_from_py_(QuickMeasurePy) SET(MeasureGui_SRCS ${CMAKE_SOURCE_DIR}/src/Mod/Measure/InitGui.py diff --git a/src/Mod/Measure/Gui/QuickMeasurePy.pyi b/src/Mod/Measure/Gui/QuickMeasurePy.pyi new file mode 100644 index 0000000000..d87878eaf8 --- /dev/null +++ b/src/Mod/Measure/Gui/QuickMeasurePy.pyi @@ -0,0 +1,19 @@ +from Base.Metadata import export +from Base.PyObjectBase import PyObjectBase + +@export( + Father="PyObjectBase", + Name="QuickMeasurePy", + Twin="QuickMeasure", + TwinPointer="QuickMeasure", + Include="Mod/Measure/Gui/QuickMeasure.h", + Namespace="MeasureGui", + FatherInclude="Base/PyObjectBase.h", + FatherNamespace="Base", + Constructor=True, + Delete=True, +) +class QuickMeasurePy(PyObjectBase): + """ + Selection Observer for the QuickMeasure label. + """ diff --git a/src/Mod/Points/App/CMakeLists.txt b/src/Mod/Points/App/CMakeLists.txt index 740b4b3f93..8b9f59e2b8 100644 --- a/src/Mod/Points/App/CMakeLists.txt +++ b/src/Mod/Points/App/CMakeLists.txt @@ -39,6 +39,7 @@ list(APPEND Points_LIBS ) generate_from_xml(PointsPy) +generate_from_py_(PointsPy) SET(Points_SRCS AppPoints.cpp diff --git a/src/Mod/Points/App/PointsPy.pyi b/src/Mod/Points/App/PointsPy.pyi new file mode 100644 index 0000000000..fa30353feb --- /dev/null +++ b/src/Mod/Points/App/PointsPy.pyi @@ -0,0 +1,65 @@ +from typing import Any, Final + +from Base.Metadata import constmethod, export +from Data import object + +@export( + Father="ComplexGeoDataPy", + Name="PointsPy", + Twin="PointKernel", + TwinPointer="PointKernel", + Include="Mod/Points/App/Points.h", + Namespace="Points", + FatherInclude="App/ComplexGeoDataPy.h", + FatherNamespace="Data", + Constructor=True, +) +class PointsPy(object): + """ + Points() -- Create an empty points object. + + This class allows one to manipulate the Points object by adding new points, deleting facets, importing from an STL file, + transforming and much more. + """ + + @constmethod + def copy(self) -> Any: + """Create a copy of this points object""" + ... + + def read(self) -> Any: + """Read in a points object from file.""" + ... + + @constmethod + def write(self) -> Any: + """Write the points object into file.""" + ... + + @constmethod + def writeInventor(self) -> Any: + """Write the points in OpenInventor format to a string.""" + ... + + def addPoints(self) -> Any: + """add one or more (list of) points to the object""" + ... + + @constmethod + def fromSegment(self) -> Any: + """Get a new point object from a given segment""" + ... + + @constmethod + def fromValid(self) -> Any: + """Get a new point object from points with valid coordinates (i.e. that are not NaN)""" + ... + CountPoints: Final[int] + """Return the number of vertices of the points object.""" + + Points: Final[list] + """A collection of points +With this attribute it is possible to get access to the points of the object + +for p in pnt.Points: + print p""" diff --git a/src/Mod/Points/App/PointsPy.xml b/src/Mod/Points/App/PointsPy.xml index bc0393cb12..0ab784731d 100644 --- a/src/Mod/Points/App/PointsPy.xml +++ b/src/Mod/Points/App/PointsPy.xml @@ -67,12 +67,9 @@ With this attribute it is possible to get access to the points of the object for p in pnt.Points: print p - - - diff --git a/src/Mod/Robot/App/CMakeLists.txt b/src/Mod/Robot/App/CMakeLists.txt index c776773191..c55547411e 100644 --- a/src/Mod/Robot/App/CMakeLists.txt +++ b/src/Mod/Robot/App/CMakeLists.txt @@ -25,6 +25,12 @@ generate_from_xml(TrajectoryPy) generate_from_xml(WaypointPy) generate_from_xml(RobotObjectPy) +generate_from_py_(Robot6AxisPy) +generate_from_py_(TrajectoryPy) +generate_from_py_(WaypointPy) +generate_from_py_(RobotObjectPy) + + SET(Python_SRCS Robot6AxisPy.xml diff --git a/src/Mod/Robot/App/Robot6AxisPy.pyi b/src/Mod/Robot/App/Robot6AxisPy.pyi new file mode 100644 index 0000000000..55817cab9f --- /dev/null +++ b/src/Mod/Robot/App/Robot6AxisPy.pyi @@ -0,0 +1,49 @@ +from typing import Any + +from Base.Metadata import export +from Base.Persistence import Persistence + +@export( + Father="PersistencePy", + Name="Robot6AxisPy", + Twin="Robot6Axis", + TwinPointer="Robot6Axis", + Include="Mod/Robot/App/Robot6Axis.h", + Namespace="Robot", + FatherInclude="Base/PersistencePy.h", + FatherNamespace="Base", + Constructor=True, + Delete=True, +) +class Robot6AxisPy(Persistence): + """ + Robot6Axis class + """ + + def check(self) -> Any: + """Checks the shape and report errors in the shape structure. + This is a more detailed check as done in isValid().""" + ... + Axis1: float + """Pose of Axis 1 in degrees""" + + Axis2: float + """Pose of Axis 2 in degrees""" + + Axis3: float + """Pose of Axis 3 in degrees""" + + Axis4: float + """Pose of Axis 4 in degrees""" + + Axis5: float + """Pose of Axis 5 in degrees""" + + Axis6: float + """Pose of Axis 6 in degrees""" + + Tcp: Any + """Tool center point frame. Where the tool of the robot is""" + + Base: Any + """Actual Base system in respect to the robot world system""" diff --git a/src/Mod/Robot/App/RobotObjectPy.pyi b/src/Mod/Robot/App/RobotObjectPy.pyi new file mode 100644 index 0000000000..3cb536ff56 --- /dev/null +++ b/src/Mod/Robot/App/RobotObjectPy.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from Base.Metadata import export + +from App.DocumentObject import DocumentObject + +@export( + Father="DocumentObjectPy", + Name="RobotObjectPy", + Twin="RobotObject", + TwinPointer="RobotObject", + Include="Mod/Robot/App/RobotObject.h", + Namespace="Robot", + FatherInclude="App/DocumentObjectPy.h", + FatherNamespace="App", +) +class RobotObjectPy(DocumentObject): + """ + Robot document object + """ + + def getRobot(self) -> Any: + """Returns a copy of the robot. Be aware, the robot behaves the same + like the robot of the object but is a copy!""" + ... diff --git a/src/Mod/Robot/App/RobotObjectPy.xml b/src/Mod/Robot/App/RobotObjectPy.xml index a514598461..d964509698 100644 --- a/src/Mod/Robot/App/RobotObjectPy.xml +++ b/src/Mod/Robot/App/RobotObjectPy.xml @@ -16,8 +16,8 @@ - Returns a copy of the robot. Be aware, the robot behaves the same - like the robot of the object but is a copy! +Returns a copy of the robot. Be aware, the robot behaves the same +like the robot of the object but is a copy! diff --git a/src/Mod/Robot/App/TrajectoryPy.pyi b/src/Mod/Robot/App/TrajectoryPy.pyi new file mode 100644 index 0000000000..12ed781157 --- /dev/null +++ b/src/Mod/Robot/App/TrajectoryPy.pyi @@ -0,0 +1,48 @@ +from typing import Any, Final + +from Base.Metadata import export +from Base.Persistence import Persistence + +@export( + Father="PersistencePy", + Name="TrajectoryPy", + Twin="Trajectory", + TwinPointer="Trajectory", + Include="Mod/Robot/App/Trajectory.h", + Namespace="Robot", + FatherInclude="Base/PersistencePy.h", + FatherNamespace="Base", + Constructor=True, + Delete=True, +) +class TrajectoryPy(Persistence): + """ + Trajectory class + """ + + def insertWaypoints(self) -> Any: + """adds one or a list of waypoint to the end of the trajectory""" + ... + + def position(self) -> Any: + """returns a Frame to a given time in the trajectory""" + ... + + def velocity(self) -> Any: + """returns the velocity to a given time in the trajectory""" + ... + + def deleteLast(self) -> Any: + """ + deleteLast(n) - delete n waypoints at the end + deleteLast() - delete the last waypoint + """ + ... + Duration: Final[float] + """duration of the trajectory""" + + Length: Final[float] + """length of the trajectory""" + + Waypoints: list + """waypoints of this trajectory""" diff --git a/src/Mod/Robot/App/TrajectoryPy.xml b/src/Mod/Robot/App/TrajectoryPy.xml index 4d87d81721..2b83e16f7b 100644 --- a/src/Mod/Robot/App/TrajectoryPy.xml +++ b/src/Mod/Robot/App/TrajectoryPy.xml @@ -39,8 +39,8 @@ - deleteLast(n) - delete n waypoints at the end - deleteLast() - delete the last waypoint +deleteLast(n) - delete n waypoints at the end +deleteLast() - delete the last waypoint diff --git a/src/Mod/Robot/App/WaypointPy.pyi b/src/Mod/Robot/App/WaypointPy.pyi new file mode 100644 index 0000000000..54984237f7 --- /dev/null +++ b/src/Mod/Robot/App/WaypointPy.pyi @@ -0,0 +1,45 @@ +from typing import Any + +from Base.Metadata import export +from Base.Persistence import Persistence + +@export( + Father="PersistencePy", + Name="WaypointPy", + Twin="Waypoint", + TwinPointer="Waypoint", + Include="Mod/Robot/App/Waypoint.h", + Namespace="Robot", + FatherInclude="Base/PersistencePy.h", + FatherNamespace="Base", + Constructor=True, + Delete=True, +) +class WaypointPy(Persistence): + """ + Waypoint class + """ + + Name: str + """Name of the waypoint""" + + Type: str + """Type of the waypoint[PTP|LIN|CIRC|WAIT]""" + + Pos: Any + """End position (destination) of the waypoint""" + + Cont: bool + """Control the continuity to the next waypoint in the trajectory""" + + Velocity: float + """Control the velocity to the next waypoint in the trajectory +In Case of PTP 0-100% Axis speed +In Case of LIN m/s +In Case of WAIT s wait time""" + + Tool: int + """Describe which tool frame to use for that point""" + + Base: int + """Describe which Base frame to use for that point""" diff --git a/src/Mod/Surface/App/Blending/BlendCurvePy.pyi b/src/Mod/Surface/App/Blending/BlendCurvePy.pyi new file mode 100644 index 0000000000..4aaa1f8ef5 --- /dev/null +++ b/src/Mod/Surface/App/Blending/BlendCurvePy.pyi @@ -0,0 +1,36 @@ +from typing import Any + +from Base.BaseClass import PyObjectBase +from Base.Metadata import export + +@export( + Father="PyObjectBase", + Name="BlendCurvePy", + Twin="BlendCurve", + TwinPointer="BlendCurve", + Include="Mod/Surface/App/Blending/BlendCurve.h", + Namespace="Surface", + FatherInclude="Base/BaseClassPy.h", + FatherNamespace="Base", + Constructor=True, + Delete=True, +) +class BlendCurvePy(PyObjectBase): + """ + Create a BlendCurve that interpolate 2 BlendPoints. + curve = BlendCurve(BlendPoint1, BlendPoint2) + """ + + def compute(self) -> Any: + """ + Return the BezierCurve that interpolate the input BlendPoints. + """ + ... + + def setSize(self) -> Any: + """ + Set the tangent size of the blendpoint at given index. + If relative is true, the size is considered relative to the distance between the two blendpoints. + myBlendCurve.setSize(idx, size, relative) + """ + ... diff --git a/src/Mod/Surface/App/Blending/BlendCurvePy.xml b/src/Mod/Surface/App/Blending/BlendCurvePy.xml index a1938d25e6..825b2d05d8 100644 --- a/src/Mod/Surface/App/Blending/BlendCurvePy.xml +++ b/src/Mod/Surface/App/Blending/BlendCurvePy.xml @@ -17,23 +17,23 @@ - Create a BlendCurve that interpolate 2 BlendPoints. - curve = BlendCurve(BlendPoint1, BlendPoint2) +Create a BlendCurve that interpolate 2 BlendPoints. + curve = BlendCurve(BlendPoint1, BlendPoint2) - Return the BezierCurve that interpolate the input BlendPoints. +Return the BezierCurve that interpolate the input BlendPoints. - Set the tangent size of the blendpoint at given index. - If relative is true, the size is considered relative to the distance between the two blendpoints. - myBlendCurve.setSize(idx, size, relative) +Set the tangent size of the blendpoint at given index. +If relative is true, the size is considered relative to the distance between the two blendpoints. +myBlendCurve.setSize(idx, size, relative) diff --git a/src/Mod/Surface/App/Blending/BlendPointPy.pyi b/src/Mod/Surface/App/Blending/BlendPointPy.pyi new file mode 100644 index 0000000000..7318b9f5ea --- /dev/null +++ b/src/Mod/Surface/App/Blending/BlendPointPy.pyi @@ -0,0 +1,46 @@ +from typing import Any, Final + +from Base.BaseClass import PyObjectBase +from Base.Metadata import constmethod, export + +@export( + Father="PyObjectBase", + Name="BlendPointPy", + Twin="BlendPoint", + TwinPointer="BlendPoint", + Include="Mod/Surface/App/Blending/BlendPoint.h", + Namespace="Surface", + FatherInclude="Base/BaseClassPy.h", + FatherNamespace="Base", + Constructor=True, + Delete=True, +) +class BlendPointPy(PyObjectBase): + """ + Create BlendPoint from a point and some derivatives. + myBlendPoint = BlendPoint([Point, D1, D2, ..., DN]) + BlendPoint can also be constructed from an edge + myBlendPoint = BlendPoint(Edge, parameter = float, continuity = int) + """ + + @constmethod + def getSize(self) -> Any: + """Return BlendPoint first derivative length.""" + ... + + def setSize(self) -> Any: + """ + Resizes the BlendPoint vectors, + by setting the length of the first derivative. + theBlendPoint.setSize(new_size) + """ + ... + + def setvectors(self) -> Any: + """ + Set the vectors of BlendPoint. + BlendPoint.setvectors([Point, D1, D2, ..., DN]) + """ + ... + Vectors: Final[list] + """The list of vectors of this BlendPoint.""" diff --git a/src/Mod/Surface/App/Blending/BlendPointPy.xml b/src/Mod/Surface/App/Blending/BlendPointPy.xml index 8024dc3c99..8644d455f7 100644 --- a/src/Mod/Surface/App/Blending/BlendPointPy.xml +++ b/src/Mod/Surface/App/Blending/BlendPointPy.xml @@ -17,10 +17,10 @@ - Create BlendPoint from a point and some derivatives. - myBlendPoint = BlendPoint([Point, D1, D2, ..., DN]) - BlendPoint can also be constructed from an edge - myBlendPoint = BlendPoint(Edge, parameter = float, continuity = int) +Create BlendPoint from a point and some derivatives. +myBlendPoint = BlendPoint([Point, D1, D2, ..., DN]) +BlendPoint can also be constructed from an edge +myBlendPoint = BlendPoint(Edge, parameter = float, continuity = int) @@ -39,17 +39,17 @@ - Resizes the BlendPoint vectors, - by setting the length of the first derivative. - theBlendPoint.setSize(new_size) +Resizes the BlendPoint vectors, +by setting the length of the first derivative. +theBlendPoint.setSize(new_size) - Set the vectors of BlendPoint. - BlendPoint.setvectors([Point, D1, D2, ..., DN]) +Set the vectors of BlendPoint. +BlendPoint.setvectors([Point, D1, D2, ..., DN]) diff --git a/src/Mod/Surface/App/CMakeLists.txt b/src/Mod/Surface/App/CMakeLists.txt index 5e966da6aa..b98fa10963 100644 --- a/src/Mod/Surface/App/CMakeLists.txt +++ b/src/Mod/Surface/App/CMakeLists.txt @@ -16,6 +16,9 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Blending) generate_from_xml(Blending/BlendPointPy) generate_from_xml(Blending/BlendCurvePy) +generate_from_py_(Blending/BlendPointPy) +generate_from_py_(Blending/BlendCurvePy) + set(Surface_LIBS FreeCADApp Part