Pyiges Usage¶
There are two ways the pyiges
module can open iges files. First,
use the read
function:
-
pyiges.
read
(filename)¶ Read an iges file.
- Parameters
filename (str) – Filename of an IGES file.
Examples
>>> import pyiges >>> from pyiges import examples >>> iges = pyiges.read(examples.impeller) pyiges.Iges object Description: Number of Entities: 4615
Alternatively, you can create an object directly from the Iges
class:
>>> import pyiges
>>> iges = pyiges.Iges('my_file.iges')
pyiges.Iges object
Description:
Number of Entities: 4615
-
class
pyiges.
Iges
(filename)¶ pyiges.Iges object
- Parameters
filename (str) – Filename of an IGES file.
Examples
>>> import pyiges >>> from pyiges import examples >>> iges = pyiges.read(examples.impeller) pyiges.Iges object Description: Number of Entities: 4615
-
bspline_surfaces
(as_vtk=False, merge=False, **kwargs)¶ All bsplines
Examples
Convert and plot all bspline surfaces. This takes a while since the geometry tessellation is done in pure python by
geomdl
. Reduce the conversion time by setting delta to a larger than default value (0.025)>>> mesh = iges.bspline_surfaces(as_vtk=True, merge=True) >>> mesh.plot()
Alternatively, just extract the B-REP surfaces and extract their parameters
>>> bsurf = iges.bspline_surfaces() >>> bsurf[0] Rational B-Spline Surface Upper index of first sum: 3 Upper index of second sum: 3 Degree of first basis functions: 3 Degree of second basis functions: 3 Open in the first direction Open in the second direction Polynomial Periodic in the first direction Periodic in the second direction Knot 1: [0. 0. 0. 0. 1. 1. 1. 1.] Knot 2: [0. 0. 0. 0. 1. 1. 1. 1.] u0: 1.000000 u1: 0.000000 v0: 1.000000 v1: 128.000000 Control Points: 16
-
bsplines
(as_vtk=False, merge=False, **kwargs)¶ All bsplines
-
circular_arcs
(to_vtk=False, merge=False, **kwargs)¶ All circular_arcs
-
edge_lists
(as_vtk=False, merge=False, **kwargs)¶ All Edge Lists
-
entities
()¶ Return a list of all entities
Examples
>>> iges.entities [<pyiges.geometry.Point at 0x7f7056069c10>, <pyiges.geometry.Point at 0x7f7056069790>, <pyiges.geometry.Point at 0x7f7056069a50>, <pyiges.geometry.Point at 0x7f7056069b10>, <pyiges.entity.Entity at 0x7f7056069910>]
-
from_pointer
(ptr)¶ Return an iges object according to an iges pointer
-
lines
(as_vtk=False, merge=False, **kwargs)¶ All lines
-
points
(as_vtk=False, merge=False, **kwargs)¶ Return all points
-
to_vtk
(lines=True, bsplines=True, surfaces=True, points=True, delta=0.025, merge=True)¶ Converts entities to a vtk object
- Parameters
lines (bool, optional) – Convert lines.
surfaces (bool, optional) – Convert B-Spline surfaces.
points (bool, optional) – Convert points.
delta (float, optional) – Resolution when converting spline entities. Higher resolution creates a better plot at the cost of computing time.
merge (bool, optional) – Merge all converted entites into one output.
- Returns
surf – Geometry represented as
pyvista.PolyData
if merged or aMultiBlock
if unmerged.- Return type
pyvista.PolyData or pyvista.MultiBlock
Examples
Convert all entities except for surfaces to vtk
>>> lines = iges.to_vtk(surfaces=False) >>> print(lines) PolyData (0x7f700c79f3d0) N Cells: 2440 N Points: 96218 X Bounds: -4.299e+01, 6.912e+14 Y Bounds: -4.255e+01, 6.290e+14 Z Bounds: -9.980e+02, 6.702e+14 N Arrays: 0
-
vertex_lists
(as_vtk=False, merge=False, **kwargs)¶ All Point Lists