Example am: Node editing along coordinate axes : Editing the heart mesh

Shows how to use EDIT_MASK and CONSTANT computed fields to create arrow vectors that allow you to edit along the underlying coordinate system directions even in the 3D window.

Screenshot of example a/am


The comfile run by this example is as follows:

#Example_am: Node editing along coordinate axes : Editing the heart mesh
#
# This example shows that by using EDIT_MASK and CONSTANT computed fields
# it is possible to make glyphs that allow you to shift nodes along
# the coordinate axes directions, greatly increasing your control when 
# graphically positioning nodes in the 3D window.
#
# This procedure is easy to generalise to any other coordinate system.
#
#----------
#
# Read in the heart mesh from examples a3.
set dir example a3
gfx read nodes example heart.exnode
gfx read elements example heart.exelem
#
# Define a few materials for the edit arrows
#
gfx create material red ambient 1 0 0 diffuse 1 0 0 emission 0 0 0 specular 0.8 0.8 0.8 alpha 1 shininess 0.8
gfx create material green ambient 0 0.6 0 diffuse 0 0.6 0 emission 0 0 0 specular 0.8 0.8 0.8 alpha 1 shininess 0.8
gfx create material bluey ambient 0 0.2 0.4 diffuse 0 0.5 1 emission 0 0 0 specular 0.5 0.5 0.5 alpha 1 shininess 0.8
gfx create material gold ambient 1 0.7 0 diffuse 1 0.7 0 emission 0 0 0 specular 1 1 0.8 alpha 1 shininess 0.8
gfx create material purple ambient 1 0 1 diffuse 1 0 1 emission 0 0 0 specular 1 1 1 alpha 1 shininess 0.74
#
# Define the computed fields which pass the full coordinates along unchanged
# but only allow selective editing.  The edit_mask is a series of flags so 
# you can make glyphs that drag in two coordinates but not the third by 
# specifying edit_mask 1 1 0.  The coordinate system is inherited from the
# source field which is in prolate spheroidal.  To use rectangular cartesian
# edit vectors on the heart override this inheritance by specifying the
# coordinate system here.
#
gfx define field edit.lambda edit_mask field coordinates edit_mask 1 0 0
gfx define field edit.mu edit_mask field coordinates edit_mask 0 1 0
gfx define field edit.theta edit_mask field coordinates edit_mask 0 0 1
#
# We need constant vectors so that the edit arrows point in the correct
# direction. These fields have no source to inherit the coordinate system from
# so we set it explicitly.
#
gfx define field lambda_dirn coordinate_system prolate_spheroidal focus 35.25 constant number_of_values 3 values 1 0 0
gfx define field mu_dirn coordinate_system prolate_spheroidal focus 35.25 constant number_of_values 3 values 0 1 0
gfx define field theta_dirn coordinate_system prolate_spheroidal focus 35.25 constant number_of_values 3 values 0 0 1
#
# Put glyphs at every heart node that allow us to select them
#
gfx modify g_element heart general clear;
gfx modify g_element heart lines coordinate coordinates material default;
gfx modify g_element heart node_points coordinate coordinates glyph sphere size "1*1*1" centre 0,0,0 select_on material green selected_material purple
#
# Create the edit arrows at each node only when selected, and display the
# current coordinates at these nodes.
#
gfx modify g_element heart node_points coordinate edit.lambda glyph arrow_solid size "5*1*1" centre 0,0,0 orientation lambda_dirn scale_factors "0*0*0" draw_selected material red selected_material red

gfx modify g_element heart node_points coordinate edit.mu glyph arrow_solid size "5*1*1" centre 0,0,0 orientation mu_dirn scale_factors "0*0*0" draw_selected material bluey selected_material bluey

gfx modify g_element heart node_points coordinate edit.theta glyph arrow_solid size "5*1*1" centre 0,0,0 orientation theta_dirn scale_factors "0*0*0" draw_selected material gold selected_material gold

#
# Create the window
#
gfx create window 1
gfx modify window 1 view parallel eye_point -29.38 287.425 79.9833 interest_point 9.70453 6.38585 -5.00082 up_vector -0.99086 -0.118078 -0.0652206 view_angle 19.9678 near_clipping_plane 2.96197 far_clipping_plane 1058.51 relative_viewport ndc_placement -1 1 2 2 viewport_coordinates 0 0 1 1
#
# Set up the node tool for editing
#
# Select the node tool icon in the graphics window. Click again on its icon and
# choose 'edit' on the dialog that appears.  Alternatively, enable node editing
# with the following command:
gfx node_tool edit
#
# Edit away!
#
# Click on some of the green spheres and the edit vectors appear.
# Drag the edit_vectors to move the nodes.  Each coloured edit_vector moves you
# in only one of the underlying coordinate directions.
# You can select multiple nodes and move groups together, again maintaining
# consistency in the underlying coordinate system. 
#

Files used by this example are:

Name            Modified     Size

example_am.com 17-Mar-2014 4.3k COPYRIGHT 17-Mar-2014 504

Download the entire example:

Name                  Modified     Size

examples_a_am.tar.gz 09-Mar-2016 25k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxFailureSun Mar 6 00:10:20 20163
last breakTue Feb 24 00:02:00 20153
cmgui-wx-debugFailureSun Mar 6 00:13:06 20162
last breakTue Feb 24 00:02:00 20153
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:13:31 20163
last breakTue Feb 24 03:11:00 20152
cmgui-wx-debug-valgrindFailureSun Mar 6 00:57:48 201640
last breakSun Mar 6 00:57:00 201640
x86_64-linux
cmgui-wxFailureSun Mar 6 00:01:28 20161
last breakSun Mar 6 00:01:00 20161
cmgui-wx-debugFailureSun Mar 6 00:01:28 20161
last breakSun Mar 6 00:01:00 20161
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:01:28 20161
last breakSun Mar 6 00:01:00 20161
cmgui-wx-debug-valgrindFailureSun Mar 6 00:02:50 20169
last breakSun Mar 6 00:02:00 20169
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:02:25 20167

Testing status by file:


Html last generated: Wed Mar 9 16:01:24 2016

Input last modified: Wed Mar 9 15:49:43 2016


CMISS Help / Examples / a / am