TopoShape API: Difference between revisions
mNo edit summary |
(Marked this version for translation) |
||
(13 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
|||
<translate> |
|||
<!--T:11--> |
|||
{{VeryImportantMessage|(November 2018) This information may be incomplete and outdated. For the latest API, see the [https://www.freecadweb.org/api autogenerated API documentation].}} |
|||
<!--T:6--> |
|||
The TopoShape is the mother object of the Part Module. All shape types (wire, face, solid, etc...) of the Part module are TopoShapes, and share the following attributes and methods. Example: |
The TopoShape is the mother object of the Part Module. All shape types (wire, face, solid, etc...) of the Part module are TopoShapes, and share the following attributes and methods. Example: |
||
</translate> |
|||
{{Code|code= |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}} |
|||
<translate> |
|||
<!--T:7--> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{{APIProperty|Area|The total area of the faces of the shape.}} |
{{APIProperty|Area|The total area of the faces of the shape.}} |
||
⚫ | |||
⚫ | |||
{{APIProperty|CompSolids|Lists the subsequent shapes in this shape.}} |
{{APIProperty|CompSolids|Lists the subsequent shapes in this shape.}} |
||
{{APIProperty|Compounds|Lists the coumpounds in this shape.}} |
{{APIProperty|Compounds|Lists the coumpounds in this shape.}} |
||
Line 13: | Line 25: | ||
{{APIProperty|Faces|Lists the faces in this shape.}} |
{{APIProperty|Faces|Lists the faces in this shape.}} |
||
{{APIProperty|Length|Total length of the edges of the shape.}} |
{{APIProperty|Length|Total length of the edges of the shape.}} |
||
⚫ | |||
{{APIProperty|Orientation|the orientation of the shape.}} |
{{APIProperty|Orientation|the orientation of the shape.}} |
||
⚫ | |||
{{APIProperty|ShapeType|The type of the shape.}} |
{{APIProperty|ShapeType|The type of the shape.}} |
||
{{APIProperty|Shells|Lists the subsequent shapes in this shape.}} |
{{APIProperty|Shells|Lists the subsequent shapes in this shape.}} |
||
Line 20: | Line 34: | ||
{{APIProperty|Volume|Total volume of the solids of the shape.}} |
{{APIProperty|Volume|Total volume of the solids of the shape.}} |
||
{{APIProperty|Wires|List of wires in this shape.}} |
{{APIProperty|Wires|List of wires in this shape.}} |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{{APIFunction|isDerivedFrom|string|Returns true if given type is a father|boolean}} |
|||
{{APIFunction|approximate| |Approximates a B-Spline-curve from this wire|a BSplineCurve object}} |
{{APIFunction|approximate| |Approximates a B-Spline-curve from this wire|a BSplineCurve object}} |
||
⚫ | |||
⚫ | |||
⚫ | |||
{{APIFunction|check| |Checks the shape and report errors in the shape structure. This is a more detailed check as done in isValid().| }} |
{{APIFunction|check| |Checks the shape and report errors in the shape structure. This is a more detailed check as done in isValid().| }} |
||
{{APIFunction|common|TopoShape|Intersection of this and a given topo shape.|a TopoShape}} |
{{APIFunction|common|TopoShape|Intersection of this and a given topo shape.|a TopoShape}} |
||
Line 34: | Line 40: | ||
{{APIFunction|copy| |Creates a copy of this shape|a TopoShape}} |
{{APIFunction|copy| |Creates a copy of this shape|a TopoShape}} |
||
{{APIFunction|cut|TopoShape|Difference of this and a given topo shape.|a TopoShape}} |
{{APIFunction|cut|TopoShape|Difference of this and a given topo shape.|a TopoShape}} |
||
{{APIFunction|distToShape| TopoShape |Calculates the minimum distance between this and a given TopoShape.|float<minimum distance>,list<nearest points>,list<nearest subshapes & parameters> }} |
|||
{{APIFunction|exportBrep| string |Exports the content of this shape to an BREP file. BREP is a CasCade native format.| }} |
{{APIFunction|exportBrep| string |Exports the content of this shape to an BREP file. BREP is a CasCade native format.| }} |
||
{{APIFunction|exportIges| string |Exports the content of this shape to an IGES file.| }} |
{{APIFunction|exportIges| string |Exports the content of this shape to an IGES file.| }} |
||
Line 40: | Line 47: | ||
{{APIFunction|extrude|Vector|Extrudes the shape along a direction.|a TopoShape}} |
{{APIFunction|extrude|Vector|Extrudes the shape along a direction.|a TopoShape}} |
||
{{APIFunction|fuse|TopoShape|Union of this and a given topo shape.|a TopoShape}} |
{{APIFunction|fuse|TopoShape|Union of this and a given topo shape.|a TopoShape}} |
||
⚫ | |||
{{APIFunction|hashCode| |This value is computed from the value of the underlying shape reference and the location. Orientation is not taken into account.|a string}} |
{{APIFunction|hashCode| |This value is computed from the value of the underlying shape reference and the location. Orientation is not taken into account.|a string}} |
||
{{APIFunction|isClosed| |Checks if the shape is closed.|a boolean}} |
{{APIFunction|isClosed| |Checks if the shape is closed.|a boolean}} |
||
{{APIFunction| |
{{APIFunction|isDerivedFrom|string|Returns true if given type is a father|boolean}} |
||
{{APIFunction|isEqual|TopoShape|Returns true if both shapes share the same TShape, have the same Location and have the same Orientation.|a boolean}} |
|||
{{APIFunction|isInside|Vector,float,Boolean|Checks if a point is inside a solid with a certain tolerance. If the 3rd parameter is True a point on a face is considered as inside|a boolean}} |
{{APIFunction|isInside|Vector,float,Boolean|Checks if a point is inside a solid with a certain tolerance. If the 3rd parameter is True a point on a face is considered as inside|a boolean}} |
||
{{APIFunction|isNull| |Checks if the shape is null.|a boolean}} |
{{APIFunction|isNull| |Checks if the shape is null.|a boolean}} |
||
{{APIFunction| |
{{APIFunction|isPartner|TopoShape|Returns true if both shapes share the same TShape, but may have a different Location and may have a different Orientation.|a boolean}} |
||
{{APIFunction|isSame|TopoShape|Checks if both shapes share the same geometry, true if both shapes share the same TShape, have the same Location but may have a different Orientation.|a boolean}} |
|||
{{APIFunction|isValid| |Checks if the shape is valid, i.e. neither null, nor empty nor corrupted.|a boolean}} |
{{APIFunction|isValid| |Checks if the shape is valid, i.e. neither null, nor empty nor corrupted.|a boolean}} |
||
{{APIFunction|makeFillet| |
{{APIFunction|makeFillet|float,TopoShape|Returns a new object based on TopoShape, but with a fillet of radius 'float' applied to each edge.|a TopoShape}} |
||
⚫ | |||
⚫ | |||
{{APIFunction|makePipe|wire|Makes a pipe by sweeping along a wire.|a TopoShape}} |
{{APIFunction|makePipe|wire|Makes a pipe by sweeping along a wire.|a TopoShape}} |
||
{{APIFunction|makePipeShell|wire|Makes a loft defined by profiles along a wire.|a TopoShape}} |
{{APIFunction|makePipeShell|wire|Makes a loft defined by profiles along a wire.|a TopoShape}} |
||
Line 57: | Line 69: | ||
{{APIFunction|reverse| |Reverses the orientation of this shape.| }} |
{{APIFunction|reverse| |Reverses the orientation of this shape.| }} |
||
{{APIFunction|revolve|Vector, Vector, float|Revolves the shape around a Axis to a given degree. ex: Part.revolve(Vector(0,0,0),Vector(0,0,1),360) revolves the shape around the Z Axis 360 degree.|a TopoShape}} |
{{APIFunction|revolve|Vector, Vector, float|Revolves the shape around a Axis to a given degree. ex: Part.revolve(Vector(0,0,0),Vector(0,0,1),360) revolves the shape around the Z Axis 360 degree.|a TopoShape}} |
||
{{APIFunction|rotate|Vector, Vector, float| |
{{APIFunction|rotate|Vector<position>, Vector<direction>, float<angle>|Rotates this shape by angle degrees around an axis specified by position and direction. ex: Shp.rotate(Vector(0,0,0),Vector(0,0,1),180) rotate the shape around the Z Axis 180 degrees.| }} |
||
{{APIFunction|scale| | |
{{APIFunction|scale|float<factor>, [Vector<centre>]|Uniformly scales this shape by factor. Optionally specify centre of scaling transformation.| }} |
||
{{APIFunction|section|TopoShape|Section of this with a given topo shape.|a TopoShape}} |
{{APIFunction|section|TopoShape|Section of this with a given topo shape.|a TopoShape}} |
||
{{APIFunction|sewShape| |Sews the shape if there is a gap.| }} |
{{APIFunction|sewShape| |Sews the shape if there is a gap.| }} |
||
Line 68: | Line 80: | ||
{{APIFunction|writeInventor| |Writes the mesh in OpenInventor format to a string.|a string}} |
{{APIFunction|writeInventor| |Writes the mesh in OpenInventor format to a string.|a string}} |
||
<!--T:8--> |
|||
{{languages | {{es|TopoShape_API/es}} {{fr|TopoShape_API/fr}} }} |
|||
Some attributes and methods apply only to certain TopoShapes. These items apply to Edges (TopoShapeEdge). |
|||
<!--T:9--> |
|||
{{APIProperty|FirstParameter|The parameter value at one end of the Edge. Not necessarily at Vertex[0]. [http://en.wikipedia.org/wiki/Parametric_equations See Parametric Equations]}} |
|||
{{APIProperty|LastParameter|The parameter value at the other end of the Edge. Not necessarily at Vertex[1].}} |
|||
{{APIFunction|getParameterByLength|Float|Maps the interval [0,Length] to the interval [FirstParameter,LastParameter]|Float }} |
|||
{{APIFunction|valueAt|Float|Returns the 3D vector corresponding to a parameter value.|Vector}} |
|||
{{APIFunction|parameterAt|Vertex,[Face]|Returns the parameter value corresponding to a Vertex (3D point).|Float}} |
|||
{{APIFunction|tangentAt|Float|Returns the direction vector of the tangent to the edge at a parameter value (if it exists).|Vector}} |
|||
{{APIFunction|normalAt|Float|Returns the direction vector of the normal to the edge at a parameter value (if it exists uniquely).|Vector}} |
|||
{{APIFunction|curvatureAt|Float|Returns the curvature of the edge at a parameter value.|Float}} |
|||
{{APIFunction|centerOfCurvatureAt|Float|Returns the center (3D point) of the osculating circle at a parameter value.|Vector}} |
|||
<!--T:10--> |
|||
[[Category:API]] |
[[Category:API]] |
||
</translate> |
|||
{{clear}} |
Revision as of 10:26, 27 February 2019
The TopoShape is the mother object of the Part Module. All shape types (wire, face, solid, etc...) of the Part module are TopoShapes, and share the following attributes and methods. Example:
import Part
sh = Part.makeBox(10,10,10)
print sh.Faces
for f in sh.Faces:
print f.Edges
Returns: The center of mass of the current system. If the gravitational field is uniform, it is the center of gravity. The coordinates returned for the center of mass are expressed in the absolute Cartesian coordinate system.
Description: Approximates a B-Spline-curve from this wire
Returns: a BSplineCurve object
Description: Checks the shape and report errors in the shape structure. This is a more detailed check as done in isValid().
Returns:
Description: Computes the complement of the orientation of this shape, i.e. reverses the interior/exterior status of boundaries of this shape.
Returns: a TopoShape
Description: Calculates the minimum distance between this and a given TopoShape.
Returns: float<minimum distance>,list<nearest points>,list<nearest subshapes & parameters>
Description: Exports the content of this shape to an BREP file. BREP is a CasCade native format.
Returns:
Description: This value is computed from the value of the underlying shape reference and the location. Orientation is not taken into account.
Returns: a string
Description: Returns true if both shapes share the same TShape, have the same Location and have the same Orientation.
Returns: a boolean
Description: Checks if a point is inside a solid with a certain tolerance. If the 3rd parameter is True a point on a face is considered as inside
Returns: a boolean
Description: Returns true if both shapes share the same TShape, but may have a different Location and may have a different Orientation.
Returns: a boolean
Description: Checks if both shapes share the same geometry, true if both shapes share the same TShape, have the same Location but may have a different Orientation.
Returns: a boolean
Description: Checks if the shape is valid, i.e. neither null, nor empty nor corrupted.
Returns: a boolean
Description: Returns a new object based on TopoShape, but with a fillet of radius 'float' applied to each edge.
Returns: a TopoShape
Description: Makes this and the given wire homogenous to have the same number of edges
Returns: a wire
Description: Makes a loft defined by profiles along a wire.
Returns: a TopoShape
Description: Makes a compound shape out of mesh data. Note: This should be used for rather small meshes only.
Returns: a TopoShape
Description: A hollowed solid is built from an initial solid and a set of faces on this solid, which are to be removed. The remaining faces of the solid become the walls of the hollowed solid, their thickness defined at the time of construction. The arguments to be passed are a list of faces to be skipped, the thickness of the walls and a tolerance value.
Returns: a TopoShape
Description: Destroys the reference to the underlying shape stored in this shape. As a result, this shape becomes null.
Returns:
Description: Revolves the shape around a Axis to a given degree. ex: Part.revolve(Vector(0,0,0),Vector(0,0,1),360) revolves the shape around the Z Axis 360 degree.
Returns: a TopoShape
Description: Rotates this shape by angle degrees around an axis specified by position and direction. ex: Shp.rotate(Vector(0,0,0),Vector(0,0,1),180) rotate the shape around the Z Axis 180 degrees.
Returns:
Description: Uniformly scales this shape by factor. Optionally specify centre of scaling transformation.
Returns:
Description: Tessellate the the shape and return a list of vertices and face indices. The given float is the tolerance.
Returns: a list
Description: Conversion of the complete geometry of a shape into NURBS geometry. For example, all curves supporting edges of the basis shape are converted into BSpline curves, and all surfaces supporting its faces are converted into BSpline surfaces.
Returns: a NURBS curve
Description: Applies geometric transformation on a copy of the shape. The transformation to be applied is defined as a 4x4 matrix. The underlying geometry of the following shapes may change to a curve which supports an edge of the shape, or a surface which supports a face of the shape. For example, a circle may be transformed into an ellipse when applying an affinity transformation. It may also happen that the circle then is represented as a b-spline curve. The transformation is applied to all the curves which support edges of the shape, and all the surfaces which support faces of the shape. Note: If you want to transform a shape without changing the underlying geometry then use the methods translate or rotate.
Returns: a TopoShape
Description: Applies transformation on a shape without changing the underlying geometry.
Returns:
Description: Applies the translation to the current location of this shape.
Returns:
Some attributes and methods apply only to certain TopoShapes. These items apply to Edges (TopoShapeEdge).
Returns: The parameter value at one end of the Edge. Not necessarily at Vertex[0]. See Parametric Equations
Returns: The parameter value at the other end of the Edge. Not necessarily at Vertex[1].
Description: Maps the interval [0,Length] to the interval [FirstParameter,LastParameter]
Returns: Float
Description: Returns the 3D vector corresponding to a parameter value.
Returns: Vector
Description: Returns the parameter value corresponding to a Vertex (3D point).
Returns: Float
Description: Returns the direction vector of the tangent to the edge at a parameter value (if it exists).
Returns: Vector
Description: Returns the direction vector of the normal to the edge at a parameter value (if it exists uniquely).
Returns: Vector
Description: Returns the curvature of the edge at a parameter value.
Returns: Float