draftgeoutils.geometry Namespace Reference

Functions

def calculatePlacement (shape)
 
def findDistance (point, edge, strict=False)
 
def findPerpendicular (point, edgeslist, force=None)
 
def getNormal (shape)
 
def getRotation (v1, v2=App.Vector(0, 0, 1))
 
def getSplineNormal (edge)
 
def isPlanar (shape)
 
def mirror (point, edge)
 

Variables

 Part = lz.LazyLoader("Part", globals(), "Part")
 

Function Documentation

◆ calculatePlacement()

def draftgeoutils.geometry.calculatePlacement (   shape)
Return a placement located in the center of gravity of the shape.

If the given shape is planar, return a placement located at the center
of gravity of the shape, and oriented towards the shape's normal.
Otherwise, it returns a null placement.

References draftgeoutils.geometry.getNormal(), draftgeoutils.geometry.getRotation(), and draftgeoutils.geometry.isPlanar().

◆ findDistance()

def draftgeoutils.geometry.findDistance (   point,
  edge,
  strict = False 
)
Return a vector from the point to its closest point on the edge.

If `strict` is `True`, the vector will be returned
only if its endpoint lies on the `edge`.
Edge can also be a list of 2 points.

References DraftVecUtils.angle(), and DraftVecUtils.project().

Referenced by draftgeoutils.geometry.findPerpendicular(), and draftgeoutils.geometry.mirror().

◆ findPerpendicular()

def draftgeoutils.geometry.findPerpendicular (   point,
  edgeslist,
  force = None 
)
Find the perpendicular distance between a point and a list of edges.

If force is specified, only the edge[force] will be considered,
and it will be considered infinite.

Returns
-------
[vector_from_point_to_closest_edge, edge_index]
    The vector and the index in the list.

None
    If no perpendicular vector could be found.

References draftgeoutils.geometry.findDistance().

◆ getNormal()

def draftgeoutils.geometry.getNormal (   shape)
Find the normal of a shape or list of points, if possible.

References draftgeoutils.geometry.getSplineNormal().

Referenced by draftgeoutils.geometry.calculatePlacement(), and draftgeoutils.geometry.isPlanar().

◆ getRotation()

def draftgeoutils.geometry.getRotation (   v1,
  v2 = App.Vector(0, 0, 1) 
)
Get the rotation Quaternion between 2 vectors.

References DraftVecUtils.angle().

Referenced by draftgeoutils.geometry.calculatePlacement().

◆ getSplineNormal()

def draftgeoutils.geometry.getSplineNormal (   edge)
Find the normal of a BSpline edge.

Referenced by draftgeoutils.geometry.getNormal().

◆ isPlanar()

def draftgeoutils.geometry.isPlanar (   shape)
Return True if the given shape or list of points is planar.

References draftgeoutils.geometry.getNormal(), DraftVecUtils.isNull(), and DraftVecUtils.project().

Referenced by draftgeoutils.geometry.calculatePlacement().

◆ mirror()

def draftgeoutils.geometry.mirror (   point,
  edge 
)
Find mirror point relative to an edge.

References draftgeoutils.geometry.findDistance().

Variable Documentation

◆ Part

draftgeoutils.geometry.Part = lz.LazyLoader("Part", globals(), "Part")