Definition of virtual base object
Return bounding box
Parameters: | tolerance – Tolerance of calculation. |
---|
Restore shape from string.
The format used is the OpenCASCADE internal BREP format.
Check if object has plane defined. Optional pass origin and normal argument to fetch the plane definition.
Parameters: |
|
---|
Shape hash code.
Orientation is not included in the hash calculation. Instances of the same object therfore return the same hash code.
Check object for equallity. Returns True only if both the underlying geometry and location is similar.
Check if object is Null.
Return if object is valid.
Mirror object
Parameters: |
|
---|
Rotate object.
Parameters: |
|
---|
Scale object.
Parameters: |
|
---|
Return class type or None if shape not known.
Seralize object to string.
The format used is the OpenCASCADE internal BREP format.
Apply transformation matrix to object.
Parameters: |
|
---|
Translate object.
Parameters: |
|
---|
Edge()
Edge - represent a single curve.
Return bounding box
Create copy of edge
Parameters: | deepCopy – If true a full copy of the underlying geometry is done. Defaults to False. |
---|
Set self from copy of edge
Parameters: |
|
---|
Create arc from given start, end and center points.
example:
e1 = Edge().createArc(start = (-.5,0.,0.), end = (.5,1.,0.), center = (.5,0.,0.))
Create arc from start to end and fitting through given point.
example:
e1 = Edge().createArc3P(start = (1.,0.,0.), end = (-1.,0.,0.), pnt = (0.,1.,0.))
Create bezier curve. Optional start and end Vertex object can be given otherwise start and end are extracted from the points sequence.
example:
pnts = ((0.,0.,0.), (0.,1.,0.), (1.,.5,0.), (1.,0.,0.))
e1 = Edge().createBezier(points = pnts)
Create circle from center, normal direction and radius.
example:
e1 = Edge().createCircle(center = (0.,.0,0.), normal = (0.,0.,1.), radius = 1.)
Create ellipse from center, normal direction and given major and minor axis.
example:
e1 = Edge().createEllipse(center=(0.,0.,0.),normal=(0.,0.,1.), rMajor = .5, rMinor=.2)
Create helix curve.
example:
e1 = Edge().createHelix(pitch = .5, height = 1., radius = .25, angle = pi/5.)
Create straight line from given start and end points
example:
e1 = Edge().createLine(start = (0.,0.,0.), end = (1.,1.,0.))
Create NURBS curve.
Parameters: |
|
---|
If start and end Vertex objects are not given the start and end point is given by the points sequence.
Create interpolating spline.
Optional start and end Vertex object can be given otherwise start and end are extracted from the points sequence.
example:
pnts = ((0.,0.,0.), (0.,.5,0.), (1.,.25,0.),(1.,0.,0.))
e1 = Edge().createSpline(points = pnts)
Check if edge is closed
Check if edge is degenerated e.g. collapsed etc.
Check if edge is a seam on face
Return edge length
Return number of vertices
Tesselate edge to given max angle or distance factor
Wire(edges=None)
Wire - represent wire geometry (composite of edges).
Wires defines boundaries of faces.
Chamfer vertices inplace.
Parameters: |
|
---|
Create boolean intersection inplace. The wire must be planar and the operation must result in a single wire.
Multiple objects are supported.
Edges, wires and faces are extruded in the normal directions to intersect the wire.
Create copy of wire
Parameters: | deepCopy – If true a full copy of the underlying geometry is done. Defaults to False. |
---|
Set self from copy of wire
Parameters: |
|
---|
Create a polygon from given points.
Parameters: |
|
---|
example:
w1 = Wire().createPolygon((
(0.,0.,0.),
(0.,0.,1.),
(.75,0.,1.),
(.75,0.,0.)),
close = False
)
Create planar rectangle in the xy plan.
The rectangle is centered at 0,0 with given width, height and optional corner radius.
example:
w1 = Wire().createRectangle(width = 1., height = 0.75, radius = .25)
Create a planar regular polygon in the xy plane centered at (0,0).
The polygon can either be inscribed or circumscribe the circle by setting the mode argument.
Parameters: |
|
---|
example:
w1 = Wire().createRegularPolygon(radius = .5, sides = 6.)
Create wire by connecting edges or a single closed edge.
Create boolean difference inplace. The wire must be planar and the operation must result in a single wire.
Multiple objects are supported.
Edges, wires and faces are extruded in the normal directions to intersect the wire.
Fillet vertices inplace.
Parameters: |
|
---|
Check if wire is closed
Return wire length
Return number of edges
Return number of vertices
Offset wire inplace the given distance.
Project wire towards face.
Tesselate wire to given max angle or distance factor
Face(arg=None)
Face - Reprecent face geometry
The face geometry could be represented by several underlying faces (a OpenCASCADE shell) or a single face.
Return face area
Return center of face
Create boolean intersection inplace. The face must be planar and the operation must result in a single face.
Multiple objects are supported.
Edges, wires and faces are extruded in the normal directions to intersect the face.
Create copy of face
Parameters: | deepCopy – If true a full copy of the underlying geometry is done. Defaults to False. |
---|
Create general face constrained by edges and optional points.
Parameters: |
|
---|
example:
e1 = Edge().createCircle(center=(0.,0.,0.),normal=(0.,0.,1.),radius = .5)
f1 = Face().createConstrained(e1, ((0.,.0,.25),))
Create planar face from one or more wires or closed edges.
The first argument must be the outer contour. Additional arguments define holes in the face.
example:
w1 = Wire().createRectangle(width = 1., height = 1., radius = 0.)
e1 = Edge().createCircle(center=(0.,0.,0.),normal=(0.,0.,1.),radius = .25)
f1 = Face().createFace((w1, e1))
Create triangle mesh of face.
Parameters: |
|
---|
Create polygonal face from given points. The points must lie in a common plane.
example:
pnts = ((-.5,-.5,0.), (0.,.5,0.), (1.,.5,0.), (.5,-.5,0.))
f1 = Face().createPolygonal(pnts)
Create boolean difference inplace. The face must be planar and the operation must result in a single face.
Multiple objects are supported.
Edges, wires and faces are extruded in the normal directions to intersect the face.
Create extrusion face.
Parameters: |
|
---|
example:
e1 = Edge().createArc(start = (-.5,-.25,0.), end = (.5,.75,0.), center = (.5,-.25,0.))
f1 = Face().extrude(e1, (0.,0.,0.), (0.,0.,1.))
return intertia of face with respect to center of gravity.
Return Ixx, Iyy, Izz, Ixy, Ixz, Iyz
Create face by lofting through profiles.
Parameters: |
|
---|
example:
e1 = Edge().createArc((0.,0.,0.),(1.,0.,1.),(1.,0.,0.))
e2 = Edge().createArc((0.,1.,0.),(2.,1.,2.),(2.,1.,0.))
f1 = Face().loft((e1,e2))
Return number of faces
Return number of wires
Offseting face given distance.
Parameters: | offset – offset distance |
---|
Create by revolving shape.
Parameters: |
|
---|
example:
pnts = ((0.,0.,0.), (0.,1.,0.), (1.,.5,0.), (1.,0.,0.))
e1 = Edge().createBezier(points = pnts)
f1 = Face().revolve(e1, (0.,-1.,0.), (1.,-1.,0.), pi/2.)
Create face by sweeping along spine through sequence of shapes. Optionally the start and end can be a vertex.
Parameters: |
|
---|
example:
e1 = Edge().createArc((0.,0.,0.), (1.,0.,1.), (1.,0.,0.))
e2 = Edge().createCircle(center=(0.,0.,0.),normal=(0.,0.,1.),radius = .25)
f1 = Face().sweep(e1, e2)
Solid()
Geometry represention solid objects or compund solid.
Create compund solid from sequence of solid objects.
This is usefull for accelerating boolean operation where multiple objects are used as the tool.
Return solid area
return center of mass of solid.
Chamfer edges inplace.
Parameters: |
|
---|
Create boolean intersection inplace.
Multiple objects are supported.
Edges, wires and faces are extruded in the normal directions to intersect the solid.
Edges and wires allways cut through all, but faces are limited by the face itself.
Create copy of solid
Parameters: | deepCopy – If true a full copy of the underlying geometry is done. Defaults to False. |
---|
Set self from copy of solid
Parameters: |
|
---|
Create box from points defining diagonal.
example:
s1 = Solid().createBox((-.5,-.5,-.5),(.5,.5,.5))
Create cone
Parameters: |
|
---|
example:
s1 = Solid().createCone((0.,0.,0.),(0.,0.,1.), .2, .5)
Create cylinder
Parameters: |
|
---|
example:
s1 = Solid().createCylinder((0.,0.,0.),(0.,0.,1.), .25)
Create triangle mesh of solid.
Parameters: |
|
---|
Create prism from edge/wire/face in direction of normal.
This solid is infinite/semi-infinite and usefull for cutting and intersection operations with regular solids.
Create general solid by sewing together faces with the given tolerance.
Parameters: |
|
---|
Create sphere from center point and radius.
Parameters: |
|
---|
example:
s1 = Solid().createSphere((0.,0.,0.),.5)
Extrude TTF font data to solids
Height : | font height |
---|---|
Depth : | extrusion depth |
Text : | text content. Only single line of text (UTF-8) |
Fontpath : | path to TTF font file |
Create torus
Parameters: |
|
---|
example:
s1 = Solid().createTorus((0.,0.,0.),(0.,0.,.1), .5, .1)
Create boolean difference inplace.
Multiple objects are supported.
Edges, wires and faces are extruded in the normal directions to intersect the solid.
Edges and wires allways cut through all, but faces are limited by the face itself.
Create solid by extruding edge, wire or face from p1 to p2.
Parameters: |
|
---|
example:
e1 = Edge().createLine((-.5,0.,0.),(.5,0.,0.))
e2 = Edge().createArc3P((.5,0.,0.),(-.5,0.,0.),(0.,.5,0.))
w1 = Wire().createWire((e1,e2))
f1 = Face().createFace(w1)
s1 = Solid().extrude(f1, (0.,0.,0.), (0.,0.,1.))
Fillet edges inplace.
Parameters: |
|
---|
Create boolean union inplace.
Multiple solids are supported.
return intertia of solid with respect to center of gravity.
Return Ixx, Iyy, Izz, Ixy, Ixz, Iyz
Create solid by lofting through sequence of wires or closed edges.
Parameters: |
|
---|
example:
e1 = Edge().createCircle(center=(.25,0.,0.),normal=(0.,0.,1.),radius = .25)
e2 = Edge().createCircle(center=(.25,0.,.5),normal=(0.,0.,1.),radius = .5)
v1 = Vertex(.25,0.,1.)
s1 = Solid().loft((e1,e2,v1))
Return number of faces
Return number of solids
Create solid by offseting face given distance.
Parameters: |
|
---|
Create pipe by extruding face along path. The path can be a Edge or Wire. Note that the path must be C1 continious.
example:
e1 = Edge().createHelix(.4, 1., .4)
e2 = Edge().createCircle(center=(.5,0.,0.),normal=(0.,1.,0.),radius = 0.1)
f1 = Face().createFace(e2)
s1 = Solid().pipe(f1, e1)
Create solid by revolving face
Parameters: |
|
---|
example:
e1 = Edge().createEllipse(center=(0.,0.,0.),normal=(0.,0.,1.), rMajor = .5, rMinor=.2)
f1 = Face().createFace(e1)
s1 = Solid().revolve(f1, (1.,0.,0.), (1.,1.,0.), pi/2.)
Apply section operation between solid and plane.
Parameters: | plane – section plane |
---|
Result returned as a face.
Apply shell operation on solid.
Parameters: |
|
---|
Create solid by sweeping along spine through sequence of wires. Optionally the start and end can be a vertex.
Parameters: |
|
---|
example:
w1 = Wire().createPolygon((
(0.,0.,0.),
(0.,0.,1.),
(.75,0.,1.),
(.75,0.,0.)),
close = False
)
e1 = Edge().createCircle(center=(0.,0.,0.),normal=(0.,0.,1.),radius = .2)
s1 = Solid().sweep(w1, e1)
Return solid volume
Misc tools.
Read shapes from a BREP file.
A sequence of shapes are returned.
Read shapes from a STEP file.
A sequence of shapes are returned.
Write a sequence of shapes or a single shape to a BREP file.
Write a sequence of shapes or a single shape to a STEP file.
Write a sequence of shapes or a single shape to a STL file.
Write a sequence of shapes or a single shape to a VRML file.
Mesh()
Mesh - Represent triangle mesh for viewing purpose
Return number of edge indices
Return number of edge ranges
Return number of normals
Return normal at given vertex index
Return number of triangles
Return number of vertices
Vertex Cache Optimisation
Return triangle indices at given index
Return vertex at given index
edgeIndices: View.MemoryView.array
edgeIndicesItemSize: ‘int’
edgeRanges: View.MemoryView.array
edgeRangesItemSize: ‘int’
normals: View.MemoryView.array
normalsItemSize: ‘int’
triangles: View.MemoryView.array
trianglesItemSize: ‘int’
vertices: View.MemoryView.array
verticesItemSize: ‘int’
Tesselation()
Return number of range values
Return number of vertices
ranges: View.MemoryView.array
rangesItemSize: ‘int’
vertices: View.MemoryView.array
verticesItemSize: ‘int’
Add object
Remove all objects
Hide object
Redraw view
Remove object
Unhide object
Recalculate bounding box
Viewer
Objs : | Single object or sequence of objects. |
---|---|
Colors : | Color or sequence of colors. Defaults to COLORS. The object color is cycled from the seqence or set to single color. |
Interactive : | Install input hook for interactive use. Note that the returned reference to the viewer must be referenced to keep the viewer alive. |
Logger : | File to write error messages to. Defaults to stderr. |