User Tools

Site Tools


cad_visualization

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cad_visualization [2018/06/14 22:15]
mark.naves
cad_visualization [2018/06/14 22:23] (current)
mark.naves
Line 3: Line 3:
 In order to generate nice visualizations and animations, CAD geometry can be added to Spavisual. At this page, an example is provided how CAD geometry can be added to the visualization by exploiting the USERPLOT function of spavisual. In order to generate nice visualizations and animations, CAD geometry can be added to Spavisual. At this page, an example is provided how CAD geometry can be added to the visualization by exploiting the USERPLOT function of spavisual.
  
-First of all, the CAD geometry has to be saved in an .STL file. When saving the .STL file, it is important to save as ASCII with units in meters. In Solidworks, these settings can be set via 'save as => select .stl => options'. Furthermore, make sure you check the 'Do not translate STL output data to positive space' checkbox. Optionally, you can also provide an alternative coordinate system while save the .STL file. In the visualization, the origin of the selected coordinate system is going to coincide with a spacar node.  +First of all, the CAD geometry has to be saved in an .STL file. When saving the .STL file, it is important to save as ASCII with units in meters. In Solidworks, these settings can be set via 'save as => select .stl => options'. Furthermore, make sure you check the 'Do not translate STL output data to positive space' checkbox. Optionally, you can also provide an alternative coordinate system while saving the .STL file. In the visualization, the origin of the selected coordinate system is going to coincide with a spacar node.  
  
  
-For adding the .STL geometry to Spavisual in Spacarlight, the ''opt.customvis'' field is going to be used. This field will add extra lines in the visualization part of the .dat file (check the spavisual manual for all supported commands). In example, the USERPLOT function can be added with:+For adding the .STL geometry to Spavisual in Spacarlight, the ''opt.customvis'' field is going to be used (available from version 1.26). This field will add extra lines in the visualization part of the .dat file (check the spavisual manual for all supported commands). In example, the USERPLOT function can be added with:
 <code matlab> <code matlab>
 opt.customvis = {'USERPLOT ADDCAD'}; opt.customvis = {'USERPLOT ADDCAD'};
Line 23: Line 23:
   * the function quat2rotm is used to convert quaternions to a rotation matrix, which should be available in recent matlab versions. If not available, you will have to create this code yourself.   * the function quat2rotm is used to convert quaternions to a rotation matrix, which should be available in recent matlab versions. If not available, you will have to create this code yourself.
   * Converting .STL data to vertices and faces can take a long time (the stl2fv function). To improve speed, the variables ''F'' and ''V'' can be saved (in example in a .mat file), and loaded from this file instead of calling the stl2fv function.   * Converting .STL data to vertices and faces can take a long time (the stl2fv function). To improve speed, the variables ''F'' and ''V'' can be saved (in example in a .mat file), and loaded from this file instead of calling the stl2fv function.
 +  * For good visualization, it is recommended to turn on 'Scene Light' in the matlab figure (View => Camera Toolbar => Toggle Scene Light). Alternatively, lights can be enabled through the ''opt.customvis'' input field.
  
 {{:wrench_2.gif |}} {{:wrench_2.gif |}}
Line 30: Line 31:
 % Mark Naves % Mark Naves
 % m.naves@utwente.nl % m.naves@utwente.nl
-4-10-2017+6-14-2017
 %Just an example how to add cad data to spavisual %Just an example how to add cad data to spavisual
 % %
Line 40: Line 41:
  
 %% %%
-x_node = 5; %position node to follow () +x_node = 5; %position node 
-r_node = 6; %rotation node follow+r_node = 6; %rotation node
 Color = [162 195 214]./255; Color = [162 195 214]./255;
 Filename = 'cadfile'; Filename = 'cadfile';
Line 77: Line 78:
 </code> </code>
  
-An example of the input file for spacarlight is provided below+An example of the input file for spacarlight is provided bellow:
  
  
Line 103: Line 104:
 nprops(3).mass               = 0.074;        %0.74Kg at the center of mass nprops(3).mass               = 0.074;        %0.74Kg at the center of mass
 nprops(3).mominertia         = [ 0.00000398 0.00000252 0.0000000 0.00013376 0.00000000 0.00013739]; %Inertia at the center of mass nprops(3).mominertia         = [ 0.00000398 0.00000252 0.0000000 0.00013376 0.00000000 0.00013739]; %Inertia at the center of mass
-nprops(3).transfer_in = {'force_x'}; 
-nprops(3).transfer_out = 'displ_x'; 
  
  
Line 127: Line 126:
  
 %% SIMULATION %% SIMULATION
-opt.transfer=true; 
 opt.customvis = {'USERPLOT ADDCAD',... opt.customvis = {'USERPLOT ADDCAD',...
                  'AXISPROPS',...                  'AXISPROPS',...
cad_visualization.1529007323.txt.gz · Last modified: 2018/06/14 22:15 by mark.naves