distCAD Viewer

Author: Matthias Krüger


Parameter description

Parameter Value Description Default Remark
model file Name File to display, relative to applet's path (*.txt, *.wrl) 2 triangles required
bgcolor #RRGGBB background color Applet's bgcolor optional
color #RRGGBB surface color #3EAF2E optional
startangle aaa bbb ccc a-, b- and c-angle [0..380°] rotate the model at first 0 0 0 optional
turnspeed aaa bbb ccc a-, b- and c-speed [0..380°/s] 48 38 1 optional
shift xxx yyy x- and y-shift [-500..+500 pixel] auto Centering optional
zoom zzz ppp z: [pixel/model-unit] p: perspective [0..1] all (auto Zoom) optional
turn 0 or 1 switch turn off or on 1 optional
bonds 0 or 1 switch bonds off or on 1 optional
surfaces 0 or 1 switch surfaces off or on 0 optional
scansurfaces 0 or 1 scan surfaces in lattice model 0 optional

Here are some examples:

Example HTML-Code
<applet code="distCADViewer"archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
</applet>
<applet code="distCADViewer"archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="bonds" value="0">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="surfaces" value="1">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#000000">
<param name="surfaces" value="1">
<param name="color" value="#DDDD00">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="turn" value="0">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="turn" value="0">
<param name="startangle" value="10 5 0">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="turnspeed" value="10 5 0">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="shift" value="50 20">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Tedrahedron.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="zoom" value="20 0">
</applet>
<applet code="distCADViewer" archive="distCADViewerApplet.jar" width="100" height="100">
<param name="model" value="Test.txt">
<param name="bgcolor" value="#E9E6DA">
<param name="surfaces" value="1">
<param name="scansurfaces" value="1">
</applet>

Here is the file with the model data:

Test.txt

;4 corners
0.500 -0.289 -0.203
-0.500 -0.289 -0.203
0.000 0.577 -0.203
0.000 0.000 0.612
;0 bonds
;1 surfaces
1 2 3
 

 


Scripting description

Since version 2.0 you can change every parameter with the function:

setParameter(String name, String value);

Here are one example:

Example HTML-Code

select color:

red, green, orange, blue

scansurfaces
select model:
<applet name="viewer" archive="distCADViewerApplet.jar" code="distCADViewer.class"  ... MAYSCRIPT>
<param name="model" value="Test.txt"> ...
</applet>
...
<a href="javascript:document.viewer.setParameter('color','%23DD0000')" style="color:#DD0000">red</a>
...
<select name="sel" onChange="document.viewer.setParameter('model',sel.options[sel.selectedIndex].value)"
<option selected value="Test.txt">Tedrahedron</option>
<option value="models/rhombicuboctahedron.wrl">VRML-File</option> ...
</select>