Part: changes to Part Module

* Added Part::Feature::getTopoShape/getShape() function that can obtain
  shape from any object with proper implementation of getSubObject(). It
  can even construct compound from group object with proper implementation
  of getSubObjects().

* Modified ViewProviderExt to work on any object, because it now obtain
  the shape using Part::Feature::getShape()

* Modified various Part features to obtain base/tool shapes using
  Part::getShape(), which allows them to be any type of object,
  including Link and groups.

* Modified various Part command to relax type requirement on selected
  objects.

* Add support of link and group to dimension, and add dimension refresh
  command

* Support link and group in simple command command, and add a few more
  copy command variations.

* Add special handling of 'Shape' attribute in PropertyContainerPy and
  use Part::Feature::getShape() to return shape for any object without
  Shape property. This allows many python feature work with any object
  without modification.

* GeometrySurface/CurvePy, add convenience attribute 'Rotation'

* TopoShapePy:

    * Extended support of sub shape attribute, e.g. Compound1, Solid2,
      SubShape3 ('SubShape' is used to access child shape of a compound)

    * makeWires(), new API to sort and return wires given a list of edges.

    * transformed/translated/rotated/scaled(), return a new shape with
      some transformation.

    * findPlane(), find the plane of a planar shape

    * isCoplanar(), check if two shape are coplanar
This commit is contained in:
Zheng, Lei
2019-07-12 10:10:03 +08:00
committed by wmayer
parent ebd60c8595
commit f028ba42ff
58 changed files with 3250 additions and 727 deletions

View File

@@ -335,7 +335,19 @@ transformGeometry(Matrix) -> Shape
<Documentation>
<UserDocu>Apply transformation on a shape without changing
the underlying geometry.
transformShape(Matrix,[boolean copy=False]) -> None</UserDocu>
transformShape(Matrix,[boolean copy=False, checkScale=False]) -> None
If checkScale is True, it will use transformGeometry if non-uniform
scaling is detected.</UserDocu>
</Documentation>
</Methode>
<Methode Name="transformed" Const="true" Keyword="true">
<Documentation>
<UserDocu>
transformed(Matrix,copy=False,checkScale=False,op=None) -> shape
Create a new transformed shape
</UserDocu>
</Documentation>
</Methode>
<Methode Name="translate">
@@ -343,11 +355,29 @@ transformShape(Matrix,[boolean copy=False]) -> None</UserDocu>
<UserDocu>Apply the translation to the current location of this shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="translated">
<Documentation>
<UserDocu>
translated(vector) -> shape
Create a new shape with translation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="rotate">
<Documentation>
<UserDocu>
Apply the rotation (degree) to the current location of this shape
Shp.rotate(Vector(0,0,0),Vector(0,0,1),180) - rotate the shape around the Z Axis 180 degrees.
Apply the rotation (base,dir,degree) to the current location of this shape
Shp.rotate(Vector(0,0,0),Vector(0,0,1),180) - rotate the shape around the Z Axis 180 degrees.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="rotated">
<Documentation>
<UserDocu>
rotated(base,dir,degree) -> shape
Create a new shape with rotation.
</UserDocu>
</Documentation>
</Methode>
@@ -356,6 +386,15 @@ transformShape(Matrix,[boolean copy=False]) -> None</UserDocu>
<UserDocu>Apply scaling with point and factor to this shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="scaled">
<Documentation>
<UserDocu>
scaled(factor,base=Vector(0,0,0)) -> shape
Create a new shape with scale.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeFillet" Const="true">
<Documentation>
<UserDocu>Make fillet.</UserDocu>
@@ -428,6 +467,23 @@ Returns: result of offsetting (wire or face or compound of those). Compounding
structure follows that of source shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeWires">
<Documentation>
<UserDocu>
makeWires(op=None): make wire(s) using the edges of this shape
The function will sort any edges inside the current shape, and connect them
into wire. If more than one wire is found, then it will make a compound out of
all found wires.
This function is element mapping aware. If the input shape has non-zero Tag,
it will map any edge and vertex element name inside the input shape into the
itself.
op: an optional string to be appended when auto generates element mapping.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="reverse">
<Documentation>
<UserDocu>Reverses the orientation of this shape.</UserDocu>
@@ -486,6 +542,16 @@ If the shape is an edge it returns True if its vertices are the same.
<UserDocu>Checks if the shape is valid, i.e. neither null, nor empty nor corrupted.</UserDocu>
</Documentation>
</Methode>
<Methode Name="isCoplanar" Const="true">
<Documentation>
<UserDocu>isCoplanar(shape,tol=None) -- Checks if this shape is coplanar with the given shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="findPlane" Const="true">
<Documentation>
<UserDocu>findPlane(tol=None) -- return a plane if the shape is planar</UserDocu>
</Documentation>
</Methode>
<Methode Name="fix">
<Documentation>
<UserDocu>Tries to fix a broken shape. True is returned if the operation succeeded, False otherwise.
@@ -635,6 +701,11 @@ infos contains additional info on the solutions. It is a list of tuples:
<UserDocu>Returns a SubElement</UserDocu>
</Documentation>
</Methode>
<Methode Name="countElement" Const="true">
<Documentation>
<UserDocu>Returns the count of a type of element</UserDocu>
</Documentation>
</Methode>
<Methode Name="getTolerance" Const="true">
<Documentation>
<UserDocu>
@@ -796,6 +867,12 @@ infos contains additional info on the solutions. It is a list of tuples:
</Documentation>
<Parameter Name="Compounds" Type="List"/>
</Attribute>
<Attribute Name="SubShapes" ReadOnly="true">
<Documentation>
<UserDocu>List of sub-shapes in this shape.</UserDocu>
</Documentation>
<Parameter Name="SubShapes" Type="List"/>
</Attribute>
<Attribute Name="Length" ReadOnly="true">
<Documentation>
<UserDocu>Total length of the edges of the shape.</UserDocu>