Personal tools
You are here: Home cmgui Wiki Create a surface data cloud from a mesh you have loaded into CmGUI
Views

History for Create a surface data cloud from a mesh you have loaded into CmGUI

changed:
-
This page is now out-of-date, check example a/decimation instead.

  #mesh .exnode and .exelem files to be used
  $breast = "breast_ref4x4x6"
  #name of file to save data cloud
  $data = "breast_ref4x4x6surface"
  #data group names for the different surfaces from which data cloud is to be created 
  $dataTOP = "breast_ref4x4x6surfaceTOP"
  $dataLEFT = "breast_ref4x4x6surfaceLEFT"
  $dataRIGHT = "breast_ref4x4x6surfaceRIGHT"
  
  #read the mesh in
  gfx rea no $breast
  gfx re ele $breast
  #define a density field that helps to create a data cloud of the specified density across a surface
  gfx def field density composite 0.05
  #The following two fields will help create isosurfaces on the mesh at the external surfaces (xi1=0 or 1 and xi2=0)
  gfx def field extSurfXi2 component xi.2
  gfx def field extSurfXi1 component xi.1
  
  #create data groups to store data generated from the different surfaces (I created my data from three different surfaces on the mesh)
  gfx create dgroup $dataTOP
  gfx create dgroup $dataLEFT
  gfx create dgroup $dataRIGHT
  
  
  #group elems from the 4x4x6 ref mesh to choose their external surfaces
  gfx create egroup top_elems add_range 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
  gfx create egroup left_elems add_range 73,74,75,76,77,78,25,26,27,28,29,30,49,50,51,52,53,54,1,2,3,4,5,6
  gfx create egroup right_elems add_range 91,92,93,94,95,96,43,44,45,46,47,48,67,68,69,70,71,72,19,20,21,22,23,24
  
  # create iso surfaces at xi2 = 0, xi 1 = 0 and xi 1 = 1 of the three different element groups. The iso-surfaces are used to create a data cloud which is stored in the surface_data_region specified by $dataTOP or $dataLEFT or $dataRIGHT
  
  gfx mod g_elem top_elems iso_surface iso_scalar extSurfXi2 iso_values 0 surface_data_coordinate_field coordinates surface_data_density_field density surface_data_region $dataTOP use_elem select_on material red selected_material default_selected render_shaded;
  
  gfx mod g_elem right_elems iso_surface iso_scalar extSurfXi1 iso_values 0.9999999 surface_data_coordinate_field coordinates surface_data_density_field density surface_data_region $dataRIGHT use_elem select_on material red selected_material default_selected render_shaded;
  
  gfx mod g_elem left_elems iso_surface iso_scalar extSurfXi1 iso_values 0 surface_data_coordinate_field coordinates surface_data_density_field density surface_data_region $dataLEFT use_elem select_on material red selected_material default_selected render_shaded;
  
  gfx cr wi
  #create a new data group
  gfx create dgroup $data
  gfx ed scene
  
  gfx modify g_element $dataTOP general clear circle_discretization 6 default_coordinate coordinates element_discretization "15*15*15" native_discretization none;
  gfx modify g_element $dataTOP lines select_on material default selected_material default_selected;
  gfx modify g_element $dataTOP data_points glyph point general size "1*1*1" centre 0,0,0 select_on material default selected_material default_selected;
  
  gfx modify g_element $dataLEFT general clear circle_discretization 6 default_coordinate coordinates element_discretization "15*15*15" native_discretization none;
  gfx modify g_element $dataLEFT lines select_on material default selected_material default_selected;
  gfx modify g_element $dataLEFT data_points glyph point general size "1*1*1" centre 0,0,0 select_on material default selected_material default_selected;
  
  gfx modify g_element $dataRIGHT general clear circle_discretization 6 default_coordinate coordinates element_discretization "15*15*15" native_discretization none;
  gfx modify g_element $dataRIGHT lines select_on material default selected_material default_selected;
  gfx modify g_element $dataRIGHT data_points glyph point general size "1*1*1" centre 0,0,0 select_on material default selected_material default_selected;
  
  #add all the data to the $data group so that all data points are in one data group.
  gfx mod dgroup $data add all
  gfx modify g_element $data general clear circle_discretization 6 default_coordinate coordinates element_discretization "15*15*15" native_discretization none;
  gfx modify g_element $data data_points glyph point general size "1*1*1" centre 0,0,0 select_on material default selected_material default_selected;
  
  #write the coordinates of the data points out into a file name stored in $data
  gfx write data group $data field coordinates $data

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.