DAVE.scene

Module Contents

class DAVE.scene.Node(scene)

ABSTRACT CLASS - Properties defined here are applicable to all derived classes Master class for all nodes

_scene :Scene

reference to the scene that the node lives is

_name :str = no name

Unique name of the node

_manager :Node or None

Reference to a node that controls this node

__repr__(self)
__str__(self)
depends_on(self)

Returns a list of nodes that need to be available before the node can be created

give_python_code(self)

Returns the python code that can be executed to re-create this node

_verify_change_allowed(self)

Changing the state of a node is only allowed if either: 1. the node is not manages (node._manager is None) 2. the manager of the node is identical to scene.current_manager

_delete_vfc(self)
update(self)

Performs internal updates relevant for physics. Called before solving statics or getting results

class DAVE.scene.CoreConnectedNode(scene, vfNode)

Bases: DAVE.scene.Node

ABSTRACT CLASS - Properties defined here are applicable to all derived classes Master class for all nodes with a connected eqCore element

_delete_vfc(self)
class DAVE.scene.NodeWithParent(scene, vfNode)

Bases: DAVE.scene.CoreConnectedNode

NodeWithParent

Do not use this class directly. This is a base-class for all nodes that have a “parent” property.

depends_on(self)
change_parent_to(self, new_parent)

Assigns a new parent to the node but keeps the global position and rotation the same.

See also: .parent (property)

Parameters:

new_parent – new parent node

class DAVE.scene.Visual(scene)

Bases: DAVE.scene.Node

Visual

autoapi/DAVE/scene/images/visual.png

A Visual node contains a 3d visual, typically obtained from a .obj file. A visual node can be placed on an axis-type node.

It is used for visualization. It does not affect the forces, dynamics or statics.

The visual can be given an offset, rotation and scale. These are applied in the following order

  1. rotate

  2. scale

  3. offset

Hint: To scale before rotation place the visual on a dedicated axis and rotate that axis.

offset = [0, 0, 0]

Offset (x,y,z) of the visual. Offset is applied after scaling

rotation = [0, 0, 0]

Rotation (rx,ry,rz) of the visual

scale = [1, 1, 1]

Scaling of the visual. Scaling is applied before offset.

path =

Filename of the visual

parent

Axis-type

Type:

Parent

depends_on(self)
give_python_code(self)
change_parent_to(self, new_parent)
class DAVE.scene.Axis(scene, vfAxis)

Bases: DAVE.scene.NodeWithParent

Axis

Axes are the main building blocks of the geometry. They have a position and an rotation in space. Other nodes can be placed on them. Axes can be nested by parent/child relationships meaning that an axis can be placed on an other axis. The possible movements of an axis can be controlled in each degree of freedom using the “fixed” property.

Axes are also the main building block of inertia. Dynamics are controlled using the inertia properties of an axis: inertia [mT], inertia_position[m,m,m] and inertia_radii [m,m,m]

Notes

  • circular references are not allowed: It is not allowed to place a on b and b on a

depends_on(self)
_delete_vfc(self)
_update_inertia(self)
set_free(self)

Sets .fixed to (False,False,False,False,False,False)

set_fixed(self)

Sets .fixed to (True,True,True,True,True,True)

to_loc_position(self, value)

Returns the local position of a point in the global axis system. This considers the position and the rotation of the axis system. See Also: to_loc_direction

to_glob_position(self, value)

Returns the global position of a point in the local axis system. This considers the position and the rotation of the axis system. See Also: to_glob_direction

to_loc_direction(self, value)

Returns the local direction of a point in the global axis system. This considers only the rotation of the axis system. See Also: to_loc_position

to_glob_direction(self, value)

Returns the global direction of a point in the local axis system. This considers only the rotation of the axis system. See Also: to_glob_position

to_loc_rotation(self, value)

Returns the local rotation. Used for rotating rotations. See Also: to_loc_position, to_loc_direction

to_glob_rotation(self, value)

Returns the global rotation. Used for rotating rotations. See Also: to_loc_position, to_loc_direction

change_parent_to(self, new_parent)

Assigns a new parent to the node but keeps the global position and rotation the same.

See also: .parent (property)

Parameters:

new_parent – new parent node

give_python_code(self)
class DAVE.scene.Poi(scene, vfPoi)

Bases: DAVE.scene.NodeWithParent

A location on an axis

give_python_code(self)
class DAVE.scene.RigidBody(scene, axis, poi, force)

Bases: DAVE.scene.Axis

A Rigid body, internally composed of an axis, a poi (cog) and a force (gravity)

_delete_vfc(self)
give_python_code(self)
class DAVE.scene.Cable(scene, node)

Bases: DAVE.scene.CoreConnectedNode

A Cable represents a linear elastic wire running from a Poi or sheave to another Poi of sheave.

A cable has a un-stretched length [length] and a stiffness [EA] and may have a diameter [m]. The tension in the cable is calculated.

Intermediate pois or sheaves may be added.

  • Pois are considered as sheaves with a zero diameter.

  • Sheaves are considered sheaves with the given geometry. If defined then the diameter of the cable is considered when calculating the geometry. The cable runs over the sheave in the positive direction (right hand rule) as defined by the axis of the sheave.

For cables running over a sheave the friction in sideways direction is considered to be infinite. The geometry is calculated such that the cable section between sheaves is perpendicular to the vector from the axis of the sheave to the point where the cable leaves the sheave.

This assumption results in undefined behaviour when the axis of the sheave is parallel to the cable direction.

Notes

If pois or sheaves on a cable come too close together (<1mm) then they will be pushed away from eachother. This prevents the unwanted situation where multiple pois end up at the same location. In that case it can not be determined which amount of force should be applied to each of the pois.

depends_on(self)
get_points_for_visual(self)

Returns an list of 3D locations which can be used for visualization

_add_connection_to_core(self, connection)
_update_pois(self)
_give_poi_names(self)

Returns a list with the names of all the pois

give_python_code(self)
class DAVE.scene.Force

Bases: DAVE.scene.NodeWithParent

A Force models a force and moment on a poi.

Both are expressed in the global axis system.

give_python_code(self)
class DAVE.scene.ContactMesh(scene, vfContactMesh)

Bases: DAVE.scene.NodeWithParent

A ContactMesh is a tri-mesh with an axis parent

give_python_code(self)
class DAVE.scene.ContactBall(scene, node)

Bases: DAVE.scene.NodeWithParent

A ContactBall is a linear elastic ball which can contact with ContactMeshes.

It is modelled as a sphere around a Poi. Radius and stiffness can be controlled using radius and k.

The force is applied on the Poi and it not registered separately.

add_contactmesh(self, mesh)
clear_contactmeshes(self)
give_python_code(self)
class DAVE.scene.Sheave

Bases: DAVE.scene.NodeWithParent

A Sheave models sheave with axis and diameter.

give_python_code(self)
class DAVE.scene.HydSpring

Bases: DAVE.scene.NodeWithParent

A HydSpring models a linearized hydrostatic spring.

The cob (center of buoyancy) is defined in the parent axis system. All other properties are defined relative to the cob.

give_python_code(self)
class DAVE.scene.LC6d(scene, node)

Bases: DAVE.scene.CoreConnectedNode

A LC6d models a Linear Connector with 6 dofs.

It connects two Axis elements with six linear springs. The translational-springs are easy. The rotational springs may not be as intuitive. They are defined as:

  • rotation_x = arc-tan ( uy[0] / uy[1] )

  • rotation_y = arc-tan ( -ux[0] / ux[2] )

  • rotation_z = arc-tan ( ux[0] / ux [1] )

which works fine for small rotations and rotations about only a single axis.

Try to avoid using very high stiffness settings to create fixed connections. It is better to use use the “fixed” property of axis systems to create joints.

depends_on(self)
give_python_code(self)
class DAVE.scene.Connector2d(scene, node)

Bases: DAVE.scene.CoreConnectedNode

A Connector2d linear connector with acts both on linear displacement and angular displacement.

  • the linear stiffness is defined by k_linear and is defined over the actual shortest direction between master and slave.

  • the angular stiffness is defined by k_angular and is defined over the actual smallest angle between the two systems.

depends_on(self)
give_python_code(self)
class DAVE.scene.LinearBeam(scene, node)

Bases: DAVE.scene.CoreConnectedNode

A LinearBeam models a FEM-like linear beam element.

A LinearBeam node connects two Axis elements with six linear springs.

By definition the beam runs in the X-direction of the master axis system. So it may be needed to create a dedicated Axis element for the beam to control the orientation.

The beam is defined using the following properties:

  • EIy - bending stiffness about y-axis

  • EIz - bending stiffness about z-axis

  • GIp - torsional stiffness about x-axis

  • EA - axis stiffness in x-direction

  • L - the un-stretched length of the beam

The beam element is in rest if the slave axis system

  1. has the same global orientation as the master system

  2. is at global position equal to the global position of local point (L,0,0) of the master axis. (aka: the end of the beam)

The scene.new_linearbeam automatically creates a dedicated axis system for each end of the beam. The orientation of this axis-system is determined as follows:

First the direction from master to slave is determined: D The axis of rotation is the cross-product of the unit x-axis and D AXIS = ux x D The angle of rotation is the angle between the master x-axis and D

The rotation about the rotated X-axis is undefined.

depends_on(self)
give_python_code(self)
class DAVE.scene.TriMeshSource(scene, source)

Bases: DAVE.scene.Node

TriMesh

A TriMesh node contains triangular mesh which can be used for buoyancy or contact

AddVertex(self, x, y, z)
AddFace(self, i, j, k)
get_extends(self)

Returns the extends of the mesh in global coordinates

Returns: (minimum_x, maximum_x, minimum_y, maximum_y, minimum_z, maximum_z)

make_cube(self)

Sets the mesh to a cube

_fromVTKpolydata(self, polydata, offset=None, rotation=None, scale=None)
load_vtk_polydataSource(self, polydata)

Fills the triangle data from a vtk polydata such as a cubeSource.

The vtk TriangleFilter is used to triangulate the source

Examples

cube = vtk.vtkCubeSource() cube.SetXLength(122) cube.SetYLength(38) cube.SetZLength(10) trimesh.load_vtk_polydataSource(cube)

load_obj(self, filename, offset=None, rotation=None, scale=None)

Loads an .obj file and and triangulates it.

Order of modifications:

  1. rotate

  2. scale

  3. offset

Parameters:
  • filename – (str or path): file to load

  • offset – : offset

  • rotation – : rotation

  • scale – scale

give_python_code(self)
change_parent_to(self, new_parent)
class DAVE.scene.Buoyancy(scene, vfBuoyancy)

Bases: DAVE.scene.NodeWithParent

Buoyancy provides a buoyancy force based on a buoyancy mesh. The mesh is triangulated and chopped at the instantaneous flat water surface. Buoyancy is applied as an upwards force that the center of buoyancy. The calculation of buoyancy is as accurate as the provided geometry.

There as no restrictions to the size or aspect ratio of the panels. It is excellent to model as box using 6 faces. Using smaller panels has a negative effect on performance.

The normals of the panels should point towards to water.

give_python_code(self)
class DAVE.scene.BallastSystem(scene, poi, force)

Bases: DAVE.scene.Poi

A BallastSystem

The position of the axis system is the reference position for the tanks.

Tanks can be added using new_tank()

technical notes: - System is similar to the setup of RigidBody, but without the Axis - The class extends Poi, but overrides some of its properties - Update nees to be called to update the weight and cog

TODO: Inertia

class Tank
name = noname

Name of the tank

max = 0

Maximum fill in [kN]

pct = 0

Actual fill percentage in [%]

position

Tank CoG position relative to ballast system origin [m,m,m]

frozen = False

The fill of frozen tanks should not be altered

_pointmass

Optional reference to pointmass node - handled by ballastsystem node

weight(self)

Returns the actual weight of tank contents in kN

is_full(self)

Returns True of tank is (almost) full

is_empty(self)

Returns True of tank is (almost) empty

is_partial(self)

Returns True of tank not full but also not empty

mxmymz(self)

Position times actual weight

make_empty(self)

Empties the tank

make_full(self)

Fills the tank

_tanks = []

List of tank objects

_position = [0.0, 0.0, 0.0]

Position is the origin of the ballast system

_cog = [0.0, 0.0, 0.0]

Position of the CoG of the ballast-tanks relative to self._position, calculated when calling update()

_weight = 0

Weight [kN] of the ballast-tanks , calculated when calling update()

frozen = False

The contents of a frozen tank should not be changed

update(self)
_delete_vfc(self)
new_tank(self, name, position, capacity_kN, actual_fill=0, frozen=False)

Creates a new tanks and adds it to the ballast-system

Parameters:
  • name – (str) name of the tanks

  • position – (float[3]) position of the tank [m,m,m]

  • capacity_kN – (float) Maximum capacity of the tank in [kN]

  • actual_fill – (float) Optional, actual fill percentage of the tank [0] [%]

  • frozen – (bool) Optional, the contents of frozen tanks should not be altered

Returns:

BallastSystem.Tank object

reorder_tanks(self, names)

Places tanks with given names at the top of the list. Other tanks are appended afterwards in original order.

For a complete re-order give all tank names.

Example

let tanks be ‘a’,’b’,’c’,’d’,’e’

then re_order_tanks([‘e’,’b’]) will result in [‘e’,’b’,’a’,’c’,’d’]

order_tanks_by_elevation(self)

Re-orders the existing tanks such that the lowest tanks are higher in the list

order_tanks_by_distance_from_point(self, point, reverse=False)

Re-orders the existing tanks such that the tanks furthest from the point are first on the list

Parameters:
  • point – (x,y,z) - reference point to determine the distance to

  • reverse – (False) - order in reverse order: tanks nearest to the points first on list

order_tanks_to_maximize_inertia_moment(self)

Re-order tanks such that tanks furthest from center of system are first on the list

order_tanks_to_minimize_inertia_moment(self)

Re-order tanks such that tanks nearest to center of system are first on the list

_order_tanks_to_inertia_moment(self, maximize=True)
tank_names(self)
fill_tank(self, name, fill)
xyzw(self)

Gets the current ballast cog and weight from the tanks

Returns:

(x,y,z), weight

empty_all_usable_tanks(self)
tank(self, name)
__getitem__(self, item)
give_python_code(self)
class DAVE.scene.WaveInteraction1(scene)

Bases: DAVE.scene.Node

WaveInteraction

Wave-interaction-1 couples a first-order hydrodynamic database to an axis.

This adds: - wave-forces - damping - added mass

The data is provided by a Hyddb1 object which is defined in the MaFreDo package. The contents are not embedded but are to be provided separately in a file. This node contains only the file-name.

offset = [0, 0, 0]

Offset (x,y,z) of the visual. Offset is applied after scaling

parent

Axis-type

Type:

Parent

path

Filename of a file that can be read by a Hyddb1 object

depends_on(self)
give_python_code(self)
change_parent_to(self, new_parent)
class DAVE.scene.Manager
managed_nodes(self)

Returns a list of managed nodes

delete(self)

Carefully remove the manager, reinstate situation as before

class DAVE.scene.GeometricContact(scene, circle1, circle2, name)

Bases: DAVE.scene.Node, DAVE.scene.Manager

GeometricContact

A GeometricContact can be used to construct geometric connections between circular members:
  • steel bars and holes, such as a shackle pin in a padeye (pin-hole)

  • steel bars and steel bars, such as a shackle-shackle connection

parent_parent_of_circle2 [axis] <– not managed
  • parent_of_circle2 [poi]
    • circle2 [circle] <— input for creation

    • SELF_master_axis <— created
      • SELF_pin_hole_connection <— created -SELF_connection_axial_rotation

        • SELF_slaved_axis <— created

          • parent_of_parent_of_circle1 [axis] - parent_of_circle_1 [poi]

            • circle1 [circle] <— input for creation

_master_axis

Axis on the master axis at the location of the center of hole or pin

_pin_hole_connection

axis between the center of the hole and the center of the pin. Free to rotate about the center of the hole as well as the pin

_slaved_axis

axis to which the slaved body is connected. Either the center of the hole or the center of the pin

change_parent_to(self, new_parent)
delete(self)
_make_connection(self)
set_pin_pin_connection(self)

Sets the connection to be of type pin-pin

set_pin_in_hole_connection(self)

Sets the connection to be of type pin-in-hole

The axes of the two sheaves are aligned by rotating the slaved body The axes of the two sheaves are placed at a distance hole_dia - pin_dia apart, perpendicular to the axis direction An axes is created at the centers of the two sheaves These axes are connected with a shore axis which is allowed to rotate relative to the master axis the slave axis is fixed to this rotating axis

managed_nodes(self)

Returns a list of managed nodes

depends_on(self)
flip(self)
change_side(self)
give_python_code(self)
class DAVE.scene.Sling(scene, name, length, LeyeA, LeyeB, LspliceA, LspliceB, diameter, EA, mass, endA=None, endB=None, sheaves=None)

Bases: DAVE.scene.Node, DAVE.scene.Manager

A Sling is a single wire with an eye on each end. The eyes are created by splicing the end of the sling back into the itself.

The geometry of a sling is defined as follows:

diameter : diameter of the wire LeyeA, LeyeB : inside lengths of the eyes LsplicaA, LspliceB : the length of the splices Total : the distance between the insides of ends of the eyes A and B when pulled straight.

Stiffness: The stiffness of the sling is specified by a single value: EA This determines the stiffnesses of the individual parts as follows: Wire in the eyes: EA Splices: Infinity (rigid) Main part: determined such that total stiffness (k) of the sling is EA/L

Eye A Splice A main part Splice B Eye B

/————— /————— | =============————————————-=============== | -————–/ -————–/

See Also: Grommet

_update_properties(self)
depends_on(self)

Endpoints and sheaves are managed, so no dependency on those

however we do depend on their parents (if any)

managed_nodes(self)
delete(self)
give_python_code(self)
class DAVE.scene.Scene(filename=None, copy_from=None)

A Scene is the main component of DAVE.

It provides a world to place nodes (elements) in. It interfaces with the equilibrium core for all calculations.

By convention a Scene element is created with the name s, but create as many scenes as you want.

Examples

s = Scene() s.new_axis(‘my_axis’, position = (0,0,1))

a = Scene() # another world a.new_poi(‘a point’)

verbose = True

Report actions using print()

_vfc

DAVE Core, where the actual magic happens

Type:

_vfc

_nodes = []

Contains a list of all nodes in the scene

static_tolerance = 0.01

Desired tolerance when solving statics

resources_paths = []

A list of paths where to look for resources such as .obj files. Priority is given to paths earlier in the list.

_savepoint

Python code to re-create the scene, see savepoint_make()

_name_prefix =

An optional prefix to be applied to node names. Used when importing scenes.

current_manager

Setting this to an instance of a Manager allows nodes with that manager to be changed

_godmode = False

Icarus warning, wear proper PPE

clear(self)

Deletes all nodes

_print_cpp(self)
_print(self, what)
_prefix_name(self, name)
_verify_name_available(self, name)

Throws an error if a node with name ‘name’ already exists

_node_from_node_or_str(self, node)

If node is a string, then returns the node with that name, if node is a node, then returns that node

Raises:

ValueError if a string is passed with an non-existing node

_node_from_node(self, node, reqtype)

Gets a node from the specified type

Returns None if node is None Returns node if node is already a reqtype type node Else returns the axis with the given name

Raises Exception if a node with name is not found

_parent_from_node(self, node)

Returns None if node is None Returns node if node is an axis type node Else returns the axis with the given name

Raises Exception if a node with name is not found

_poi_from_node(self, node)

Returns None if node is None Returns node if node is an poi type node Else returns the poi with the given name

Raises Exception if anything is not ok

_poi_or_sheave_from_node(self, node)

Returns None if node is None Returns node if node is an poi type node Else returns the poi with the given name

Raises Exception if anything is not ok

_sheave_from_node(self, node)

Returns None if node is None Returns node if node is an poi type node Else returns the poi with the given name

Raises Exception if anything is not ok

_geometry_changed(self)

Notify the scene that the geometry has changed and that the global transforms are invalid

_fix_vessel_heel_trim(self)

Fixes the heel and trim of each node that has a buoyancy or linear hydrostatics node attached.

Returns:

Dictionary with original fixed properties as dict({‘node name’,fixed[6]}) which can be passed to _restore_original_fixes

_restore_original_fixes(self, original_fixes)

Restores the fixes as in original_fixes

See also: _fix_vessel_heel_trim

Parameters:

original_fixes – dict with {‘node name’,fixes[6] }

Returns:

None

get_resource_path(self, name)

Looks for a file with “name” in the specified resource-paths and returns the full path to the the first one that is found. If name is a full path to an existing file, then that is returned.

See also

resource_paths

Returns:

Full path to resource

Raises:

FileExistsError if resource is not found

get_resource_list(self, extension)

Returns a list of all file-paths (strings) given extension in any of the resource-paths

node_by_name(self, node_name, silent=False)
__getitem__(self, node_name)

Returns a node with name

nodes_of_type(self, node_class)

Returns all nodes of the specified or derived type

Examples

pois = scene.nodes_of_type(DAVE.Poi) axis_and_bodies = scene.nodes_of_type(DAVE.Axis)

assert_unique_names(self)

Asserts that all names are unique

sort_nodes_by_parent(self)

Sorts the nodes such that the parent of this node (if any) occurs earlier in the list.

See also

sort_nodes_by_dependency

sort_nodes_by_dependency(self)

Sorts the nodes such that a node only depends on nodes earlier in the list.

See also

sort_nodes_by_parent

name_available(self, name)

Returns True if the name is still available

available_name_like(self, like)

Returns an available name like the one given, for example Axis23

node_A_core_depends_on_B_core(self, A, B)

Returns True if the node core of node A depends on the core node of node B

nodes_depending_on(self, node)

Returns a list of nodes that physically depend on node. Only direct dependants are obtained with a connection to the core. This function should be used to determine dependencies of Core-connected elements.

For making node-trees please use nodes_with_parent instead.

Parameters:

node – Node or node-name

Returns:

list of names

See Also: nodes_with_parent

nodes_with_parent(self, node)

Returns a list of nodes that have given node as a parent. Good for making trees. For checking physical connections use nodes_depending_on instead.

Parameters:

node – Node or node-name

Returns:

list of names

See Also: nodes_depending_on

delete(self, node)

Deletes the given node from the scene as well as all nodes depending on it.

See also

dissolve

dissolve(self, node)

Attempts to delete the given node without affecting the rest of the model.

  1. Look for nodes that have this node as parent

  2. Attach those nodes to the parent of this node.

  3. Delete this node.

There are many situations in which this will fail because an it is impossible to dissolve the element. For example a poi can only be dissolved when nothing is attached to it.

For now this function only works on AXIS

savepoint_make(self)
savepoint_restore(self)
update(self)

Updates the interface between the nodes and the core. This includes the re-calculation of all forces, buoyancy positions, ballast-system cogs etc.

solve_statics(self, silent=False, timeout=None)

Solves statics

Parameters:

silent – Do not print if successfully solved

Returns:

True if successful, False otherwise.

Return type:

bool

verify_equilibrium(self, tol=0.01)

Checks if the current state is an equilibrium

Returns:

True if successful, False if not an equilibrium.

Return type:

bool

goal_seek(self, evaluate, target, change_node, change_property, bracket=None, tol=0.001)

goal_seek

Goal seek is the classic goal-seek. It changes a single property of a single node in order to get some property of some node to a specified value. Just like excel.

Parameters:
  • evaluate – code to be evaluated to yield the value that is solved for. Eg: s[‘poi’].fx Scene is abbiviated as “s”

  • target (number) – target value for that property

  • change_node (Node or str) – node to be adjusted

  • change_property (str) – property of that node to be adjusted

  • range (optional) – specify the possible search-interval

Returns:

True if successful, False otherwise.

Return type:

bool

Examples

Change the y-position of the cog of a rigid body (‘Barge’) in order to obtain zero roll (rx) >>> s.goal_seek(“s[‘Barge’].fx”,0,’Barge’,’cogy’)

plot_effect(self, evaluate, change_node, change_property, start, to, steps)

Produces a 2D plot with the relation between two properties of the scene. For example the length of a cable versus the force in another cable.

The evaluate argument is processed using “eval” and may contain python code. This may be used to combine multiple properties to one value. For example calculate the diagonal load distribution from four independent loads.

The plot is produced using matplotlob. The plot is produced in the current figure (if any) and plt.show is not executed.

Parameters:
  • evaluate (str) – code to be evaluated to yield the value on the y-axis. Eg: s[‘poi’].fx Scene is abbiviated as “s”

  • change_node (Node or str) – node to be adjusted

  • change_property (str) – property of that node to be adjusted

  • start – left side of the interval

  • to – right side of the interval

  • steps – number of steps in the interval

Returns:

Tuple (x,y) with x and y coordinates

Examples

>>> s.plot_effect("s['cable'].tension", "cable", "length", 11, 14, 10)
>>> import matplotlib.pyplot as plt
>>> plt.show()
new_axis(self, name, parent=None, position=None, rotation=None, inertia=None, inertia_radii=None, fixed=True)

Creates a new axis node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – optional, name of the parent of the node

  • position – optional, position for the node (x,y,z)

  • rotation – optional, rotation for the node (rx,ry,rz)

  • [True] (fixed) – optional, determines whether the axis is fixed [True] or free [False]. May also be a sequence of 6 booleans.

Returns:

Reference to newly created axis

new_geometriccontact(self, name, slave_item, master_item, inside=False, swivel=None, master_rotation=None, slave_rotation=None, swivel_fixed=True, master_fixed=False, slave_fixed=False)

Creates a new new_geometriccontact node and adds it to the scene.

Geometric contact connects two circular elements and can be used to model bar-bar connections or pin-in-hole connections.

By default a bar-bar connection is created between item1 and item2.

Parameters:
  • name – Name for the node, should be unique

  • slave_item – [Sheave] will be the master of the connection

  • master_item – [Sheave] will be the slave of the connection

  • inside – [False] False creates a pinpin connection. True creates a pin-hole type of connection

  • swivel – Rotation angle between the two items. Defaults to 90 for pinpin and 0 for pin-hole

  • master_rotation – Angle of the connecting hinge relative to master or None for default

  • slave_rotation – Angle of the slave relative to the connecting hinge or None for default

  • swivel_fixed – Fix swivel [True]

  • master_fixed – Fix connecting hinge to master [False]

  • slave_fixed – Fix slave to connecting hinge [False]

Note

For pin-hole connections there is no geometrical difference between the pin and the hole. Therefore it is not needed to specify which is the pin and which is the hole

Returns:

Reference to newly created new_geometriccontact

new_waveinteraction(self, name, path, parent=None, offset=None)

Creates a new wave interaction node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • path – Path to the hydrodynamic database

  • parent – optional, name of the parent of the node

  • offset – optional, position for the node (x,y,z)

Returns:

Reference to newly created wave-interaction object

new_visual(self, name, path, parent=None, offset=None, rotation=None, scale=None)

Creates a new Visual node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • path – Path to the resource

  • parent – optional, name of the parent of the node

  • offset – optional, position for the node (x,y,z)

  • rotation – optional, rotation for the node (rx,ry,rz)

  • scale – optional, scale of the visual (x,y,z).

Returns:

Reference to newly created visual

new_poi(self, name, parent=None, position=None)

Creates a new poi node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – optional, name of the parent of the node

  • position – optional, position for the node (x,y,z)

Returns:

Reference to newly created poi

new_rigidbody(self, name, mass=0, cog=(0, 0, 0), parent=None, position=None, rotation=None, inertia_radii=None, fixed=True)

Creates a new rigidbody node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • mass – optional, [0] mass in mT

  • cog – optional, (0,0,0) cog-position in (m,m,m)

  • parent – optional, name of the parent of the node

  • position – optional, position for the node (x,y,z)

  • rotation – optional, rotation for the node (rx,ry,rz)

  • inertia_radii – optional, radii of gyration (rxx,ryy,rzz); only used for dynamics

  • [True] (fixed) – optional, determines whether the axis is fixed [True] or free [False]. May also be a sequence of 6 booleans.

Examples

scene.new_rigidbody(“heavy_thing”, mass = 10000, cog = (1.45, 0, -0.7))

Returns:

Reference to newly created RigidBody

new_cable(self, name, endA, endB, length=-1, EA=0, diameter=0, sheaves=None)

Creates a new cable node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • endA – A Poi element to connect the first end of the cable to

  • endB – A Poi element to connect the other end of the cable to

  • [-1] (length) – un-stretched length of the cable in m; default [-1] create a cable with the current distance between the endpoints A and B

  • [0] (EA) – stiffness of the cable in kN/m; default

  • sheaves – [optional] A list of pois, these are sheaves that the cable runs over. Defined from endA to endB

Examples

scene.new_cable(‘cable_name’ endA=’poi_start’, endB = ‘poi_end’) # minimal use

scene.new_cable(‘cable_name’, length=50, EA=1000, endA=poi_start, endB = poi_end, sheaves=[sheave1, sheave2])

scene.new_cable(‘cable_name’, length=50, EA=1000, endA=’poi_start’, endB = ‘poi_end’, sheaves=[‘single_sheave’]) # also a single sheave needs to be provided as a list

Notes

The default options for length and EA can be used to measure distances between points

Returns:

Reference to newly created Cable

new_force(self, name, parent=None, force=None, moment=None)

Creates a new force node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – name of the parent of the node [Poi]

  • force – optional, global force on the node (x,y,z)

  • moment – optional, global force on the node (x,y,z)

Returns:

Reference to newly created force

new_sheave(self, name, parent, axis, radius=0.0)

Creates a new sheave node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – name of the parent of the node [Poi]

  • axis – direction of the axis of rotation (x,y,z)

  • radius – optional, radius of the sheave

Returns:

Reference to newly created sheave

new_hydspring(self, name, parent, cob, BMT, BML, COFX, COFY, kHeave, waterline, displacement_kN)

Creates a new hydspring node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – name of the parent of the node [Axis]

  • cob – position of the CoB (x,y,z) in the parent axis system

  • BMT – Vertical distance between CoB and meta-center for roll

  • BML – Vertical distance between CoB and meta-center for pitch

  • COFX – X-location of center of flotation (center of waterplane) relative to CoB

  • COFY – Y-location of center of flotation (center of waterplane) relative to CoB

  • kHeave – heave stiffness (typically Awl * rho * g)

  • waterline – Z-position (elevation) of the waterline relative to CoB

  • displacement_kN – displacement (typically volume * rho * g)

Returns:

Reference to newly created hydrostatic spring

new_linear_connector_6d(self, name, slave, master, stiffness=None)

Creates a new linear connector 6d node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • slave – Slaved axis system [Axis]

  • master – Master axis system [Axis]

  • stiffness – optional, connection stiffness (x,y,z, rx,ry,rz)

See LC6d for details

Returns:

Reference to newly created connector

new_connector2d(self, name, master, slave, k_linear=0, k_angular=0)

Creates a new new_connector2d node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • slave – Slaved axis system [Axis]

  • master – Master axis system [Axis]

  • k_linear – linear stiffness in kN/m

  • k_angular – angular stiffness in kN*m / rad

Returns:

Reference to newly created connector2d

new_linear_beam(self, name, master, slave, EIy=0, EIz=0, GIp=0, EA=0, L=None)

Creates a new linear beam node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • slave (The length defaults to the distance between master and) – Slaved axis system [Axis]

  • master – Master axis system [Axis]

  • 0 (All stiffness terms default to) –

  • slave

See LinearBeam for details

Returns:

Reference to newly created beam

new_buoyancy(self, name, parent=None)

Creates a new buoyancy node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – optional, name of the parent of the node

Returns:

Reference to newly created buoyancy

new_contactmesh(self, name, parent=None)

Creates a new contactmesh node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – optional, name of the parent of the node

Returns:

Reference to newly created contact mesh

new_contactball(self, name, parent=None, radius=1, k=9999, meshes=None)

Creates a new force node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – name of the parent of the node [Poi]

  • force – optional, global force on the node (x,y,z)

  • moment – optional, global force on the node (x,y,z)

Returns:

Reference to newly created force

new_ballastsystem(self, name, parent=None, position=None)

Creates a new rigidbody node and adds it to the scene.

Parameters:
  • name – Name for the node, should be unique

  • parent – name of the parent of the ballast system (ie: the vessel axis system)

  • position – the reference system in which the tanks are defined [0,0,0]

Examples

scene.new_ballastsystem(“cheetah_ballast”, parent=”Cheetah”)

Returns:

Reference to newly created BallastSystem

new_sling(self, name, length=-1, EA=1.0, mass=0.1, endA=None, endB=None, LeyeA=None, LeyeB=None, LspliceA=None, LspliceB=None, diameter=0.1, sheaves=None)

Creates a new sling, adds it to the scene and returns a reference to the newly created object.

See also

Sling

Parameters:
  • name – name

  • length – length of the sling [m], defaults to distance between endpoints

  • EA – stiffness in kN, default: 1.0 (note: equilibrium will fail if mass >0 and EA=0)

  • mass – mass in mT, default 0.1

  • endA – element to connect end A to [poi, circle]

  • endB – element to connect end B to [poi, circle]

  • LeyeA – inside eye on side A length [m], defaults to 1/6th of length

  • LeyeB – inside eye on side B length [m], defaults to 1/6th of length

  • LspliceA – splice length on side A [m] (the part where the cable is connected to itself)

  • LspliceB – splice length on side B [m] (the part where the cable is connected to itself)

  • diameter – cable diameter in m, defaul to 0.1

  • sheaves – optional: list of sheaves/pois that the sling runs over

Returns:

a reference to the newly created Sling object.

print_python_code(self)

Prints the python code that generates the current scene

See also: give_python_code

give_python_code(self)

Generates the python code that rebuilds the scene and elements in its current state.

save_scene(self, filename)

Saves the scene to a file

This saves the scene in its current state to a file. Opening the saved file will reproduce exactly this scene.

This sounds nice, but beware that it only saves the resulting model, not the process of creating the model. This means that if you created the model in a parametric fashion or assembled the model from other models then these are not re-evaluated when the model is openened again. So lets say this model uses a sub-model of a lifting hook which is imported from another file. If that other file is updated then the results of that update will not be reflected in the saved model.

If no path is present in the file-name then the model will be saved in the last (lowest) resource-path (if any)

Parameters:

filename – filename or file-path to save the file. Default extension is .dave_asset

Returns:

the full path to the saved file

print_node_tree(self)
load_scene(self, filename=None)

Loads the contents of filename into the current scene.

This function is typically used on an empty scene.

Filename is appended with .dave if needed. File is searched for in the resource-paths.

See also: import scene

import_scene(self, other, prefix='', containerize=True)

Copy-paste all nodes of scene “other” into current scene.

To avoid double names it is recommended to use a prefix. This prefix will be added to all element names.

Returns:

if the imported scene is containerized then a reference to the created container is returned.

Return type:

Contained (Axis-type Node)

copy(self)

Creates a full and independent copy of the scene and returns it.

Example

s = Scene() c = s.copy() c.new_axis(‘only in c’)

dynamics_M(self, delta=1e-06)

Returns the mass matrix of the scene

dynamics_K(self, delta=1e-06)

Returns the stiffness matrix of the scene for a perturbation of delta

A component is positive if a displacement introduces an reaction force in the opposite direction. or: A component is positive if a positive force is needed to introduce a positive displacement.

dynamics_nodes(self)

Returns a list of nodes associated with the rows/columns of M and K

dynamics_modes(self)

Returns a list of modes (0=x … 5=rotation z) associated with the rows/columns of M and K