From 34b176c1db9ca51c24c32db7fc6c02eff341f743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20B=C3=A4hr?= Date: Sun, 13 Aug 2023 23:34:20 +0200 Subject: [PATCH] Remove C++ escaping from *Py.xml templates Now all escaping required for the C++ code generation is done when the .cpp/.h files are generated. Previously, only newlines were escaped automatically. This was a) inconsistent and b) leaked c++ details into the xml data. In addition, the escaping is now done in one central place, harmonizing the three previous implementations. Pre-existing c++ escape sequences in the XML files have been replaced by their literal equivalent so that the resulting python doc sting remains unchanged. --- src/App/GeoFeaturePy.xml | 15 +- src/App/MetadataPy.xml | 109 ++++++--- src/App/PropertyContainerPy.xml | 156 ++++++++----- src/Base/AxisPy.xml | 39 ++-- src/Base/BoundBoxPy.xml | 202 ++++++++++------ src/Base/CoordinateSystemPy.xml | 36 ++- src/Base/MatrixPy.xml | 199 ++++++++++------ src/Base/PersistencePy.xml | 21 +- src/Base/PlacementPy.xml | 126 ++++++---- src/Base/RotationPy.xml | 126 ++++++---- src/Base/TypePy.xml | 54 +++-- src/Base/VectorPy.xml | 123 ++++++---- src/Gui/AxisOriginPy.xml | 21 +- src/Gui/CommandPy.xml | 105 ++++++--- src/Gui/DocumentPy.xml | 140 +++++++---- src/Gui/ViewProviderPy.xml | 219 ++++++++++++------ src/Mod/Fem/App/FemMeshPy.xml | 2 +- src/Mod/Mesh/App/MeshFeaturePy.xml | 2 +- src/Mod/Mesh/App/MeshPy.xml | 2 +- src/Mod/Part/App/GeometryCurvePy.xml | 14 +- src/Mod/Part/App/GeometrySurfacePy.xml | 14 +- src/Mod/Path/App/AreaPy.xml | 19 +- src/Mod/Path/App/FeatureAreaPy.xml | 3 +- src/Mod/Path/PathSimulator/App/PathSimPy.xml | 33 ++- .../templateClassPyExport.py | 13 +- 25 files changed, 1193 insertions(+), 600 deletions(-) diff --git a/src/App/GeoFeaturePy.xml b/src/App/GeoFeaturePy.xml index b1d0da998f..83726bf70a 100644 --- a/src/App/GeoFeaturePy.xml +++ b/src/App/GeoFeaturePy.xml @@ -11,7 +11,8 @@ FatherNamespace="App"> - App.GeoFeature class.\n + App.GeoFeature class. + Base class of all geometric document objects. This class does the whole placement and position handling. With the method `getPropertyOfGeometry` is possible to obtain @@ -20,14 +21,16 @@ to any particular property name. - getPaths()\n + getPaths() + Returns all possible paths to the root of the document. Note: Not implemented. - getGlobalPlacement() -> Base.Placement\n + getGlobalPlacement() -> Base.Placement + Returns the placement of the object in the global coordinate space, respecting all stacked relationships. Note: This function is not available during recompute, as there the placements of parents @@ -36,7 +39,8 @@ can change after the execution of this object, rendering the result wrong. - getPropertyNameOfGeometry() -> str or None\n + getPropertyNameOfGeometry() -> str or None + Returns the property name of the actual geometry. For example for a Part feature it returns the value 'Shape', for a mesh feature the value 'Mesh' and so on. @@ -45,7 +49,8 @@ If an object has no such property then None is returned. - getPropertyOfGeometry() -> object or None\n + getPropertyOfGeometry() -> object or None + Returns the property of the actual geometry. For example for a Part feature it returns its Shape property, for a Mesh feature its Mesh property and so on. diff --git a/src/App/MetadataPy.xml b/src/App/MetadataPy.xml index 0d31aca4b9..081b16ed54 100644 --- a/src/App/MetadataPy.xml +++ b/src/App/MetadataPy.xml @@ -17,21 +17,29 @@ - App.Metadata class.\n + App.Metadata class. + A Metadata object reads an XML-formatted package metadata file and provides -read and write access to its contents.\n -The following constructors are supported:\n +read and write access to its contents. + +The following constructors are supported: + Metadata() -Empty constructor.\n +Empty constructor. + Metadata(metadata) Copy constructor. -metadata : App.Metadata\n +metadata : App.Metadata + Metadata(file) Reads the XML file and provides access to the metadata it specifies. -file : str\n XML file name.\n +file : str + XML file name. + Metadata(bytes) Treats the bytes as UTF-8-encoded XML data and provides access to the metadata it specifies. -bytes : bytes\n Python bytes-like object. +bytes : bytes + Python bytes-like object. Metadata @@ -203,7 +211,8 @@ If unset it will be 0.0.0. - getLastSupportedFreeCADVersion() -> str or None\n + getLastSupportedFreeCADVersion() -> str or None + Search through all content package items, and determine if a maximum supported version of FreeCAD is set. Returns None if no maximum version is set, or if *any* content item fails to @@ -214,7 +223,8 @@ known versions). - getFirstSupportedFreeCADVersion() -> str or None\n + getFirstSupportedFreeCADVersion() -> str or None + Search through all content package items, and determine if a minimum supported version of FreeCAD is set. Returns 0.0 if no minimum version is set, or if *any* content item fails to @@ -226,7 +236,8 @@ the metadata standard was added then). - supportsCurrentFreeCAD() -> bool\n + supportsCurrentFreeCAD() -> bool + Returns False if this metadata object directly indicates that it does not support the current version of FreeCAD, or True if it makes no indication, or specifically indicates that it does support the current version. Does not @@ -236,7 +247,8 @@ recurse into Content items. - getGenericMetadata(name) -> list\n + getGenericMetadata(name) -> list + Get the list of GenericMetadata objects with key 'name'. Generic metadata objects are Python objects with a string 'contents' and a dictionary of strings, 'attributes'. They represent unrecognized simple XML tags @@ -246,151 +258,176 @@ in the metadata file. - addContentItem(content_type,metadata)\n + addContentItem(content_type,metadata) + Add a new content item of type 'content_type' with metadata 'metadata'. - removeContentItem(content_type,name)\n + removeContentItem(content_type,name) + Remove the content item of type 'content_type' with name 'name'. - addMaintainer(name, email)\n + addMaintainer(name, email) + Add a new Maintainer. - removeMaintainer(name, email)\n + removeMaintainer(name, email) + Remove the Maintainer. - addLicense(short_code,path)\n + addLicense(short_code,path) + Add a new License. - removeLicense(short_code)\n + removeLicense(short_code) + Remove the License. - addUrl(url_type,url,branch)\n -Add a new Url or type 'url_type' (which should be one of 'repository', 'readme',\n -'bugtracker', 'documentation', or 'webpage') If type is 'repository' you\n + addUrl(url_type,url,branch) + +Add a new Url or type 'url_type' (which should be one of 'repository', 'readme', + +'bugtracker', 'documentation', or 'webpage') If type is 'repository' you + must also specify the 'branch' parameter. - removeUrl(url_type,url)\n + removeUrl(url_type,url) + Remove the Url. - addAuthor(name, email)\n + addAuthor(name, email) + Add a new Author with name 'name', and optionally email 'email'. - removeAuthor(name, email)\n + removeAuthor(name, email) + Remove the Author. - addDepend(name, kind, optional)\n -Add a new Dependency on package 'name' of kind 'kind' (optional, one of 'auto' (the default),\n + addDepend(name, kind, optional) + +Add a new Dependency on package 'name' of kind 'kind' (optional, one of 'auto' (the default), + 'internal', 'addon', or 'python'). - removeDepend(name, kind)\n -Remove the Dependency on package 'name' of kind 'kind' (optional - if unspecified any\n + removeDepend(name, kind) + +Remove the Dependency on package 'name' of kind 'kind' (optional - if unspecified any + matching name is removed). - addConflict(name, kind)\n + addConflict(name, kind) + Add a new Conflict. See documentation for addDepend(). - removeConflict(name, kind)\n + removeConflict(name, kind) + Remove the Conflict. See documentation for removeDepend(). - addReplace(name)\n + addReplace(name) + Add a new Replace. - removeReplace(name)\n + removeReplace(name) + Remove the Replace. - addTag(tag)\n + addTag(tag) + Add a new Tag. - removeTag(tag)\n + removeTag(tag) + Remove the Tag. - addFile(filename)\n + addFile(filename) + Add a new File. - removeFile(filename)\n + removeFile(filename) + Remove the File. - write(filename)\n + write(filename) + Write the metadata to the given file as XML data. diff --git a/src/App/PropertyContainerPy.xml b/src/App/PropertyContainerPy.xml index b0243a1346..3ededf7d54 100644 --- a/src/App/PropertyContainerPy.xml +++ b/src/App/PropertyContainerPy.xml @@ -16,130 +16,182 @@ - getPropertyByName(name, checkOwner=0) -> object or Tuple\n + getPropertyByName(name, checkOwner=0) -> object or Tuple + Returns the value of a named property. Note that the returned property may not -always belong to this container (e.g. from a linked object).\n -name : str\n Name of the property. -checkOwner : int\n 0: just return the property. +always belong to this container (e.g. from a linked object). + +name : str + Name of the property. +checkOwner : int + 0: just return the property. 1: raise exception if not found or the property does not belong to this container. 2: return a tuple (owner, propertyValue). - getPropertyTouchList(name) -> tuple\n -Returns a list of index of touched values for list type properties.\n -name : str\n Property name. + getPropertyTouchList(name) -> tuple + +Returns a list of index of touched values for list type properties. + +name : str + Property name. - getTypeOfProperty(name) -> list\n + getTypeOfProperty(name) -> list + Returns the type of a named property. This can be a list conformed by elements in -(Hidden, NoRecompute, NoPersist, Output, ReadOnly, Transient).\n -name : str\n Property name. +(Hidden, NoRecompute, NoPersist, Output, ReadOnly, Transient). + +name : str + Property name. - getTypeIdOfProperty(name) -> str\n -Returns the C++ class name of a named property.\n -name : str\n Property name. + getTypeIdOfProperty(name) -> str + +Returns the C++ class name of a named property. + +name : str + Property name. - setEditorMode(name, type) -> None\n -Set the behaviour of the property in the property editor.\n -name : str\n Property name. -type : int, sequence of str\n Property type. + setEditorMode(name, type) -> None + +Set the behaviour of the property in the property editor. + +name : str + Property name. +type : int, sequence of str + Property type. 0: default behaviour. 1: item is ready-only. 2: item is hidden. 3: item is hidden and read-only. If sequence, the available items are 'ReadOnly' and 'Hidden'. - getEditorMode(name) -> list\n + getEditorMode(name) -> list + Get the behaviour of the property in the property editor. It returns a list of strings with the current mode. If the list is empty there are no special restrictions. If the list contains 'ReadOnly' then the item appears in the property editor but is disabled. -If the list contains 'Hidden' then the item even doesn't appear in the property editor.\n -name : str\n Property name. +If the list contains 'Hidden' then the item even doesn't appear in the property editor. + +name : str + Property name. - getGroupOfProperty(name) -> str\n + getGroupOfProperty(name) -> str + Returns the name of the group which the property belongs to in this class. -The properties are sorted in different named groups for convenience.\n -name : str\n Property name. +The properties are sorted in different named groups for convenience. + +name : str + Property name. - setGroupOfProperty(name, group) -> None\n -Set the name of the group of a dynamic property.\n -name : str\n Property name. -group : str\n Group name. + setGroupOfProperty(name, group) -> None + +Set the name of the group of a dynamic property. + +name : str + Property name. +group : str + Group name. - setPropertyStatus(name, val) -> None\n -Set property status.\n -name : str\n Property name. -val : int, str, sequence of str or int\n Call getPropertyStatus() to get a list of supported text value. + setPropertyStatus(name, val) -> None + +Set property status. + +name : str + Property name. +val : int, str, sequence of str or int + Call getPropertyStatus() to get a list of supported text value. If the text start with '-' or the integer value is negative, then the status is cleared. - getPropertyStatus(name='') -> list\n -Get property status.\n -name : str\n Property name. If empty, returns a list of supported text names of the status. + getPropertyStatus(name='') -> list + +Get property status. + +name : str + Property name. If empty, returns a list of supported text names of the status. - getDocumentationOfProperty(name) -> str\n -Returns the documentation string of the property of this class.\n -name : str\n Property name. + getDocumentationOfProperty(name) -> str + +Returns the documentation string of the property of this class. + +name : str + Property name. - setDocumentationOfProperty(name, docstring) -> None\n -Set the documentation string of a dynamic property of this class.\n -name : str\n Property name. -docstring : str\n Documentation string. + setDocumentationOfProperty(name, docstring) -> None + +Set the documentation string of a dynamic property of this class. + +name : str + Property name. +docstring : str + Documentation string. - getEnumerationsOfProperty(name) -> list or None\n + getEnumerationsOfProperty(name) -> list or None + Return all enumeration strings of the property of this class or None if not a -PropertyEnumeration.\n -name : str\n Property name. +PropertyEnumeration. + +name : str + Property name. - dumpPropertyContent(Property, Compression=3) -> bytearray\n + dumpPropertyContent(Property, Compression=3) -> bytearray + Dumps the content of the property, both the XML representation and the additional -data files required, into a byte representation.\n -Property : str\n Property Name. -Compression : int\n Set the data compression level in the range [0, 9]. Set to 0 for no compression. +data files required, into a byte representation. + +Property : str + Property Name. +Compression : int + Set the data compression level in the range [0, 9]. Set to 0 for no compression. - restorePropertyContent(name, obj) -> None\n + restorePropertyContent(name, obj) -> None + Restore the content of the object from a byte representation as stored by `dumpPropertyContent`. -It could be restored from any Python object implementing the buffer protocol.\n -name : str\n Property name. -obj : buffer\n Object with buffer protocol support. +It could be restored from any Python object implementing the buffer protocol. + +name : str + Property name. +obj : buffer + Object with buffer protocol support. diff --git a/src/Base/AxisPy.xml b/src/Base/AxisPy.xml index e94b00ce53..65efaf8413 100644 --- a/src/Base/AxisPy.xml +++ b/src/Base/AxisPy.xml @@ -13,14 +13,19 @@ FatherNamespace="Base"> - Base.Axis class.\n -An Axis defines a direction and a position (base) in 3D space.\n -The following constructors are supported:\n + Base.Axis class. + +An Axis defines a direction and a position (base) in 3D space. + +The following constructors are supported: + Axis() -Empty constructor.\n +Empty constructor. + Axis(axis) Copy constructor. -axis : Base.Axis\n +axis : Base.Axis + Axis(base, direction) Define from a position and a direction. base : Base.Vector @@ -29,27 +34,35 @@ direction : Base.Vector > - copy() -> Base.Axis\n + copy() -> Base.Axis + Returns a copy of this Axis. - move(vector) -> None\n -Move the axis base along the given vector.\n -vector : Base.Vector\n Vector by which to move the axis. + move(vector) -> None + +Move the axis base along the given vector. + +vector : Base.Vector + Vector by which to move the axis. - multiply(placement) -> Base.Axis\n -Multiply this axis by a placement.\n -placement : Base.Placement\n Placement by which to multiply the axis. + multiply(placement) -> Base.Axis + +Multiply this axis by a placement. + +placement : Base.Placement + Placement by which to multiply the axis. - reversed() -> Base.Axis\n + reversed() -> Base.Axis + Compute the reversed axis. This returns a new Base.Axis with the original direction reversed. diff --git a/src/Base/BoundBoxPy.xml b/src/Base/BoundBoxPy.xml index f7917f5cce..876b4462c4 100644 --- a/src/Base/BoundBoxPy.xml +++ b/src/Base/BoundBoxPy.xml @@ -14,7 +14,8 @@ This is the BoundBox export class - Base.BoundBox class.\n + Base.BoundBox class. + This class represents a bounding box. A bounding box is a rectangular cuboid which is a way to describe outer boundaries and is obtained from a lot of 3D types. @@ -22,85 +23,118 @@ It is often used to check if a 3D entity lies in the range of another object. Checking for bounding interference first can save a lot of computing time! An invalid BoundBox is represented by inconsistent values at each direction: The maximum float value of the system at the minimum coordinates, and the -opposite value at the maximum coordinates.\n -The following constructors are supported:\n +opposite value at the maximum coordinates. + +The following constructors are supported: + BoundBox() -Empty constructor. Returns an invalid BoundBox.\n +Empty constructor. Returns an invalid BoundBox. + BoundBox(boundBox) Copy constructor. -boundBox : Base.BoundBox\n +boundBox : Base.BoundBox + BoundBox(xMin, yMin=0, zMin=0, xMax=0, yMax=0, zMax=0) Define from the minimum and maximum values at each direction. -xMin : float\n Minimum value at x-coordinate. -yMin : float\n Minimum value at y-coordinate. -zMin : float\n Minimum value at z-coordinate. -xMax : float\n Maximum value at x-coordinate. -yMax : float\n Maximum value at y-coordinate. -zMax : float\n Maximum value at z-coordinate.\n +xMin : float + Minimum value at x-coordinate. +yMin : float + Minimum value at y-coordinate. +zMin : float + Minimum value at z-coordinate. +xMax : float + Maximum value at x-coordinate. +yMax : float + Maximum value at y-coordinate. +zMax : float + Maximum value at z-coordinate. + App.BoundBox(min, max) Define from two containers representing the minimum and maximum values of the coordinates in each direction. -min : Base.Vector, tuple\n Minimum values of the coordinates. -max : Base.Vector, tuple\n Maximum values of the coordinates. +min : Base.Vector, tuple + Minimum values of the coordinates. +max : Base.Vector, tuple + Maximum values of the coordinates. - setVoid() -> None\n + setVoid() -> None + Invalidate the bounding box. - isValid() -> bool\n + isValid() -> bool + Checks if the bounding box is valid. add(minMax) -> None -add(x, y, z) -> None\n +add(x, y, z) -> None + Increase the maximum values or decrease the minimum values of this BoundBox by replacing the current values with the given values, so the bounding box can grow -but not shrink.\n -minMax : Base.Vector, tuple\n Values to enlarge at each direction. -x : float\n Value to enlarge at x-direction. -y : float\n Value to enlarge at y-direction. -z : float\n Value to enlarge at z-direction. +but not shrink. + +minMax : Base.Vector, tuple + Values to enlarge at each direction. +x : float + Value to enlarge at x-direction. +y : float + Value to enlarge at y-direction. +z : float + Value to enlarge at z-direction. - getPoint(index) ->Base.Vector\n + getPoint(index) ->Base.Vector + Get the point of the given index. -The index must be in the range of [0, 7].\n +The index must be in the range of [0, 7]. + index : int - getEdge(index) -> tuple of Base.Vector\n + getEdge(index) -> tuple of Base.Vector + Get the edge points of the given index. -The index must be in the range of [0, 11].\n +The index must be in the range of [0, 11]. + index : int closestPoint(point) -> Base.Vector -closestPoint(x, y, z) -> Base.Vector\n -Get the closest point of the bounding box to the given point.\n -point : Base.Vector, tuple\n Coordinates of the given point. -x : float\n X-coordinate of the given point. -y : float\n Y-coordinate of the given point. -z : float\n Z-coordinate of the given point. +closestPoint(x, y, z) -> Base.Vector + +Get the closest point of the bounding box to the given point. + +point : Base.Vector, tuple + Coordinates of the given point. +x : float + X-coordinate of the given point. +y : float + Y-coordinate of the given point. +z : float + Z-coordinate of the given point. intersect(boundBox2) -> bool -intersect(base, dir) -> bool\n +intersect(base, dir) -> bool + Checks if the given object intersects with this bounding box. That can be -another bounding box or a line specified by base and direction.\n +another bounding box or a line specified by base and direction. + boundBox2 : Base.BoundBox base : Base.Vector, tuple dir : Base.Vector, tuple @@ -108,72 +142,100 @@ dir : Base.Vector, tuple - intersected(boundBox2) -> Base.BoundBox\n -Returns the intersection of this and the given bounding box.\n + intersected(boundBox2) -> Base.BoundBox + +Returns the intersection of this and the given bounding box. + boundBox2 : Base.BoundBox - united(boundBox2) -> Base.BoundBox\n -Returns the union of this and the given bounding box.\n + united(boundBox2) -> Base.BoundBox + +Returns the union of this and the given bounding box. + boundBox2 : Base.BoundBox - enlarge(variation) -> None\n + enlarge(variation) -> None + Decrease the minimum values and increase the maximum values by the given value. -A negative value shrinks the bounding box.\n +A negative value shrinks the bounding box. + variation : float - getIntersectionPoint(base, dir, epsilon=0.0001) -> Base.Vector\n + getIntersectionPoint(base, dir, epsilon=0.0001) -> Base.Vector + Calculate the intersection point of a line with the bounding box. -The base point must lie inside the bounding box, if not an exception is thrown.\n -base : Base.Vector\n Base point of the line. -dir : Base.Vector\n Direction of the line. -epsilon : float\n Bounding box size tolerance. +The base point must lie inside the bounding box, if not an exception is thrown. + +base : Base.Vector + Base point of the line. +dir : Base.Vector + Direction of the line. +epsilon : float + Bounding box size tolerance. move(displacement) -> None -move(x, y, z) -> None\n -Move the bounding box by the given values.\n -displacement : Base.Vector, tuple\n Displacement at each direction. -x : float\n Displacement at x-direction. -y : float\n Displacement at y-direction. -z : float\n Displacement at z-direction. +move(x, y, z) -> None + +Move the bounding box by the given values. + +displacement : Base.Vector, tuple + Displacement at each direction. +x : float + Displacement at x-direction. +y : float + Displacement at y-direction. +z : float + Displacement at z-direction. scale(factor) -> None -scale(x, y, z) -> None\n -Scale the bounding box by the given values.\n -factor : Base.Vector, tuple\n Factor scale at each direction. -x : float\n Scale at x-direction. -y : float\n Scale at y-direction. -z : float\n Scale at z-direction. +scale(x, y, z) -> None + +Scale the bounding box by the given values. + +factor : Base.Vector, tuple + Factor scale at each direction. +x : float + Scale at x-direction. +y : float + Scale at y-direction. +z : float + Scale at z-direction. - transformed(matrix) -> Base.BoundBox\n + transformed(matrix) -> Base.BoundBox + Returns a new BoundBox containing the transformed rectangular cuboid -represented by this BoundBox.\n -matrix : Base.Matrix\n Transformation matrix. +represented by this BoundBox. + +matrix : Base.Matrix + Transformation matrix. - isCutPlane(base, normal) -> bool\n + isCutPlane(base, normal) -> bool + Check if the plane specified by base and normal intersects (cuts) this bounding -box.\n +box. + base : Base.Vector normal : Base.Vector @@ -181,12 +243,18 @@ normal : Base.Vector isInside(object) -> bool -isInside(x, y, z) -> bool\n -Check if a point or a bounding box is inside this bounding box.\n -object : Base.Vector, Base.BoundBox\n Object to check if it is inside this bounding box. -x : float\n X-coordinate of the point to check. -y : float\n Y-coordinate of the point to check. -z : float\n Z-coordinate of the point to check. +isInside(x, y, z) -> bool + +Check if a point or a bounding box is inside this bounding box. + +object : Base.Vector, Base.BoundBox + Object to check if it is inside this bounding box. +x : float + X-coordinate of the point to check. +y : float + Y-coordinate of the point to check. +z : float + Z-coordinate of the point to check. diff --git a/src/Base/CoordinateSystemPy.xml b/src/Base/CoordinateSystemPy.xml index 63c5169d3b..8342ec2764 100644 --- a/src/Base/CoordinateSystemPy.xml +++ b/src/Base/CoordinateSystemPy.xml @@ -14,46 +14,58 @@ This is the CoordinateSystem export class - Base.CoordinateSystem class.\n -An orthonormal right-handed coordinate system in 3D space.\n + Base.CoordinateSystem class. + +An orthonormal right-handed coordinate system in 3D space. + CoordinateSystem() Empty constructor. - setAxes(axis, xDir) -> None\n + setAxes(axis, xDir) -> None + Set axis or Z-direction, and X-direction. The X-direction is determined from the orthonormal compononent of `xDir` -with respect to `axis` direction.\n +with respect to `axis` direction. + axis : Base.Axis, Base.Vector xDir : Base.Vector - displacement(coordSystem2) -> Base.Placement\n -Computes the placement from this to the passed coordinate system `coordSystem2`.\n + displacement(coordSystem2) -> Base.Placement + +Computes the placement from this to the passed coordinate system `coordSystem2`. + coordSystem2 : Base.CoordinateSystem - transformTo(vector) -> Base.Vector\n -Computes the coordinates of the point in coordinates of this coordinate system.\n + transformTo(vector) -> Base.Vector + +Computes the coordinates of the point in coordinates of this coordinate system. + vector : Base.Vector - transform(trans) -> None\n -Applies a transformation on this coordinate system.\n + transform(trans) -> None + +Applies a transformation on this coordinate system. + trans : Base.Rotation, Base.Placement - setPlacment(placement) -> None\n -Set placement to the coordinate system.\n + setPlacment(placement) -> None + +Set placement to the coordinate system. + placement : Base.Placement diff --git a/src/Base/MatrixPy.xml b/src/Base/MatrixPy.xml index 7f53405601..160b0724de 100644 --- a/src/Base/MatrixPy.xml +++ b/src/Base/MatrixPy.xml @@ -16,23 +16,30 @@ This is the Matrix export class - Base.Matrix class.\n + Base.Matrix class. + A 4x4 Matrix. In particular, this matrix can represent an affine transformation, that is, given a 3D vector `x`, apply the transformation y = M*x + b, where the matrix `M` is a linear map and the vector `b` is a translation. `y` can be obtained using a linear transformation represented by the 4x4 matrix `A` conformed by the augmented 3x4 matrix (M|b), augmented by row with -(0,0,0,1), therefore: (y, 1) = A*(x, 1).\n -The following constructors are supported:\n +(0,0,0,1), therefore: (y, 1) = A*(x, 1). + +The following constructors are supported: + Matrix() -Empty constructor.\n +Empty constructor. + Matrix(matrix) Copy constructor. -matrix : Base.Matrix.\n +matrix : Base.Matrix. + Matrix(*coef) Define from 16 coefficients of the 4x4 matrix. -coef : sequence of float\n The sequence can have up to 16 elements which complete the matrix by rows.\n +coef : sequence of float + The sequence can have up to 16 elements which complete the matrix by rows. + Matrix(vector1, vector2, vector3, vector4) Define from four 3D vectors which represent the columns of the 3x4 submatrix, useful to represent an affine transformation. The fourth row is made up by @@ -40,212 +47,272 @@ useful to represent an affine transformation. The fourth row is made up by vector1 : Base.Vector vector2 : Base.Vector vector3 : Base.Vector -vector4 : Base.Vector\n Default to (0,0,0). Optional. +vector4 : Base.Vector + Default to (0,0,0). Optional. move(vector) -> None -move(x, y, z) -> None\n +move(x, y, z) -> None + Move the matrix along a vector, equivalent to left multiply the matrix -by a pure translation transformation.\n +by a pure translation transformation. + vector : Base.Vector, tuple -x : float\n `x` translation. -y : float\n `y` translation. -z : float\n `z` translation. +x : float + `x` translation. +y : float + `y` translation. +z : float + `z` translation. scale(vector) -> None scale(x, y, z) -> None -scale(factor) -> None\n -Scale the first three rows of the matrix.\n +scale(factor) -> None + +Scale the first three rows of the matrix. + vector : Base.Vector -x : float\n First row factor scale. -y : float\n Second row factor scale. -z : float\n Third row factor scale. -factor : float\n global factor scale. +x : float + First row factor scale. +y : float + Second row factor scale. +z : float + Third row factor scale. +factor : float + global factor scale. - hasScale(tol=0) -> ScaleType\n + hasScale(tol=0) -> ScaleType + Return an enum value of ScaleType. Possible values are: Uniform, NonUniformLeft, NonUniformRight, NoScaling or Other -if it's not a scale matrix.\n +if it's not a scale matrix. + tol : float - nullify() -> None\n + nullify() -> None + Make this the null matrix. - isNull() -> bool\n + isNull() -> bool + Check if this is the null matrix. - unity() -> None\n + unity() -> None + Make this matrix to unity (4D identity matrix). - isUnity() -> bool\n + isUnity() -> bool + Check if this is the unit matrix (4D identity matrix). - transform(vector, matrix2) -> None\n + transform(vector, matrix2) -> None + Transform the matrix around a given point. Equivalent to left multiply the matrix by T*M*T_inv, where M is `matrix2`, T the translation generated by `vector` and T_inv the inverse translation. For example, if `matrix2` is a rotation, the result is the transformation generated -by the current matrix followed by a rotation around the point represented by `vector`.\n +by the current matrix followed by a rotation around the point represented by `vector`. + vector : Base.Vector matrix2 : Base.Matrix - col(index) -> Base.Vector\n + col(index) -> Base.Vector + Return the vector of a column, that is, the vector generated by the three -first elements of the specified column.\n -index : int\n Required column index. +first elements of the specified column. + +index : int + Required column index. - setCol(index, vector) -> None\n + setCol(index, vector) -> None + Set the vector of a column, that is, the three first elements of the specified -column by index.\n -index : int\n Required column index. +column by index. + +index : int + Required column index. vector : Base.Vector - row(index) -> Base.Vector\n + row(index) -> Base.Vector + Return the vector of a row, that is, the vector generated by the three -first elements of the specified row.\n -index : int\n Required row index. +first elements of the specified row. + +index : int + Required row index. - setRow(index, vector) -> None\n + setRow(index, vector) -> None + Set the vector of a row, that is, the three first elements of the specified -row by index.\n -index : int\n Required row index. +row by index. + +index : int + Required row index. vector : Base.Vector - trace() -> Base.Vector\n + trace() -> Base.Vector + Return the diagonal of the 3x3 leading principal submatrix as vector. - setTrace(vector) -> None\n -Set the diagonal of the 3x3 leading principal submatrix.\n + setTrace(vector) -> None + +Set the diagonal of the 3x3 leading principal submatrix. + vector : Base.Vector - rotateX(angle) -> None\n -Rotate around X axis.\n -angle : float\n Angle in radians. + rotateX(angle) -> None + +Rotate around X axis. + +angle : float + Angle in radians. - rotateY(angle) -> None\n -Rotate around Y axis.\n -angle : float\n Angle in radians. + rotateY(angle) -> None + +Rotate around Y axis. + +angle : float + Angle in radians. - rotateZ(angle) -> None\n -Rotate around Z axis.\n -angle : float\n Angle in radians. + rotateZ(angle) -> None + +Rotate around Z axis. + +angle : float + Angle in radians. multiply(matrix) -> Base.Matrix -multiply(vector) -> Base.Vector\n +multiply(vector) -> Base.Vector + Right multiply the matrix by the given object. -If the argument is a vector, this is augmented to the 4D vector (`vector`, 1).\n +If the argument is a vector, this is augmented to the 4D vector (`vector`, 1). + matrix : Base.Matrix vector : Base.Vector - multVec(vector) -> Base.Vector\n -Compute the transformed vector using the matrix.\n + multVec(vector) -> Base.Vector + +Compute the transformed vector using the matrix. + vector : Base.Vector - invert() -> None\n + invert() -> None + Compute the inverse matrix in-place, if possible. - inverse() -> Base.Matrix\n + inverse() -> Base.Matrix + Compute the inverse matrix, if possible. - transpose() -> None\n + transpose() -> None + Transpose the matrix in-place. - transposed() -> Base.Matrix\n + transposed() -> Base.Matrix + Returns a transposed copy of this matrix. - determinant() -> float\n + determinant() -> float + Compute the determinant of the matrix. - isOrthogonal(tol=1e-6) -> float\n + isOrthogonal(tol=1e-6) -> float + Checks if the matrix is orthogonal, i.e. M * M^T = k*I and returns -the multiple of the identity matrix. If it's not orthogonal 0 is returned.\n -tol : float\n Tolerance used to check orthogonality. +the multiple of the identity matrix. If it's not orthogonal 0 is returned. + +tol : float + Tolerance used to check orthogonality. - submatrix(dim) -> Base.Matrix\n + submatrix(dim) -> Base.Matrix + Get the leading principal submatrix of the given dimension. The (4 - `dim`) remaining dimensions are completed with the -corresponding identity matrix.\n -dim : int\n Dimension parameter must be in the range [1,4]. +corresponding identity matrix. + +dim : int + Dimension parameter must be in the range [1,4]. - analyze() -> str\n + analyze() -> str + Analyzes the type of transformation. diff --git a/src/Base/PersistencePy.xml b/src/Base/PersistencePy.xml index 581cbaaeca..7857ba0442 100644 --- a/src/Base/PersistencePy.xml +++ b/src/Base/PersistencePy.xml @@ -12,7 +12,8 @@ This is the Persistence class - Base.Persistence class.\n + Base.Persistence class. + Class to dump and restore the content of an object. @@ -29,18 +30,24 @@ Class to dump and restore the content of an object. - dumpContent(Compression=3) -> bytearray\n + dumpContent(Compression=3) -> bytearray + Dumps the content of the object, both the XML representation and the additional -data files required, into a byte representation.\n -Compression : int\n Set the data compression level in the range [0,9]. Set to 0 for no compression. +data files required, into a byte representation. + +Compression : int + Set the data compression level in the range [0,9]. Set to 0 for no compression. - restoreContent(obj) -> None\n + restoreContent(obj) -> None + Restore the content of the object from a byte representation as stored by `dumpContent`. -It could be restored from any Python object implementing the buffer protocol.\n -obj : buffer\n Object with buffer protocol support. +It could be restored from any Python object implementing the buffer protocol. + +obj : buffer + Object with buffer protocol support. diff --git a/src/Base/PlacementPy.xml b/src/Base/PlacementPy.xml index 83c188c9b6..9223b80386 100644 --- a/src/Base/PlacementPy.xml +++ b/src/Base/PlacementPy.xml @@ -15,27 +15,35 @@ FatherNamespace="Base"> - Base.Placement class.\n + Base.Placement class. + A Placement defines an orientation (rotation) and a position (base) in 3D space. -It is used when no scaling or other distortion is needed.\n -The following constructors are supported:\n +It is used when no scaling or other distortion is needed. + +The following constructors are supported: + Placement() -Empty constructor.\n +Empty constructor. + Placement(placement) Copy constructor. -placement : Base.Placement\n +placement : Base.Placement + Placement(matrix) Define from a 4D matrix consisting of rotation and translation. -matrix : Base.Matrix\n +matrix : Base.Matrix + Placement(base, rotation) Define from position and rotation. base : Base.Vector -rotation : Base.Rotation\n +rotation : Base.Rotation + Placement(base, rotation, center) Define from position and rotation with center. base : Base.Vector rotation : Base.Rotation -center : Base.Vector\n +center : Base.Vector + Placement(base, axis, angle) define position and rotation. base : Base.Vector @@ -45,115 +53,149 @@ angle : float - copy() -> Base.Placement\n + copy() -> Base.Placement + Returns a copy of this placement. - move(vector) -> None\n -Move the placement along a vector.\n -vector : Base.Vector\n Vector by which to move the placement. + move(vector) -> None + +Move the placement along a vector. + +vector : Base.Vector + Vector by which to move the placement. - translate(vector) -> None\n -Alias to move(), to be compatible with TopoShape.translate().\n -vector : Base.Vector\n Vector by which to move the placement. + translate(vector) -> None + +Alias to move(), to be compatible with TopoShape.translate(). + +vector : Base.Vector + Vector by which to move the placement. - rotate(center, axis, angle, comp) -> None\n + rotate(center, axis, angle, comp) -> None + Rotate the current placement around center and axis with the given angle. This method is compatible with TopoShape.rotate() if the (optional) keyword argument comp is True (default=False). -center : Base.Vector, sequence of float\n Rotation center. -axis : Base.Vector, sequence of float\n Rotation axis. -angle : float\n Rotation angle in degrees. -comp : bool\n optional keyword only argument, if True (default=False), +center : Base.Vector, sequence of float + Rotation center. +axis : Base.Vector, sequence of float + Rotation axis. +angle : float + Rotation angle in degrees. +comp : bool + optional keyword only argument, if True (default=False), behave like TopoShape.rotate() (i.e. the resulting placements are interchangeable). - multiply(placement) -> Base.Placement\n + multiply(placement) -> Base.Placement + Right multiply this placement with another placement. -Also available as `*` operator.\n -placement : Base.Placement\n Placement by which to multiply this placement. +Also available as `*` operator. + +placement : Base.Placement + Placement by which to multiply this placement. - multVec(vector) -> Base.Vector\n -Compute the transformed vector using the placement.\n -vector : Base.Vector\n Vector to be transformed. + multVec(vector) -> Base.Vector + +Compute the transformed vector using the placement. + +vector : Base.Vector + Vector to be transformed. - toMatrix() -> Base.Matrix\n + toMatrix() -> Base.Matrix + Compute the matrix representation of the placement. - inverse() -> Base.Placement\n + inverse() -> Base.Placement + Compute the inverse placement. - pow(t, shorten=True) -> Base.Placement\n + pow(t, shorten=True) -> Base.Placement + Raise this placement to real power using ScLERP interpolation. -Also available as `**` operator.\n -t : float\n Real power. -shorten : bool\n If True, ensures rotation quaternion is net positive to make +Also available as `**` operator. + +t : float + Real power. +shorten : bool + If True, ensures rotation quaternion is net positive to make the path shorter. - sclerp(placement2, t, shorten=True) -> Base.Placement\n + sclerp(placement2, t, shorten=True) -> Base.Placement + Screw Linear Interpolation (ScLERP) between this placement and `placement2`. Interpolation is a continuous motion along a helical path parametrized by `t` made of equal transforms if discretized. If quaternions of rotations of the two placements differ in sign, the interpolation -will take a long path.\n +will take a long path. + placement2 : Base.Placement -t : float\n Parameter of helical path. t=0 returns this placement, t=1 returns +t : float + Parameter of helical path. t=0 returns this placement, t=1 returns `placement2`. t can also be outside of [0, 1] range for extrapolation. -shorten : bool\n If True, the signs are harmonized before interpolation and the interpolation +shorten : bool + If True, the signs are harmonized before interpolation and the interpolation takes the shorter path. - slerp(placement2, t) -> Base.Placement\n + slerp(placement2, t) -> Base.Placement + Spherical Linear Interpolation (SLERP) between this placement and `placement2`. This function performs independent interpolation of rotation and movement. Result of such interpolation might be not what application expects, thus this tool might be considered for simple cases or for interpolating between small intervals. -For more complex cases you better use the advanced sclerp() function.\n +For more complex cases you better use the advanced sclerp() function. + placement2 : Base.Placement -t : float\n Parameter of the path. t=0 returns this placement, t=1 returns `placement2`. +t : float + Parameter of the path. t=0 returns this placement, t=1 returns `placement2`. - isIdentity([tol=0.0]) -> bool\n + isIdentity([tol=0.0]) -> bool + Returns True if the placement has no displacement and no rotation. Matrix representation is the 4D identity matrix. -tol : float\n Tolerance used to check for identity. +tol : float + Tolerance used to check for identity. If tol is negative or zero, no tolerance is used. - isSame(Base.Placement, [tol=0.0]) -> bool\n + isSame(Base.Placement, [tol=0.0]) -> bool + Checks whether this and the given placement are the same. The default tolerance is set to 0.0 diff --git a/src/Base/RotationPy.xml b/src/Base/RotationPy.xml index 56df46d655..53c8a3104a 100644 --- a/src/Base/RotationPy.xml +++ b/src/Base/RotationPy.xml @@ -16,42 +16,52 @@ This is the Rotation export class - Base.Rotation class.\n -A Rotation using a quaternion.\n -The following constructors are supported:\n + Base.Rotation class. + +A Rotation using a quaternion. + +The following constructors are supported: + Rotation() -Empty constructor.\n +Empty constructor. + Rotation(rotation) -Copy constructor.\n +Copy constructor. + Rotation(Axis, Radian) Rotation(Axis, Degree) Define from an axis and an angle (in radians or degrees according to the keyword). Axis : Base.Vector Radian : float -Degree : float\n +Degree : float + Rotation(vector_start, vector_end) Define from two vectors (rotation from/to vector). vector_start : Base.Vector -vector_end : Base.Vector\n +vector_end : Base.Vector + Rotation(angle1, angle2, angle3) Define from three floats (Euler angles) as yaw-pitch-roll in XY'Z'' convention. angle1 : float angle2 : float -angle3 : float\n +angle3 : float + Rotation(seq, angle1, angle2, angle3) Define from one string and three floats (Euler angles) as Euler rotation of a given type. Call toEulerAngles() for supported sequence types. seq : str angle1 : float angle2 : float -angle3 : float\n +angle3 : float + Rotation(x, y, z, w) Define from four floats (quaternion) where the quaternion is specified as: q = xi+yj+zk+w, i.e. the last parameter is the real part. x : float y : float z : float -w : float\n +w : float + Rotation(dir1, dir2, dir3, seq) Define from three vectors that define rotated axes directions plus an optional 3-characher string of capital letters 'X', 'Y', 'Z' that sets the order of @@ -60,10 +70,12 @@ x is used but corrected if necessary, y is ignored). dir1 : Base.Vector dir2 : Base.Vector dir3 : Base.Vector -seq : str\n +seq : str + Rotation(matrix) Define from a matrix rotation in the 4D representation. -matrix : Base.Matrix\n +matrix : Base.Matrix + Rotation(*coef) Define from 16 or 9 elements which represent the rotation in the 4D matrix representation or in the 3D matrix representation, respectively. @@ -71,68 +83,91 @@ coef : sequence of float - invert() -> None\n + invert() -> None + Sets the rotation to its inverse. - inverted() -> Base.Rotation\n + inverted() -> Base.Rotation + Returns the inverse of the rotation. - isSame(rotation, tol=0) -> bool\n -Checks if `rotation` perform the same transformation as this rotation.\n + isSame(rotation, tol=0) -> bool + +Checks if `rotation` perform the same transformation as this rotation. + rotation : Base.Rotation -tol : float\n Tolerance used to compare both rotations. +tol : float + Tolerance used to compare both rotations. If tol is negative or zero, no tolerance is used. - multiply(rotation) -> Base.Rotation\n -Right multiply this rotation with another rotation.\n -rotation : Base.Rotation\n Rotation by which to multiply this rotation. + multiply(rotation) -> Base.Rotation + +Right multiply this rotation with another rotation. + +rotation : Base.Rotation + Rotation by which to multiply this rotation. - multVec(vector) -> Base.Vector\n -Compute the transformed vector using the rotation.\n -vector : Base.Vector\n Vector to be transformed. + multVec(vector) -> Base.Vector + +Compute the transformed vector using the rotation. + +vector : Base.Vector + Vector to be transformed. - slerp(rotation2, t) -> Base.Rotation\n -Spherical Linear Interpolation (SLERP) of this rotation and `rotation2`.\n -t : float\n Parameter of the path. t=0 returns this rotation, t=1 returns `rotation2`. + slerp(rotation2, t) -> Base.Rotation + +Spherical Linear Interpolation (SLERP) of this rotation and `rotation2`. + +t : float + Parameter of the path. t=0 returns this rotation, t=1 returns `rotation2`. - setYawPitchRoll(angle1, angle2, angle3) -> None\n -Set the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention.\n -angle1 : float\n Angle around yaw axis in degrees. -angle2 : float\n Angle around pitch axis in degrees. -angle3 : float\n Angle around roll axis in degrees. + setYawPitchRoll(angle1, angle2, angle3) -> None + +Set the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention. + +angle1 : float + Angle around yaw axis in degrees. +angle2 : float + Angle around pitch axis in degrees. +angle3 : float + Angle around roll axis in degrees. - getYawPitchRoll() -> tuple\n + getYawPitchRoll() -> tuple + Get the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention. The angles are given in degrees. - setEulerAngles(seq, angle1, angle2, angle3) -> None\n + setEulerAngles(seq, angle1, angle2, angle3) -> None + Set the Euler angles in a given sequence for this rotation. -The angles must be given in degrees.\n -seq : str\n Euler sequence name. All possible values given by toEulerAngles(). +The angles must be given in degrees. + +seq : str + Euler sequence name. All possible values given by toEulerAngles(). angle1 : float angle2 : float angle3 : float @@ -140,29 +175,36 @@ angle3 : float - toEulerAngles(seq) -> list\n -Get the Euler angles in a given sequence for this rotation.\n -seq : str\n Euler sequence name. If not given, the function returns + toEulerAngles(seq) -> list + +Get the Euler angles in a given sequence for this rotation. + +seq : str + Euler sequence name. If not given, the function returns all possible values of `seq`. Optional. - toMatrix() -> Base.Matrix\n + toMatrix() -> Base.Matrix + Convert the rotation to a 4D matrix representation. - isNull() -> bool\n + isNull() -> bool + Returns True if all values in the quaternion representation are zero. - isIdentity(tol=0) -> bool\n + isIdentity(tol=0) -> bool + Returns True if the rotation equals the 4D identity matrix. -tol : float\n Tolerance used to check for identity. +tol : float + Tolerance used to check for identity. If tol is negative or zero, no tolerance is used. diff --git a/src/Base/TypePy.xml b/src/Base/TypePy.xml index e8fba162e3..55addb1fc6 100644 --- a/src/Base/TypePy.xml +++ b/src/Base/TypePy.xml @@ -17,7 +17,8 @@ namespace Base { This is the Type class - Base.BaseType class.\n + Base.BaseType class. + This class is not intended to create instances of itself, but to get information from the different types and create instances of them. Regarding instantiation, this is possible in cases that inherit from the @@ -25,74 +26,91 @@ Base::BaseClass class and are not abstract classes. - fromName(name) -> Base.BaseType\n -Returns a type object by name.\n + fromName(name) -> Base.BaseType + +Returns a type object by name. + name : str - fromKey(key) -> Base.BaseType\n -Returns a type id object by key.\n + fromKey(key) -> Base.BaseType + +Returns a type id object by key. + key : int - getNumTypes() -> int\n + getNumTypes() -> int + Returns the number of type ids created so far. - getBadType() -> Base.BaseType\n + getBadType() -> Base.BaseType + Returns an invalid type id. - getAllDerivedFrom(type) -> list\n -Returns all descendants from the given type id.\n + getAllDerivedFrom(type) -> list + +Returns all descendants from the given type id. + type : str, Base.BaseType - getParent() -> Base.BaseType\n + getParent() -> Base.BaseType + Returns the parent type id. - isBad() -> bool\n + isBad() -> bool + Checks if the type id is invalid. - isDerivedFrom(type) -> bool\n -Returns true if given type id is a father of this type id.\n + isDerivedFrom(type) -> bool + +Returns true if given type id is a father of this type id. + type : str, Base.BaseType - getAllDerived() -> list\n + getAllDerived() -> list + Returns all descendants from this type id. - createInstance() -> object\n + createInstance() -> object + Creates an instance of this type id. - createInstanceByName(name, load=False) -> object\n -Creates an instance of the named type id.\n + createInstanceByName(name, load=False) -> object + +Creates an instance of the named type id. + name : str -load : bool\n Load named type id module. +load : bool + Load named type id module. diff --git a/src/Base/VectorPy.xml b/src/Base/VectorPy.xml index 237da76229..a434f41f11 100644 --- a/src/Base/VectorPy.xml +++ b/src/Base/VectorPy.xml @@ -16,162 +16,203 @@ This is the Vector export class - Base.Vector class.\n + Base.Vector class. + This class represents a 3D float vector. -Useful to represent points in the 3D space.\n -The following constructors are supported:\n +Useful to represent points in the 3D space. + +The following constructors are supported: + Vector(x=0, y=0, z=0) x : float y : float -z : float\n +z : float + Vector(vector) Copy constructor. -vector : Base.Vector\n +vector : Base.Vector + Vector(seq) Define from a sequence of float. seq : sequence of float. - __reduce__() -> tuple\n + __reduce__() -> tuple + Serialization of Vector objects. - add(vector2) -> Base.Vector\n -Returns the sum of this vector and `vector2`.\n + add(vector2) -> Base.Vector + +Returns the sum of this vector and `vector2`. + vector2 : Base.Vector - sub(vector2) -> Base.Vector\n -Returns the difference of this vector and `vector2`.\n + sub(vector2) -> Base.Vector + +Returns the difference of this vector and `vector2`. + vector2 : Base.Vector - negative() -> Base.Vector\n + negative() -> Base.Vector + Returns the negative (opposite) of this vector. - scale(x, y, z) -> Base.Vector\n -Scales in-place this vector by the given factor in each component.\n -x : float\n x-component factor scale. -y : float\n y-component factor scale. -z : float\n z-component factor scale. + scale(x, y, z) -> Base.Vector + +Scales in-place this vector by the given factor in each component. + +x : float + x-component factor scale. +y : float + y-component factor scale. +z : float + z-component factor scale. - multiply(factor) -> Base.Vector\n + multiply(factor) -> Base.Vector + Multiplies in-place each component of this vector by a single factor. -Equivalent to scale(factor, factor, factor).\n +Equivalent to scale(factor, factor, factor). + factor : float - dot(vector2) -> float\n -Returns the scalar product (dot product) between this vector and `vector2`.\n + dot(vector2) -> float + +Returns the scalar product (dot product) between this vector and `vector2`. + vector2 : Base.Vector - cross(vector2) -> Base.Vector\n -Returns the vector product (cross product) between this vector and `vector2`.\n + cross(vector2) -> Base.Vector + +Returns the vector product (cross product) between this vector and `vector2`. + vector2 : Base.Vector - isOnLineSegment(vector1, vector2) -> bool\n -Checks if this vector is on the line segment generated by `vector1` and `vector2`.\n + isOnLineSegment(vector1, vector2) -> bool + +Checks if this vector is on the line segment generated by `vector1` and `vector2`. + vector1 : Base.Vector vector2 : Base.Vector - getAngle(vector2) -> float\n -Returns the angle in radians between this vector and `vector2`.\n + getAngle(vector2) -> float + +Returns the angle in radians between this vector and `vector2`. + vector2 : Base.Vector - normalize() -> Base.Vector\n + normalize() -> Base.Vector + Normalizes in-place this vector to the length of 1.0. - isEqual(vector2, tol=0) -> bool\n + isEqual(vector2, tol=0) -> bool + Checks if the distance between the points represented by this vector -and `vector2` is less or equal to the given tolerance.\n +and `vector2` is less or equal to the given tolerance. + vector2 : Base.Vector tol : float - projectToLine(point, dir) -> Base.Vector\n + projectToLine(point, dir) -> Base.Vector + Projects `point` on a line that goes through the origin with the direction `dir`. The result is the vector from `point` to the projected point. The operation is equivalent to dir_n.cross(dir_n.cross(point)), where `dir_n` is the vector `dir` normalized. The method modifies this vector instance according to result and does not -depend on the vector itself.\n +depend on the vector itself. + point : Base.Vector dir : Base.Vector - projectToPlane(base, normal) -> Base.Vector\n + projectToPlane(base, normal) -> Base.Vector + Projects in-place this vector on a plane defined by a base point -represented by `base` and a normal defined by `normal`.\n +represented by `base` and a normal defined by `normal`. + base : Base.Vector normal : Base.Vector - distanceToPoint(point2) -> float\n -Returns the distance to another point represented by `point2`.\n. + distanceToPoint(point2) -> float + +Returns the distance to another point represented by `point2`. +. point : Base.Vector - distanceToLine(base, dir) -> float\n + distanceToLine(base, dir) -> float + Returns the distance between the point represented by this vector and a line defined by a base point represented by `base` and a -direction `dir`.\n +direction `dir`. + base : Base.Vector dir : Base.Vector - distanceToLineSegment(point1, point2) -> Base.Vector\n + distanceToLineSegment(point1, point2) -> Base.Vector + Returns the vector between the point represented by this vector and the point on the line segment with the shortest distance. The line segment is defined by -`point1` and `point2`.\n +`point1` and `point2`. + point1 : Base.Vector point2 : Base.Vector - distanceToPlane(base, normal) -> float\n + distanceToPlane(base, normal) -> float + Returns the distance between this vector and a plane defined by a -base point represented by `base` and a normal defined by `normal`.\n +base point represented by `base` and a normal defined by `normal`. + base : Base.Vector normal : Base.Vector diff --git a/src/Gui/AxisOriginPy.xml b/src/Gui/AxisOriginPy.xml index ea97a5b476..6d8d0bd2c5 100644 --- a/src/Gui/AxisOriginPy.xml +++ b/src/Gui/AxisOriginPy.xml @@ -13,23 +13,30 @@ Delete="true"> - Gui.AxisOrigin class.\n + Gui.AxisOrigin class. + Class for creating a Coin3D representation of a coordinate system. - getElementPicked(pickedPoint) -> str\n -Returns the picked element name.\n + getElementPicked(pickedPoint) -> str + +Returns the picked element name. + pickedPoint : coin.SoPickedPoint - getDetailPath(subname, path) -> coin.SoDetail or None\n + getDetailPath(subname, path) -> coin.SoDetail or None + Returns Coin detail of a subelement. -Note: Not fully implemented. Currently only returns None.\n -subname : str\n String reference to the subelement. -path: coin.SoPath\n Output Coin path leading to the returned element detail. +Note: Not fully implemented. Currently only returns None. + +subname : str + String reference to the subelement. +path: coin.SoPath + Output Coin path leading to the returned element detail. diff --git a/src/Gui/CommandPy.xml b/src/Gui/CommandPy.xml index 2f416f5c1f..2fa2f65639 100644 --- a/src/Gui/CommandPy.xml +++ b/src/Gui/CommandPy.xml @@ -15,107 +15,142 @@ - get(name) -> Gui.Command or None\n -Get a given command by name or None if it doesn't exist.\n -name : str\n Command name. + get(name) -> Gui.Command or None + +Get a given command by name or None if it doesn't exist. + +name : str + Command name. - update() -> None\n + update() -> None + Update active status of all commands. - listAll() -> list of str\n + listAll() -> list of str + Returns the name of all commands. - listByShortcut(string, useRegExp=False) -> list of str\n + listByShortcut(string, useRegExp=False) -> list of str + Returns a list of all commands, filtered by shortcut. Shortcuts are converted to uppercase and spaces removed -prior to comparison.\n -string : str\n Shortcut to be searched. -useRegExp : bool\n Filter using regular expression. +prior to comparison. + +string : str + Shortcut to be searched. +useRegExp : bool + Filter using regular expression. - run(item=0) -> None\n -Runs the given command.\n -item : int\n Item to be run. + run(item=0) -> None + +Runs the given command. + +item : int + Item to be run. - isActive() -> bool\n + isActive() -> bool + Returns True if the command is active, False otherwise. - getShortcut() -> str\n + getShortcut() -> str + Returns string representing shortcut key accelerator for command. - setShortcut(string) -> bool\n -Sets shortcut for given command, returns True for success.\n -string : str\n Shortcut to be set. + setShortcut(string) -> bool + +Sets shortcut for given command, returns True for success. + +string : str + Shortcut to be set. - resetShortcut() -> bool\n + resetShortcut() -> bool + Resets shortcut for given command back to the default, returns True for success. - getInfo() -> dict\n + getInfo() -> dict + Return information about this command. - getAction() -> list of QAction\n + getAction() -> list of QAction + Return the associated QAction object. - createCustomCommand(macroFile, menuText, toolTip, whatsThis, statusTip, pixmap, shortcut) -> str\n -Create a custom command for a macro. Returns name of the created command.\n -macroFile : str\n Macro file. -menuText : str\n Menu text. Optional. -toolTip : str\n Tool tip text. Optional. -whatsThis : str\n `What's this?` text. Optional. -statusTip : str\n Status tip text. Optional. -pixmap : str\n Pixmap name. Optional. -shortcut : str\n Shortcut key sequence. Optional. + createCustomCommand(macroFile, menuText, toolTip, whatsThis, statusTip, pixmap, shortcut) -> str + +Create a custom command for a macro. Returns name of the created command. + +macroFile : str + Macro file. +menuText : str + Menu text. Optional. +toolTip : str + Tool tip text. Optional. +whatsThis : str + `What's this?` text. Optional. +statusTip : str + Status tip text. Optional. +pixmap : str + Pixmap name. Optional. +shortcut : str + Shortcut key sequence. Optional. - removeCustomCommand(name) -> bool\n + removeCustomCommand(name) -> bool + Remove the custom command if it exists. Given the name of a custom command, this removes that command. It is not an error to remove a non-existent command, the function simply does nothing in that case. -Returns True if something was removed, or False if not.\n -name : str\n Command name. +Returns True if something was removed, or False if not. + +name : str + Command name. - findCustomCommand(name) -> str or None\n + findCustomCommand(name) -> str or None + Given the name of a macro, return the name of the custom command for that macro -or None if there is no command matching that macro script name.\n -name : str\n Macro name. +or None if there is no command matching that macro script name. + +name : str + Macro name. diff --git a/src/Gui/DocumentPy.xml b/src/Gui/DocumentPy.xml index dfc0354719..129bb8697a 100644 --- a/src/Gui/DocumentPy.xml +++ b/src/Gui/DocumentPy.xml @@ -15,135 +15,183 @@ - show(objName) -> None\n -Show an object.\n -objName : str\n Name of the `Gui.ViewProvider` to show. + show(objName) -> None + +Show an object. + +objName : str + Name of the `Gui.ViewProvider` to show. - hide(objName) -> None\n -Hide an object.\n -objName : str\n Name of the `Gui.ViewProvider` to hide. + hide(objName) -> None + +Hide an object. + +objName : str + Name of the `Gui.ViewProvider` to hide. - setPos(objName, matrix) -> None\n -Set the position of an object.\n -objName : str\n Name of the `Gui.ViewProvider`.\n -matrix : Base.Matrix\n Transformation to apply on the object. + setPos(objName, matrix) -> None + +Set the position of an object. + +objName : str + Name of the `Gui.ViewProvider`. + +matrix : Base.Matrix + Transformation to apply on the object. - setEdit(obj, mod=0, subName) -> bool\n -Set an object in edit mode.\n -obj : str, App.DocumentObject, Gui.ViewPrivider\n Object to set in edit mode. -mod : int\n Edit mode. -subName : str\n Subelement name. Optional. + setEdit(obj, mod=0, subName) -> bool + +Set an object in edit mode. + +obj : str, App.DocumentObject, Gui.ViewPrivider + Object to set in edit mode. +mod : int + Edit mode. +subName : str + Subelement name. Optional. - getInEdit() -> Gui.ViewProviderDocumentObject or None\n + getInEdit() -> Gui.ViewProviderDocumentObject or None + Returns the current object in edit mode or None if there is no such object. - resetEdit() -> None\n + resetEdit() -> None + End the current editing. - addAnnotation(annoName, fileName, modName) -> None\n -Add an Inventor object from a file.\n -annoName : str\n Annotation name. -fileName : str\n File name. -modName : str\n Display mode name. Optional. + addAnnotation(annoName, fileName, modName) -> None + +Add an Inventor object from a file. + +annoName : str + Annotation name. +fileName : str + File name. +modName : str + Display mode name. Optional. - update() -> None\n + update() -> None + Update the view representations of all objects. - getObject(objName) -> object or None\n -Return the object with the given name. If no one exists, return None.\n -ObjName : str\n Object name. + getObject(objName) -> object or None + +Return the object with the given name. If no one exists, return None. + +ObjName : str + Object name. - activeObject() -> object or None\n + activeObject() -> object or None + The active object of the document. Deprecated, use ActiveObject. - activeView() -> object or None\n + activeView() -> object or None + The active view of the document. Deprecated, use ActiveView. - mdiViewsOfType(type) -> list of MDIView\n -Return a list of mdi views of a given type.\n -type : str\n Type name. + mdiViewsOfType(type) -> list of MDIView + +Return a list of mdi views of a given type. + +type : str + Type name. - save() -> bool\n + save() -> bool + Attempts to save the document - saveAs() -> bool\n + saveAs() -> bool + Attempts to save the document under a new name - sendMsgToViews(msg) -> None\n -Send a message to all views of the document.\n + sendMsgToViews(msg) -> None + +Send a message to all views of the document. + msg : str - mergeProject(fileName) -> None\n -Merges this document with another project file.\n -fileName : str\n File name. + mergeProject(fileName) -> None + +Merges this document with another project file. + +fileName : str + File name. - toggleTreeItem(obj, mod=0, subName) -> None\n -Change TreeItem of a document object.\n + toggleTreeItem(obj, mod=0, subName) -> None + +Change TreeItem of a document object. + obj : App.DocumentObject -mod : int\n Item mode. +mod : int + Item mode. 0: Toggle, 1: Collapse, 2: Expand, 3: Expand path. -subName : str\n Subelement name. Optional. +subName : str + Subelement name. Optional. - scrollToTreeItem(obj) -> None\n -Scroll the tree view to the item of a view object.\n + scrollToTreeItem(obj) -> None + +Scroll the tree view to the item of a view object. + obj : Gui.ViewProviderDocumentObject - toggleInSceneGraph(obj) -> None\n -Add or remove view object from scene graph of all views depending\non its canAddToSceneGraph().\n + toggleInSceneGraph(obj) -> None + +Add or remove view object from scene graph of all views depending +on its canAddToSceneGraph(). + obj : Gui.ViewProvider diff --git a/src/Gui/ViewProviderPy.xml b/src/Gui/ViewProviderPy.xml index 5d4046d368..591b845dcc 100644 --- a/src/Gui/ViewProviderPy.xml +++ b/src/Gui/ViewProviderPy.xml @@ -15,195 +15,268 @@ - addProperty(type, name, group, doc, attr=0, ro=False, hd=False) -> ViewProvider\n -Add a generic property.\n -type : str\n Property type. -name : str\n Property name. Optional. -group : str\n Property group. Optional. -attr : int\n Property attributes. -ro : bool\n Read only property. -hd : bool\n Hidden property. + addProperty(type, name, group, doc, attr=0, ro=False, hd=False) -> ViewProvider + +Add a generic property. + +type : str + Property type. +name : str + Property name. Optional. +group : str + Property group. Optional. +attr : int + Property attributes. +ro : bool + Read only property. +hd : bool + Hidden property. - removeProperty(name) -> bool\n + removeProperty(name) -> bool + Remove a generic property. -Only user-defined properties can be removed, not built-in ones.\n -name : str\n Property name. +Only user-defined properties can be removed, not built-in ones. + +name : str + Property name. - supportedProperties() -> list\n + supportedProperties() -> list + A list of supported property types. - show() -> None\n + show() -> None + Show the object. - show() -> None\n + show() -> None + Hide the object. - isVisible() -> bool\n + isVisible() -> bool + Check if the object is visible. - canDragObject(obj=None) -> bool\n + canDragObject(obj=None) -> bool + Check whether the child object can be removed by dragging. -If 'obj' is not given, check without filter by any particular object.\n -obj : App.DocumentObject\n Object to be dragged. +If 'obj' is not given, check without filter by any particular object. + +obj : App.DocumentObject + Object to be dragged. - dragObject(obj) -> None\n -Remove a child object by dropping.\n -obj : App.DocumentObject\n Object to be dragged. + dragObject(obj) -> None + +Remove a child object by dropping. + +obj : App.DocumentObject + Object to be dragged. - canDropObject(obj=None, owner=None, subname, elem=None) -> bool\n + canDropObject(obj=None, owner=None, subname, elem=None) -> bool + Check whether the child object can be added by dropping. -If 'obj' is not given, check without filter by any particular object.\n -obj : App.DocumentObject\n Object to be dropped. -owner : App.DocumentObject\n Parent object of the dropping object. -subname : str\n Subname reference to the dropping object. Optional. -elem : sequence of str\n Non-objects subelements selected when the object is +If 'obj' is not given, check without filter by any particular object. + +obj : App.DocumentObject + Object to be dropped. +owner : App.DocumentObject + Parent object of the dropping object. +subname : str + Subname reference to the dropping object. Optional. +elem : sequence of str + Non-objects subelements selected when the object is being dropped. - dropObject(obj, owner=None, subname, elem=None) -> str\n -Add a child object by dropping.\n -obj : App.DocumentObject\n Object to be dropped. -owner : App.DocumentObject\n Parent object of the dropping object. -subname : str\n Subname reference to the dropping object. Optional. -elem : sequence of str\n Non-objects subelements selected when the object is + dropObject(obj, owner=None, subname, elem=None) -> str + +Add a child object by dropping. + +obj : App.DocumentObject + Object to be dropped. +owner : App.DocumentObject + Parent object of the dropping object. +subname : str + Subname reference to the dropping object. Optional. +elem : sequence of str + Non-objects subelements selected when the object is being dropped. - canDragAndDropObject(obj) -> bool\n + canDragAndDropObject(obj) -> bool + Check whether the child object can be removed from -other parent and added here by drag and drop.\n -obj : App.DocumentObject\n Object to be dragged and dropped. +other parent and added here by drag and drop. + +obj : App.DocumentObject + Object to be dragged and dropped. - replaceObject(oldObj, newObj) -> int\n + replaceObject(oldObj, newObj) -> int + Replace a child object. -Returns 1 if succeeded, 0 if not found, -1 if not supported.\n -oldObj : App.DocumentObject\n Old object. -newObj : App.DocumentObject\n New object. +Returns 1 if succeeded, 0 if not found, -1 if not supported. + +oldObj : App.DocumentObject + Old object. +newObj : App.DocumentObject + New object. - doubleClicked() -> bool\n + doubleClicked() -> bool + Trigger double clicking the corresponding tree item of this view object. - addDisplayMode(obj, mode) -> None\n -Add a new display mode to the view provider.\n -obj : coin.SoNode\n Display mode. -mode : str\n Name of the display mode. + addDisplayMode(obj, mode) -> None + +Add a new display mode to the view provider. + +obj : coin.SoNode + Display mode. +mode : str + Name of the display mode. - listDisplayModes() -> list\n + listDisplayModes() -> list + Show a list of all display modes. - toString() -> str\n + toString() -> str + Return a string representation of the Inventor node. - setTransformation(trans) -> None\n -Set a transformation on the Inventor node.\n + setTransformation(trans) -> None + +Set a transformation on the Inventor node. + trans : Base.Placement, Base.Matrix - claimChildren() -> list\n + claimChildren() -> list + Returns list of objects that are to be grouped in tree under this object. - partialRender(sub=None, clear=False) -> int\n -Render only part of the object.\n -sub: None, str, sequence of str\n Refer to the subelement. If it is None then reset the partial rendering. -clear: bool\n True to add, or False to remove the subelement(s) for rendering. + partialRender(sub=None, clear=False) -> int + +Render only part of the object. + +sub: None, str, sequence of str + Refer to the subelement. If it is None then reset the partial rendering. +clear: bool + True to add, or False to remove the subelement(s) for rendering. - getElementColors(elementName) -> dict\n + getElementColors(elementName) -> dict + Get a dictionary of the form {elementName : (r,g,b,a)}. -If no element name is given a dictionary with all the elements is returned.\n -elementName : str\n Name of the element. Optional. +If no element name is given a dictionary with all the elements is returned. + +elementName : str + Name of the element. Optional. - setElementColors(colors) -> None\n -Set element colors.\n -colors: dict\n Color dictionary of the form {elementName:(r,g,b,a)}. + setElementColors(colors) -> None + +Set element colors. + +colors: dict + Color dictionary of the form {elementName:(r,g,b,a)}. - getElementPicked(pickPoint) -> str\n -Return the picked subelement.\n + getElementPicked(pickPoint) -> str + +Return the picked subelement. + pickPoint : coin.SoPickedPoint - getDetailPath(subelement, path, append=True) -> coin.SoDetail or None\n -Return Coin detail and path of an subelement.\n -subname: str\n Dot separated string reference to the sub element. -pPath: coin.SoPath\n Output coin path leading to the returned element detail. -append: bool\n If True, path will be first appended with the root node and the mode + getDetailPath(subelement, path, append=True) -> coin.SoDetail or None + +Return Coin detail and path of an subelement. + +subname: str + Dot separated string reference to the sub element. +pPath: coin.SoPath + Output coin path leading to the returned element detail. +append: bool + If True, path will be first appended with the root node and the mode switch node of this view provider. - signalChangeIcon() -> None\n + signalChangeIcon() -> None + Trigger icon changed signal. - getBoundingBox(subName, transform=True, view) -> Base.BoundBox\n -Obtain the bounding box of this view object.\n -subName : str\n Name referring a sub-object. Optional. -transform: bool\n Whether to apply the transformation matrix of this view provider. -view: View3DInventorPy\n Default to active view. Optional. + getBoundingBox(subName, transform=True, view) -> Base.BoundBox + +Obtain the bounding box of this view object. + +subName : str + Name referring a sub-object. Optional. +transform: bool + Whether to apply the transformation matrix of this view provider. +view: View3DInventorPy + Default to active view. Optional. diff --git a/src/Mod/Fem/App/FemMeshPy.xml b/src/Mod/Fem/App/FemMeshPy.xml index 293d7a5af3..f45ffacc3a 100755 --- a/src/Mod/Fem/App/FemMeshPy.xml +++ b/src/Mod/Fem/App/FemMeshPy.xml @@ -168,7 +168,7 @@ Add a group to mesh with specific name and type addGroup(name, typestring, [id]) name: string - typestring: \"All\", \"Node\", \"Edge\", \"Face\", \"Volume\", \"0DElement\", \"Ball\" + typestring: "All", "Node", "Edge", "Face", "Volume", "0DElement", "Ball" id: int Optional id is used to force specific id for group, but does not work, yet. diff --git a/src/Mod/Mesh/App/MeshFeaturePy.xml b/src/Mod/Mesh/App/MeshFeaturePy.xml index 9af0eb0088..c90a1855d4 100644 --- a/src/Mod/Mesh/App/MeshFeaturePy.xml +++ b/src/Mod/Mesh/App/MeshFeaturePy.xml @@ -14,7 +14,7 @@ The Mesh::Feature class handles meshes. The Mesh.MeshFeature() function is for internal use only and cannot be used to create instances of this class. Therefore you must have a reference to a document, e.g. 'd' then you can create an instance with -d.addObject(\"Mesh::Feature\"). +d.addObject("Mesh::Feature"). diff --git a/src/Mod/Mesh/App/MeshPy.xml b/src/Mod/Mesh/App/MeshPy.xml index e4c5408191..1c955f5079 100644 --- a/src/Mod/Mesh/App/MeshPy.xml +++ b/src/Mod/Mesh/App/MeshPy.xml @@ -23,7 +23,7 @@ Example: m = Mesh.Mesh() ... # Manipulate the mesh d = FreeCAD.activeDocument() # Get a reference to the actie document - f = d.addObject(\"Mesh::Feature\", \"Mesh\") # Create a mesh feature + f = d.addObject("Mesh::Feature", "Mesh") # Create a mesh feature f.Mesh = m # Assign the mesh object to the internal property d.recompute() diff --git a/src/Mod/Part/App/GeometryCurvePy.xml b/src/Mod/Part/App/GeometryCurvePy.xml index f11cbf54cc..326b9b2913 100644 --- a/src/Mod/Part/App/GeometryCurvePy.xml +++ b/src/Mod/Part/App/GeometryCurvePy.xml @@ -136,13 +136,13 @@ of the nearest orthogonal projection of the point. Computes the projection of a point on the curve -projectPoint(Point=Vector,[Method=\"NearestPoint\"]) -projectPoint(Vector,\"NearestPoint\") -> Vector -projectPoint(Vector,\"LowerDistance\") -> float -projectPoint(Vector,\"LowerDistanceParameter\") -> float -projectPoint(Vector,\"Distance\") -> list of floats -projectPoint(Vector,\"Parameter\") -> list of floats -projectPoint(Vector,\"Point\") -> list of points +projectPoint(Point=Vector,[Method="NearestPoint"]) +projectPoint(Vector,"NearestPoint") -> Vector +projectPoint(Vector,"LowerDistance") -> float +projectPoint(Vector,"LowerDistanceParameter") -> float +projectPoint(Vector,"Distance") -> list of floats +projectPoint(Vector,"Parameter") -> list of floats +projectPoint(Vector,"Point") -> list of points diff --git a/src/Mod/Part/App/GeometrySurfacePy.xml b/src/Mod/Part/App/GeometrySurfacePy.xml index cb42b0d25b..dc24e7646b 100644 --- a/src/Mod/Part/App/GeometrySurfacePy.xml +++ b/src/Mod/Part/App/GeometrySurfacePy.xml @@ -60,13 +60,13 @@ Computes the normal of parameter (u,v) on this geometry Computes the projection of a point on the surface -projectPoint(Point=Vector,[Method=\"NearestPoint\"]) -projectPoint(Vector,\"NearestPoint\") -> Vector -projectPoint(Vector,\"LowerDistance\") -> float -projectPoint(Vector,\"LowerDistanceParameters\") -> tuple of floats (u,v) -projectPoint(Vector,\"Distance\") -> list of floats -projectPoint(Vector,\"Parameters\") -> list of tuples of floats -projectPoint(Vector,\"Point\") -> list of points +projectPoint(Point=Vector,[Method="NearestPoint"]) +projectPoint(Vector,"NearestPoint") -> Vector +projectPoint(Vector,"LowerDistance") -> float +projectPoint(Vector,"LowerDistanceParameters") -> tuple of floats (u,v) +projectPoint(Vector,"Distance") -> list of floats +projectPoint(Vector,"Parameters") -> list of tuples of floats +projectPoint(Vector,"Point") -> list of points diff --git a/src/Mod/Path/App/AreaPy.xml b/src/Mod/Path/App/AreaPy.xml index 372deb2162..b5378f4344 100644 --- a/src/Mod/Path/App/AreaPy.xml +++ b/src/Mod/Path/App/AreaPy.xml @@ -13,8 +13,10 @@ Delete="true"> - FreeCAD python wrapper of libarea\n -Path.Area(key=value ...)\n + 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. @@ -25,7 +27,8 @@ All arguments are optional. - setPlane(shape): Set the working plane.\n + 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, @@ -35,9 +38,13 @@ same algorithm - getShape(index=-1,rebuild=False): Return the resulting shape\n -\n* index (-1): the index of the section. -1 means all sections. No effect on planar shape.\n -\n* rebuild: clean the internal cache and rebuild + 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 diff --git a/src/Mod/Path/App/FeatureAreaPy.xml b/src/Mod/Path/App/FeatureAreaPy.xml index d827bcc43f..fda7b500d0 100644 --- a/src/Mod/Path/App/FeatureAreaPy.xml +++ b/src/Mod/Path/App/FeatureAreaPy.xml @@ -20,7 +20,8 @@ - setParams(key=value...): Convenient function to configure this feature.\n + setParams(key=value...): Convenient function to configure this feature. + Same usage as Path.Area.setParams(). This function stores the parameters in the properties. diff --git a/src/Mod/Path/PathSimulator/App/PathSimPy.xml b/src/Mod/Path/PathSimulator/App/PathSimPy.xml index 8d20b57ef1..f4ede18033 100644 --- a/src/Mod/Path/PathSimulator/App/PathSimPy.xml +++ b/src/Mod/Path/PathSimulator/App/PathSimPy.xml @@ -13,35 +13,46 @@ Delete="true"> - FreeCAD python wrapper of PathSimulator\n -PathSimulator.PathSim():\n -Create a path simulator object\n + FreeCAD python wrapper of PathSimulator + +PathSimulator.PathSim(): + +Create a path simulator object + - BeginSimulation(stock, resolution):\n -Start a simulation process on a box shape stock with given resolution\n + BeginSimulation(stock, resolution): + +Start a simulation process on a box shape stock with given resolution + - SetToolShape(shape):\n -Set the shape of the tool to be used for simulation\n + SetToolShape(shape): + +Set the shape of the tool to be used for simulation + - GetResultMesh():\n - Return the current mesh result of the simulation.\n + GetResultMesh(): + + Return the current mesh result of the simulation. + - ApplyCommand(placement, command):\n - Apply a single path command on the stock starting from placement.\n + ApplyCommand(placement, command): + + Apply a single path command on the stock starting from placement. + diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index c328bfb971..d0ea2bc766 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -17,6 +17,13 @@ class TemplateClassPyExport(template.ModelTemplate): path = self.path exportName = self.export.Name dirname = self.dirname + def escapeString(s, indent=4): + """Escapes a string for use as literal in C++ code""" + s = s.strip() # This allows UserDocu-tags on their own lines without adding whitespace + s = s.replace('\\', '\\\\') + s = s.replace('"', '\\"') + s = s.replace('\n', f'\\n"\n{" "*indent}"') + return s print("TemplateClassPyExport", path + exportName) # Imp.cpp must not exist, neither in path nor in dirname if not os.path.exists(path + exportName + "Imp.cpp"): @@ -316,7 +323,7 @@ PyTypeObject @self.export.Name@::Type = { nullptr, /* tp_as_buffer */ /* --- Flags to define presence of optional/expanded features */ Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, /*tp_flags */ - "@self.export.Documentation.UserDocu.replace('\\n','\\\\n\\"\\n \\"')@", /*tp_doc */ + "@escapeString(self.export.Documentation.UserDocu, indent=4)@", /*tp_doc */ nullptr, /*tp_traverse */ nullptr, /*tp_clear */ + if (self.export.RichCompare): @@ -390,7 +397,7 @@ PyMethodDef @self.export.Name@::Methods[] = { reinterpret_cast( staticCallback_@i.Name@ ), METH_VARARGS, - - "@i.Documentation.UserDocu.replace('\\n','\\\\n')@" + "@escapeString(i.Documentation.UserDocu, indent=8)@" }, - {nullptr, nullptr, 0, nullptr} /* Sentinel */ @@ -510,7 +517,7 @@ PyGetSetDef @self.export.Name@::GetterSetter[] = { {"@i.Name@", (getter) staticCallback_get@i.Name@, (setter) staticCallback_set@i.Name@, - "@i.Documentation.UserDocu.replace('\\n','\\\\n')@", + "@escapeString(i.Documentation.UserDocu, indent=8)@", nullptr }, -