This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cad_visualization [2018/06/14 22:12] mark.naves |
cad_visualization [2018/06/14 22:23] 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' | + | 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' |
- | For adding the .STL geometry to Spavisual in Spacarlight, | + | For adding the .STL geometry to Spavisual in Spacarlight, |
<code matlab> | <code matlab> | ||
opt.customvis = {' | opt.customvis = {' | ||
Line 17: | Line 17: | ||
</ | </ | ||
- | + | Bellow, an example is provided for the ADDCAD | |
- | + | ||
- | + | ||
- | Bellow, an example is provided for this function. In this example, the geometry is projected on translation node 5 and rotation node 6 (note the used node numbering correspond to the node numbering in the .dat file, which can deviate from the numbering in the Spacarlight input field). Furthermore, | + | |
Notes: | Notes: | ||
* the function stl2fv is used for converting .STL geometry to vertices and faces. This function can be found on mathworks and downloaded from http:// | * the function stl2fv is used for converting .STL geometry to vertices and faces. This function can be found on mathworks and downloaded from http:// | ||
* 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 | + | * Converting .STL data to vertices and faces can take a long time (the stl2fv function). To improve speed, the variables |
+ | * For good visualization, | ||
+ | {{: | ||
<code matlab ADDCAD.m> | <code matlab ADDCAD.m> | ||
Line 32: | 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 42: | 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 = ' | Filename = ' | ||
Line 79: | Line 78: | ||
</ | </ | ||
- | An example of the input file for spacarlight is provided | + | An example of the input file for spacarlight is provided |
Line 105: | Line 104: | ||
nprops(3).mass | nprops(3).mass | ||
nprops(3).mominertia | nprops(3).mominertia | ||
- | nprops(3).transfer_in = {' | ||
- | nprops(3).transfer_out = ' | ||
Line 129: | Line 126: | ||
%% SIMULATION | %% SIMULATION | ||
- | opt.transfer=true; | ||
opt.customvis = {' | opt.customvis = {' | ||
' | ' |