diff --git a/src/Mod/Assembly/App/AssemblyLinkPy.pyi b/src/Mod/Assembly/App/AssemblyLinkPy.pyi new file mode 100644 index 0000000000..14f4b03e11 --- /dev/null +++ b/src/Mod/Assembly/App/AssemblyLinkPy.pyi @@ -0,0 +1,23 @@ +from typing import Final + +from Base.Metadata import export + +from App.Part import Part + +@export( + Father="PartPy", + Name="AssemblyLinkPy", + Twin="AssemblyLink", + TwinPointer="AssemblyLink", + Include="Mod/Assembly/App/AssemblyLink.h", + Namespace="Assembly", + FatherInclude="App/PartPy.h", + FatherNamespace="App", +) +class AssemblyLinkPy(Part): + """ + This class handles document objects in Assembly + """ + + Joints: Final[list] + """A list of all joints this assembly link has.""" diff --git a/src/Mod/Assembly/App/AssemblyObjectPy.pyi b/src/Mod/Assembly/App/AssemblyObjectPy.pyi new file mode 100644 index 0000000000..8d971b7d94 --- /dev/null +++ b/src/Mod/Assembly/App/AssemblyObjectPy.pyi @@ -0,0 +1,158 @@ +from typing import Any, Final + +from Base.Metadata import constmethod, export + +from App.Part import Part + +@export( + Father="PartPy", + Name="AssemblyObjectPy", + Twin="AssemblyObject", + TwinPointer="AssemblyObject", + Include="Mod/Assembly/App/AssemblyObject.h", + Namespace="Assembly", + FatherInclude="App/PartPy.h", + FatherNamespace="App", +) +class AssemblyObjectPy(Part): + """ + This class handles document objects in Assembly + """ + + @constmethod + def solve(self) -> Any: + """Solve the assembly and update part placements. + + solve(enableRedo=False) -> int + + Args: + enableRedo: Whether the solve save the initial position of parts + to enable undoing it even without a transaction. + Defaults to `False` ie the solve cannot be undone if called + outside of a transaction. + + Returns: + 0 in case of success, otherwise the following codes in this order of + priority: + -6 if no parts are fixed. + -4 if over-constrained, + -3 if conflicting constraints, + -5 if malformed constraints + -1 if solver error, + -2 if redundant constraints.""" + ... + + @constmethod + def generateSimulation(self) -> Any: + """Generate the simulation. + + solve(simulationObject) -> int + + Args: + simulationObject: The simulation Object. + + Returns: + 0 in case of success, otherwise the following codes in this order of + priority: + -6 if no parts are fixed. + -4 if over-constrained, + -3 if conflicting constraints, + -5 if malformed constraints + -1 if solver error, + -2 if redundant constraints.""" + ... + + @constmethod + def updateForFrame(self) -> Any: + """Update entire assembly to frame number specified. + + updateForFrame(index) + + Args: index of frame. + + Returns: None""" + ... + + @constmethod + def numberOfFrames(self) -> Any: + """numberOfFrames() + + Args: None + + Returns: Number of frames""" + ... + + @constmethod + def undoSolve(self) -> Any: + """Undo the last solve of the assembly and return part placements to their initial position. + + undoSolve() + + Returns: None""" + ... + + @constmethod + def ensureIdentityPlacements(self) -> Any: + """Makes sure that LinkGroups or sub-assemblies have identity placements. + + ensureIdentityPlacements() + + Returns: None""" + ... + + @constmethod + def clearUndo(self) -> Any: + """Clear the registered undo positions. + + clearUndo() + + Returns: None""" + ... + + @constmethod + def isPartConnected(self) -> Any: + """Check if a part is connected to the ground through joints. + + isPartConnected(obj) -> bool + + Args: document object to check. + + Returns: True if part is connected to ground""" + ... + + @constmethod + def isJointConnectingPartToGround(self) -> Any: + """Check if a joint is connecting a part to the ground. + + isJointConnectingPartToGround(joint, propName) -> bool + + Args: + - joint: document object of the joint to check. + - propName: string 'Part1' or 'Part2' of the joint. + + Returns: True if part is connected to ground""" + ... + + @constmethod + def isPartGrounded(self) -> Any: + """Check if a part has a grounded joint. + + isPartGrounded(obj) -> bool + + Args: + - obj: document object of the part to check. + + Returns: True if part has grounded joint""" + ... + + @constmethod + def exportAsASMT(self) -> Any: + """Export the assembly in a text format called ASMT. + + exportAsASMT(fileName:str) + + Args: + fileName: The name of the file where the ASMT will be exported.""" + ... + Joints: Final[list] + """A list of all joints this assembly has.""" diff --git a/src/Mod/Assembly/App/AssemblyObjectPy.xml b/src/Mod/Assembly/App/AssemblyObjectPy.xml index 0db8734b0a..335da8064b 100644 --- a/src/Mod/Assembly/App/AssemblyObjectPy.xml +++ b/src/Mod/Assembly/App/AssemblyObjectPy.xml @@ -16,158 +16,158 @@ - Solve the assembly and update part placements. +Solve the assembly and update part placements. - solve(enableRedo=False) -> int +solve(enableRedo=False) -> int - Args: - enableRedo: Whether the solve save the initial position of parts - to enable undoing it even without a transaction. - Defaults to `False` ie the solve cannot be undone if called - outside of a transaction. +Args: +enableRedo: Whether the solve save the initial position of parts +to enable undoing it even without a transaction. +Defaults to `False` ie the solve cannot be undone if called +outside of a transaction. - Returns: - 0 in case of success, otherwise the following codes in this order of - priority: - -6 if no parts are fixed. - -4 if over-constrained, - -3 if conflicting constraints, - -5 if malformed constraints - -1 if solver error, - -2 if redundant constraints. +Returns: +0 in case of success, otherwise the following codes in this order of +priority: +-6 if no parts are fixed. +-4 if over-constrained, +-3 if conflicting constraints, +-5 if malformed constraints +-1 if solver error, +-2 if redundant constraints. - Generate the simulation. +Generate the simulation. - solve(simulationObject) -> int +solve(simulationObject) -> int - Args: - simulationObject: The simulation Object. +Args: +simulationObject: The simulation Object. - Returns: - 0 in case of success, otherwise the following codes in this order of - priority: - -6 if no parts are fixed. - -4 if over-constrained, - -3 if conflicting constraints, - -5 if malformed constraints - -1 if solver error, - -2 if redundant constraints. +Returns: +0 in case of success, otherwise the following codes in this order of +priority: +-6 if no parts are fixed. +-4 if over-constrained, +-3 if conflicting constraints, +-5 if malformed constraints +-1 if solver error, +-2 if redundant constraints. - Update entire assembly to frame number specified. +Update entire assembly to frame number specified. - updateForFrame(index) +updateForFrame(index) - Args: index of frame. +Args: index of frame. - Returns: None +Returns: None - numberOfFrames() +numberOfFrames() - Args: None +Args: None - Returns: Number of frames +Returns: Number of frames - Undo the last solve of the assembly and return part placements to their initial position. +Undo the last solve of the assembly and return part placements to their initial position. - undoSolve() +undoSolve() - Returns: None +Returns: None - Makes sure that LinkGroups or sub-assemblies have identity placements. +Makes sure that LinkGroups or sub-assemblies have identity placements. - ensureIdentityPlacements() +ensureIdentityPlacements() - Returns: None +Returns: None - Clear the registered undo positions. +Clear the registered undo positions. - clearUndo() +clearUndo() - Returns: None +Returns: None - Check if a part is connected to the ground through joints. +Check if a part is connected to the ground through joints. - isPartConnected(obj) -> bool +isPartConnected(obj) -> bool - Args: document object to check. +Args: document object to check. - Returns: True if part is connected to ground +Returns: True if part is connected to ground - Check if a joint is connecting a part to the ground. +Check if a joint is connecting a part to the ground. - isJointConnectingPartToGround(joint, propName) -> bool +isJointConnectingPartToGround(joint, propName) -> bool - Args: - - joint: document object of the joint to check. - - propName: string 'Part1' or 'Part2' of the joint. +Args: +- joint: document object of the joint to check. +- propName: string 'Part1' or 'Part2' of the joint. - Returns: True if part is connected to ground +Returns: True if part is connected to ground - Check if a part has a grounded joint. +Check if a part has a grounded joint. - isPartGrounded(obj) -> bool +isPartGrounded(obj) -> bool - Args: - - obj: document object of the part to check. +Args: +- obj: document object of the part to check. - Returns: True if part has grounded joint +Returns: True if part has grounded joint - Export the assembly in a text format called ASMT. +Export the assembly in a text format called ASMT. - exportAsASMT(fileName:str) +exportAsASMT(fileName:str) - Args: - fileName: The name of the file where the ASMT will be exported. +Args: +fileName: The name of the file where the ASMT will be exported. diff --git a/src/Mod/Assembly/App/BomGroupPy.pyi b/src/Mod/Assembly/App/BomGroupPy.pyi new file mode 100644 index 0000000000..7ce2066a83 --- /dev/null +++ b/src/Mod/Assembly/App/BomGroupPy.pyi @@ -0,0 +1,18 @@ +from Base.Metadata import export + +from App.DocumentObjectGroup import DocumentObjectGroup + +@export( + Father="DocumentObjectGroupPy", + Name="BomGroupPy", + Twin="BomGroup", + TwinPointer="BomGroup", + Include="Mod/Assembly/App/BomGroup.h", + Namespace="Assembly", + FatherInclude="App/DocumentObjectGroupPy.h", + FatherNamespace="App", +) +class BomGroupPy(DocumentObjectGroup): + """ + This class is a group subclass for boms. + """ diff --git a/src/Mod/Assembly/App/BomObjectPy.pyi b/src/Mod/Assembly/App/BomObjectPy.pyi new file mode 100644 index 0000000000..a1847ab68d --- /dev/null +++ b/src/Mod/Assembly/App/BomObjectPy.pyi @@ -0,0 +1,17 @@ +from Base.Metadata import export +from Spreadsheet.Sheet import Sheet + +@export( + Father="SheetPy", + Name="BomObjectPy", + Twin="BomObject", + TwinPointer="BomObject", + Include="Mod/Assembly/App/BomObject.h", + Namespace="Assembly", + FatherInclude="Mod/Spreadsheet/App/SheetPy.h", + FatherNamespace="Spreadsheet", +) +class BomObjectPy(Sheet): + """ + This class is the BOM object of assemblies, it derives from Spreadsheet::Sheet. + """ diff --git a/src/Mod/Assembly/App/CMakeLists.txt b/src/Mod/Assembly/App/CMakeLists.txt index fd9a79116c..6d944a784c 100644 --- a/src/Mod/Assembly/App/CMakeLists.txt +++ b/src/Mod/Assembly/App/CMakeLists.txt @@ -22,6 +22,15 @@ generate_from_xml(JointGroupPy) generate_from_xml(ViewGroupPy) generate_from_xml(SimulationGroupPy) +generate_from_py_(AssemblyObjectPy) +generate_from_py_(AssemblyLinkPy) +generate_from_py_(BomObjectPy) +generate_from_py_(BomGroupPy) +generate_from_py_(JointGroupPy) +generate_from_py_(ViewGroupPy) +generate_from_py_(SimulationGroupPy) + + SET(Python_SRCS AssemblyObjectPy.xml AssemblyObjectPyImp.cpp diff --git a/src/Mod/Assembly/App/JointGroupPy.pyi b/src/Mod/Assembly/App/JointGroupPy.pyi new file mode 100644 index 0000000000..89388781aa --- /dev/null +++ b/src/Mod/Assembly/App/JointGroupPy.pyi @@ -0,0 +1,18 @@ +from Base.Metadata import export + +from App.DocumentObjectGroup import DocumentObjectGroup + +@export( + Father="DocumentObjectGroupPy", + Name="JointGroupPy", + Twin="JointGroup", + TwinPointer="JointGroup", + Include="Mod/Assembly/App/JointGroup.h", + Namespace="Assembly", + FatherInclude="App/DocumentObjectGroupPy.h", + FatherNamespace="App", +) +class JointGroupPy(DocumentObjectGroup): + """ + This class is a group subclass for joints. + """ diff --git a/src/Mod/Assembly/App/SimulationGroupPy.pyi b/src/Mod/Assembly/App/SimulationGroupPy.pyi new file mode 100644 index 0000000000..fc1c82a0e0 --- /dev/null +++ b/src/Mod/Assembly/App/SimulationGroupPy.pyi @@ -0,0 +1,18 @@ +from Base.Metadata import export + +from App.DocumentObjectGroup import DocumentObjectGroup + +@export( + Father="DocumentObjectGroupPy", + Name="SimulationGroupPy", + Twin="SimulationGroup", + TwinPointer="SimulationGroup", + Include="Mod/Assembly/App/SimulationGroup.h", + Namespace="Assembly", + FatherInclude="App/DocumentObjectGroupPy.h", + FatherNamespace="App", +) +class SimulationGroupPy(DocumentObjectGroup): + """ + This class is a group subclass for joints. + """ diff --git a/src/Mod/Assembly/App/ViewGroupPy.pyi b/src/Mod/Assembly/App/ViewGroupPy.pyi new file mode 100644 index 0000000000..5229d081ce --- /dev/null +++ b/src/Mod/Assembly/App/ViewGroupPy.pyi @@ -0,0 +1,18 @@ +from Base.Metadata import export + +from App.DocumentObjectGroup import DocumentObjectGroup + +@export( + Father="DocumentObjectGroupPy", + Name="ViewGroupPy", + Twin="ViewGroup", + TwinPointer="ViewGroup", + Include="Mod/Assembly/App/ViewGroup.h", + Namespace="Assembly", + FatherInclude="App/DocumentObjectGroupPy.h", + FatherNamespace="App", +) +class ViewGroupPy(DocumentObjectGroup): + """ + This class is a group subclass for joints. + """