diff --git a/src/Mod/PartDesign/App/Body.pyi b/src/Mod/PartDesign/App/Body.pyi new file mode 100644 index 0000000000..b8309421ad --- /dev/null +++ b/src/Mod/PartDesign/App/Body.pyi @@ -0,0 +1,33 @@ +from Base.Metadata import export, constmethod +from Part.BodyBase import BodyBase +from typing import Final, overload + +@export( + Include="Mod/PartDesign/App/Body.h", + FatherInclude="Mod/Part/App/BodyBasePy.h", +) +class Body(BodyBase): + """ + PartDesign body class + + Author: Juergen Riegel (FreeCAD@juergen-riegel.net) + Licence: LGPL + """ + + VisibleFeature: Final[object] = ... + """Return the visible feature of this body""" + + def insertObject(self, feature: object, target: object, after: bool = False) -> None: + """ + insertObject(feature, target, after=False) + Insert the feature into the body after the given feature. + + @param feature The feature to insert into the body + @param target The feature relative which one should be inserted the given. + If target is NULL than insert into the end if where is InsertBefore + and into the begin if where is InsertAfter. + @param after if true insert the feature after the target. Default is false. + + @note the method doesn't modify the Tip unlike addObject() + """ + ... diff --git a/src/Mod/PartDesign/App/BodyPy.xml b/src/Mod/PartDesign/App/BodyPy.xml index 55326a1d35..d2dd7cab87 100644 --- a/src/Mod/PartDesign/App/BodyPy.xml +++ b/src/Mod/PartDesign/App/BodyPy.xml @@ -16,15 +16,15 @@ insertObject(feature, target, after=False) - Insert the feature into the body after the given feature. +Insert the feature into the body after the given feature. - @param feature The feature to insert into the body - @param target The feature relative which one should be inserted the given. - If target is NULL than insert into the end if where is InsertBefore - and into the begin if where is InsertAfter. - @param after if true insert the feature after the target. Default is false. +@param feature The feature to insert into the body +@param target The feature relative which one should be inserted the given. + If target is NULL than insert into the end if where is InsertBefore + and into the begin if where is InsertAfter. +@param after if true insert the feature after the target. Default is false. - @note the method doesn't modify the Tip unlike addObject() +@note the method doesn't modify the Tip unlike addObject() diff --git a/src/Mod/PartDesign/App/CMakeLists.txt b/src/Mod/PartDesign/App/CMakeLists.txt index bf7a35fcac..a07159f787 100644 --- a/src/Mod/PartDesign/App/CMakeLists.txt +++ b/src/Mod/PartDesign/App/CMakeLists.txt @@ -12,7 +12,9 @@ include_directories( link_directories(${OCC_LIBRARY_DIR}) generate_from_xml(BodyPy) +generate_from_py(Body) generate_from_xml(FeaturePy) +generate_from_py(Feature) set(PartDesign_LIBS diff --git a/src/Mod/PartDesign/App/Feature.pyi b/src/Mod/PartDesign/App/Feature.pyi new file mode 100644 index 0000000000..e1d3da4074 --- /dev/null +++ b/src/Mod/PartDesign/App/Feature.pyi @@ -0,0 +1,28 @@ +from Base.Metadata import export +from Part.PartFeature import PartFeature +from typing import Optional, overload + +@export( + Include="Mod/PartDesign/App/Feature.h", + FatherInclude="Mod/Part/App/PartFeaturePy.h", +) +class Feature(PartFeature): + """ + This is the father of all PartDesign object classes + + Author: Juergen Riegel (FreeCAD@juergen-riegel.net) + Licence: LGPL + """ + + @overload + def getBaseObject(self) -> Optional[object]: + """ + getBaseObject: returns feature this one fuses itself to, or None. Normally, this should be the same as BaseFeature property, except for legacy workflow. In legacy workflow, it will look up the support of referenced sketch. + """ + ... + + def getBaseObject(self) -> Optional[object]: + """ + getBaseObject: returns feature this one fuses itself to, or None. Normally, this should be the same as BaseFeature property, except for legacy workflow. In legacy workflow, it will look up the support of referenced sketch. + """ + ... diff --git a/src/Mod/PartDesign/Gui/CMakeLists.txt b/src/Mod/PartDesign/Gui/CMakeLists.txt index dfcb9273f1..7fdf0b18a2 100644 --- a/src/Mod/PartDesign/Gui/CMakeLists.txt +++ b/src/Mod/PartDesign/Gui/CMakeLists.txt @@ -10,6 +10,7 @@ include_directories( ) generate_from_xml(ViewProviderPy) +generate_from_py(ViewProvider) set(PartDesignGui_LIBS diff --git a/src/Mod/PartDesign/Gui/ViewProvider.pyi b/src/Mod/PartDesign/Gui/ViewProvider.pyi new file mode 100644 index 0000000000..0946ad4bb7 --- /dev/null +++ b/src/Mod/PartDesign/Gui/ViewProvider.pyi @@ -0,0 +1,34 @@ +from Base.Metadata import export +from Gui.ViewProviderPartExt import ViewProviderPartExt +from typing import Final, overload + +@export( + Include="Mod/PartDesign/Gui/ViewProvider.h", + Namespace="PartDesignGui", + FatherInclude="Mod/Part/Gui/ViewProviderPartExtPy.h", + FatherNamespace="PartGui" +) +class ViewProvider(ViewProviderPartExt): + """ + This is the father of all PartDesign ViewProvider classes + + Author: Juergen Riegel (FreeCAD@juergen-riegel.net) + Licence: LGPL + """ + + def setBodyMode(self, mode: bool) -> None: + """ + setBodyMode(bool): body mode means that the object is part of a body + and that the body is used to set the visual properties, not the features. Hence + setting body mode to true will hide most viewprovider properties. + """ + ... + + def makeTemporaryVisible(self, visible: bool) -> None: + """ + makeTemporaryVisible(bool): makes this viewprovider visible in the + scene graph without changing any properties, not the visibility one and also not + the display mode. This can be used to show the shape of this viewprovider from + other viewproviders without doing anything to the document and properties. + """ + ...