Mesh

Declaration

class declaracad.occ.mesh.Mesh(parent=None, **kwargs)[source]

Bases: Shape

A Mesh

Attributes:
source: Shape

Either a shape to mesh or a datasource. Alternatively the shape can be nested.

algorithm: String

The meshing algorithm to use to generate the mesh.

Methods

activate_bottom_up()

Initialize the proxy on the bottom-up activation pass.

activate_proxy()

Activate the proxy object tree.

activate_top_down()

Initialize the proxy on the top-down activation pass.

child_added(child)

A reimplemented child added event handler.

child_moved(child)

A method invoked when a child is moved in the object.

child_removed(child)

A reimplemented child removed event handler.

colorize_mesh()

This is invoked after the mesh is computed.

destroy()

A reimplemented destructor.

find(name[, regex])

Find the first object in the subtree with the given name.

find_all(name[, regex])

Find all objects in the subtree with the given name.

find_element(id)

Find the node with the given ID.

find_face(id)

Find the face element with the given ID.

find_node(id)

Find the node with the given ID.

find_volume(id)

Find the volume element with the given ID.

freeze

Freeze the atom to prevent further modifications to its attributes.

get_member

Get the named member for the atom.

has_observer

Get whether the atom has the given observer for a given topic.

has_observers

Get whether the atom has observers for a given topic.

initialize()

A reimplemented initializer.

insert_children(before, insert)

Insert children into this object at the given location.

members()

Get the members dictionary for the type.

notifications_enabled

Get whether notification is enabled for the atom.

notify

Call the registered observers for a given topic with positional and keyword arguments.

observe

Register an observer callback to observe changes on the given topic(s).

parent_changed(old, new)

A method invoked when the parent of the object changes.

prepare_mesh(gen, mesh, shape)

This is invoked before the mesh is computed.

process_mesh()

Process the generated mesh.

render()

Generates and returns the actual shape from the declaration.

root_object()

Get the root object for this hierarchy.

set_notifications_enabled

Enable or disable notifications for the atom.

set_parent(parent)

Set the parent for this object.

suppress_notifications()

Disable member notifications within in a context.

traverse([depth_first])

Yield all of the objects in the tree, from this object down.

traverse_ancestors([root])

Yield all of the objects in the tree, from this object up.

unobserve

Unregister an observer callback for the given topic(s).

export_type

node_type

Examples

enamldef Case(Part):
Box: box:

pass

Mesh:

source = box

colorize_mesh()[source]

This is invoked after the mesh is computed. The topology can be used to apply colors to nodes and elements.

disabled

Disable meshing

export_filename

If given, write the mesh to a file

export_type

Export type

find_element(id) Element[source]

Find the node with the given ID.

find_face(id) Element[source]

Find the face element with the given ID.

find_node(id) Node[source]

Find the node with the given ID.

find_volume(id) Element[source]

Find the volume element with the given ID.

options

Meshing options

prepare_mesh(gen, mesh, shape)[source]

This is invoked before the mesh is computed. It should be defined to prepare the meshing parameters.

Parameters:
gen: SMESH_Gen

The mesh generator

mesh: SMESH_Mesh

The mesh handle

shape: TopoDS_Shape

The shape being meshed

process_mesh()[source]

Process the generated mesh. This is invoked before colorizing.

If you want to use your own FEA, this is a good place to hook in.

proxy

Reference to the implementation control

source

May be either a shape to mesh or a numpy array

Implementation

class declaracad.occ.impl.occ_mesh.OccMesh[source]

Bases: OccDependentShape, ProxyMesh

Implementation is based on pySMESH by trelau

Attributes:
ais_shape
builder
declaration
displayed
element_builder
elements
faces
gen
is_active

Test whether or not the proxy is fully activated.

location
mesh
node_builder
nodes
reference
shape
smesh_ds
source
tdf_label
topology
viewer
volumes
vs_link

Methods

activate_bottom_up()

Activate the proxy tree for the bottom-up pass.

activate_top_down()

Activate the proxy for the top-down pass.

child_added(child)

Handle a child being added to the object.

child_removed(child)

Handle a child being removed from the object.

child_shapes()

Iterator of all child shapes

children()

Get the child objects for this object.

clear_cache()

Free up cached elements

create_shape()

Create the toolkit shape for the proxy object.

destroy()

Cleanup resources

export(filename, export_type, *args)

Export the mesh.

find_element(key)

Find the Element with the given ID.

find_face(key)

Find the Face with the given ID.

find_node(key)

Find the Node with the given ID.

find_volume(key)

Find the Volume with the given ID.

freeze

Freeze the atom to prevent further modifications to its attributes.

get_first_child()

Return shape to apply the operation to.

get_member

Get the named member for the atom.

get_transform()

Create a transform which rotates the default axis to align with the normal given by the position

has_observer

Get whether the atom has the given observer for a given topic.

has_observers

Get whether the atom has observers for a given topic.

init_layout()

Initialize the layout of the toolkit shape.

init_shape()

Initialize the state of the toolkit widget.

members()

Get the members dictionary for the type.

notifications_enabled

Get whether notification is enabled for the atom.

notify

Call the registered observers for a given topic with positional and keyword arguments.

observe

Register an observer callback to observe changes on the given topic(s).

parent()

Get the parent proxy object for this object.

set_notifications_enabled

Enable or disable notifications for the atom.

suppress_notifications()

Disable member notifications within in a context.

unobserve

Unregister an observer callback for the given topic(s).

update_shape([change])

Must be implmented in subclasses to create the shape when the dependent shapes change.

update_style()

Update mesh colors.

walk_shapes([ignore_display])

Iterator of all child shapes

clear_focus

ensure_hidden

ensure_visible

focus_next_child

focus_previous_child

get_bounding_box

has_focus

on_shape_changed

parent_shape

request_relayout

restyle

set_algorithm

set_axis

set_background

set_color

set_direction

set_disabled

set_display

set_element_color

set_enabled

set_focus

set_font

set_foreground

set_maximum_size

set_minimum_size

set_node_color

set_position

set_source

set_status_tip

set_texture

set_tool_tip

set_transparency

set_visible

update_mesh

ais_shape

The shape that was shown on the screen

clear_cache()[source]

Free up cached elements

destroy()[source]

Cleanup resources

export(filename: str, export_type: str, *args)[source]

Export the mesh. The extension is added automatically

Parameters:
filename: String

The base filename (excluding the extension)

export_type: String

The export type. Must map to one of the Export functions

find_element(key: int | object) Element[source]

Find the Element with the given ID.

find_face(key: int | object) Element[source]

Find the Face with the given ID.

find_node(key: int | object) Node[source]

Find the Node with the given ID.

find_volume(key: int | object) Element[source]

Find the Volume with the given ID.

nodes

Cached items

topology

Topology explorer of the shape

update_shape(change=None)[source]

Must be implmented in subclasses to create the shape when the dependent shapes change.

update_style()[source]

Update mesh colors.