80. gui.menus.Geometry
— Geometry Menu¶
The Geometry menu is the major interactive menu to handle all kinds of geometry in pyFormex. It includes import from and export to a vast choice of file formats. There are some simple interactive geometry creators.
80.1. Functions defined in module gui.menus.Geometry¶
- gui.menus.Geometry.importGeometry(path=None, ftype=None, compr=False, multi=False, target=None, select=True, draw=True)[source]¶
Import geometry from file(s).
Pops up a
FileDialog
to select one (or more) geometry file(s) to be imported.- Parameters:
path (path_like) – The initially selected file name in the dialog. If not provided, the dialog starts in the current directory with no selected path.
ftype (file_types) – One or more file type strings. The popup dialog will contain a filter for each of these file types. Only the files matching the selected filte will be shown and selectable in the FileDialog. If not provided, it is set to a list of all known geometry file types in pyFormex.
compr (bool) – If True, compressed files (with .gz or .bz2 suffices) of the file types in ftype will also be selectable.
target (class) – If a file type allows returning different Geometry classes, the prefered target can be set.
multi (bool) – If True, the FileDialog will allow to select multiple files and they will all be imported at once.
select (bool) – If True (default), the imported geometry becomes the current selection in the Geometry menu.
draw (bool) – If True (default) and
select
is also True, the selection is drawn after importing.
- gui.menus.Geometry.importModel(*filenames)[source]¶
Read one or more element meshes into pyFormex.
Models are composed of nodes and elems stored on a .mesh file. One or more filenames can be specified. If none is given, the user will be asaked.
- gui.menus.Geometry.readInp(fn=None)[source]¶
Read an Abaqus .inp file and convert to pyFormex .mesh.
- gui.menus.Geometry.exportGeometry(ftype, single=False, compr=True, clas=None, **kargs)[source]¶
Write geometry to file.
- Parameters:
ftype (str) – The output file format. This is the filename extension in lower case and without a leading dot.
single (bool) – If True, only a single object can be written to the file.
compr (bool) – If True, transparent compression is supported for the format.
clas (class | tuple of class) – Allowed Geometry types for this format.
- gui.menus.Geometry.setProp(prop=None)[source]¶
Set the property of the current selection.
prop should be a single integer value or None. If None is given, a value will be asked from the user. If a negative value is given, the property is removed. If a selected object does not have a setProp method, it is ignored.
- gui.menus.Geometry.delProp()[source]¶
Delete the property of the current selection.
Resets the prop attribute of all selected objects to None.
- gui.menus.Geometry.edit_attributes()[source]¶
Edit Attributes of the current selection.
Only 1 selected object
- gui.menus.Geometry.convert(method, suffix='')[source]¶
Transform the selected Geometry objects with the specified method.
- Parameters:
method (func) – The function name of a method that converts the selected objects. Typical values are ‘toFormex’, ‘toMesh’, ‘toSurface’. Objects that do not have such a method are silently ignored.
suffix (str) – A string to be appended to the name of the object to form the name of the converted object. The default will keep the same name and thus overwrite the old objects in the project.
- gui.menus.Geometry.rotatePrincipal()[source]¶
Rotate the selection according to the last shown principal axes.
- gui.menus.Geometry.transformPrincipal()[source]¶
Transform the selection according to the last shown principal axes.
This is analog to rotatePrincipal, but positions the object at its center.
- gui.menus.Geometry.menufunc(action)[source]¶
Function triggered by the menu items.
If the action’s data is a tuple with a callable as first item, call it with the remainder of the tuple as arguments.
- gui.menus.Geometry.menu_func(action)¶
Function triggered by the menu items.
If the action’s data is a tuple with a callable as first item, call it with the remainder of the tuple as arguments.