]> OCCT Git - occt-copy.git/commitdiff
0025236: Sample DRAW script to demonstrate XDE features
authorabv <abv@opencascade.com>
Fri, 12 Sep 2014 07:07:56 +0000 (11:07 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 18 Sep 2014 10:30:08 +0000 (14:30 +0400)
New sample added for XDE; test cases added for this and some other samples; description of Tcl samples in Overview updated

dox/overview/overview.md
samples/tcl/cad.tcl [new file with mode: 0644]
samples/tcl/challenge.tcl [deleted file]
samples/tcl/raytrace.tcl
samples/tcl/xde.tcl [new file with mode: 0644]
tests/demo/samples/bottle
tests/demo/samples/cad [new file with mode: 0644]
tests/demo/samples/cutter [new file with mode: 0644]
tests/demo/samples/drill [new file with mode: 0644]
tests/demo/samples/materials [new file with mode: 0644]
tests/demo/samples/xde [new file with mode: 0644]

index a3506855507eaff552d6b163594d14ca57778473..899aca225af17f72b6b41c7a23e3018c2b32fe20 100644 (file)
@@ -512,11 +512,14 @@ Type pload ALL
   * DataExchangeDemo.tcl: demonstrates sample sequence of operations with writing and reading IGES file
   * ModelingDemo.tcl: demonstrates creation of simple shape and displaying it in HLR mode
   * VisualizationDemo.tcl: demonstrates use of 3d viewer
-  * challenge.tcl: creates solid shape looking like abbreviation "CAD"
+  * cad.tcl: creates solid shape looking like abbreviation "CAD"
   * bottle.tcl: creates bottle as in OCCT Tutorial
   * drill.tcl: creates twist drill bit shape
-  * mill.tcl: creates milling cutter shape
+  * cutter.tcl: creates milling cutter shape
+  * xde.tcl: demonstrates creation of simple assembly in XDE
+  * materials.tcl: demonstrates visual properties of materials supported by 3d viewer
   * raytrace.tcl: demonstrates use of ray tracing display in 3d viewer
+  * dimensions.tcl: demonstrates use of dimensions, clipping, and capping in 3d viewer
 
 **Getting Help**
 
diff --git a/samples/tcl/cad.tcl b/samples/tcl/cad.tcl
new file mode 100644 (file)
index 0000000..d6a5931
--- /dev/null
@@ -0,0 +1,62 @@
+# This script creates a model described at
+# http://www.caddd.org/2010/04/opencascade-challenge.html
+
+pload MODELING VISUALIZATION
+
+# make base 
+box b0 0  0 0 12 7 6
+explode b0 e
+blend b01 b0 1 b0_8
+blend b02 b01 1 b0_6
+
+# make cut at bottom
+box b1 3 -1 0 2 9 1.5
+bcut b2 b02 b1
+explode b2 e
+blend b3 b2 1 b2_27
+blend b4 b3 1 b2_30
+
+# make central cut
+box h1 3 -1 2.5 2 9 0.5
+box h2 3 -1 3 2 9 2
+plane p 4 -1 3 0 1 0
+pcylinder c p 1 9
+bcommon h3 h2 c
+bcut b5 b4 h1
+bcut b6 b5 h3
+
+# make side cut
+box b7 9 -1 1 2 9 4
+explode b7 e
+blend b71 b7 1 b7_6
+blend b72 b71 1 b7_8
+bcut b8 b6 b72
+
+# make box for inner cylindrical cut
+box bc1 -1 0 2 9 1 4
+box bc2 2 -1 2 4 3 3
+bcut bc3 bc1 bc2
+explode bc3 e
+blend bc4 bc3 1 bc3_20
+blend bc5 bc4 1 bc3_23
+blend bc6 bc5 1.99 bc3_21
+blend bc7 bc6 1.99 bc3_22
+
+# make inner cylindrical cut
+explode bc7 f
+revol r bc7_1 -1 0 6 1 0 0 100
+bcut b9 b8 r
+
+# make outer cylindrical cut
+plane p2 -1 0 6 1 0 0
+pcylinder c2 p2 6 15
+bcommon res b9 c2
+
+# show result
+donly res
+trotate res 0 0 0 0 0 1 90
+vinit
+vdisplay res
+vsetdispmode 1
+vshowfaceboundary res 1 255 255 255
+vfit
diff --git a/samples/tcl/challenge.tcl b/samples/tcl/challenge.tcl
deleted file mode 100755 (executable)
index a0fc65e..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# This script creates a model described at
-# http://www.caddd.org/2010/04/opencascade-challenge.html
-
-pload MODELING VISUALIZATION
-
-# make base 
-box b0 0  0 0 12 7 6
-explode b0 e
-blend b01 b0 1 b0_8
-blend b02 b01 1 b0_6
-
-# make cut at bottom
-box b1 3 -1 0 2 9 1.5
-bcut b2 b02 b1
-explode b2 e
-blend b3 b2 1 b2_27
-blend b4 b3 1 b2_30
-
-# make central cut
-box h1 3 -1 2.5 2 9 0.5
-box h2 3 -1 3 2 9 2
-plane p 4 -1 3 0 1 0
-pcylinder c p 1 9
-bcommon h3 h2 c
-bcut b5 b4 h1
-bcut b6 b5 h3
-
-# make side cut
-box b7 9 -1 1 2 9 4
-explode b7 e
-blend b71 b7 1 b7_6
-blend b72 b71 1 b7_8
-bcut b8 b6 b72
-
-# make box for inner cylindrical cut
-box bc1 -1 0 2 9 1 4
-box bc2 2 -1 2 4 3 3
-bcut bc3 bc1 bc2
-explode bc3 e
-blend bc4 bc3 1 bc3_20
-blend bc5 bc4 1 bc3_23
-blend bc6 bc5 1.99 bc3_21
-blend bc7 bc6 1.99 bc3_22
-
-# make inner cylindrical cut
-explode bc7 f
-revol r bc7_1 -1 0 6 1 0 0 100
-bcut b9 b8 r
-
-# make outer cylindrical cut
-plane p2 -1 0 6 1 0 0
-pcylinder c2 p2 6 15
-bcommon res b9 c2
-
-# show result
-donly res
-vinit
-vdisplay res
-vsetdispmode 1
-vfit
-
index f203a173b1cdc6026625f8eacdd14ab0805ca738..31ad19a6918a8ce4661c0d4d07f5e167d2be28f3 100644 (file)
@@ -1,4 +1,4 @@
-# Script reproducing creation of bottle model as described in OCCT Tutorial
+# Script demonstrating ray tracing in 3d view
 
 # make bottle by calling another script
 source [file join [file dirname [info script]] bottle.tcl]
@@ -12,6 +12,7 @@ bcut glass glass_out glass_in
 ttranslate glass -30 -30 0
 
 # show table and glass
+vinit w=1024 h=1024
 vsetmaterial bottle aluminium
 vdisplay table
 vsetmaterial table bronze
diff --git a/samples/tcl/xde.tcl b/samples/tcl/xde.tcl
new file mode 100644 (file)
index 0000000..0ec06a2
--- /dev/null
@@ -0,0 +1,43 @@
+# Simple sample demonstrating work with assemblies in XDE, and assignment of 
+# names and colors to components vs. instances
+
+pload MODELING
+pload OCAF
+pload XDE
+
+puts "Make a link as assembly made of a pin and two instances of the same nut"
+pcylinder pin 1 10
+pcylinder nut 2 2
+compound nut nut nuts
+explode nuts
+ttranslate nuts_1 0 0 7
+ttranslate nuts_2 0 0 1
+compound pin nuts_1 nuts_2 link
+
+puts "Add link assembly in XCAF document, and add names and colors:"
+NewDocument D XCAF
+XAddShape D link
+SetName D [XFindShape D pin] "Pin"
+SetName D [XFindShape D nut] "Nut"
+SetName D [XFindShape D link] "Link"
+SetName D [XFindShape D link]:1 "Pin instance"
+SetName D [XFindShape D link]:2 "Nut instance 1"
+SetName D [XFindShape D link]:3 "Nut instance 2"
+
+puts "- Pin will be white"
+XSetColor D [XFindShape D pin] 1 1 1
+puts "- Nut itself will be dark gray"
+XSetColor D [XFindShape D nut] 0.1 0.1 0.1
+puts "- Nut instance #1 will be red"
+XSetColor D [XFindShape D link]:2 1 0 0
+puts "- Nut instance #2 will be green"
+XSetColor D [XFindShape D link]:3 0 1 0
+
+puts "Starting DF browser..."
+DFBrowse D
+puts "Expand the document tree to see its structure and assigned names"
+
+puts "Showing assembly in 3d view..."
+XShow D
+vfit
+vsetdispmode 1
index da284e662db9e58d00d9bf2dc98d58dbb1a8da9b..e61d00df3683b668295ed49bbe27e2eec5f4e392 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO ?OCC24130 Windows: TKOpenGl | Type\: Error | ID\: 0 | Severity\: High | Message\:"
-
 # test for creation of bottle as in tutorial (script is in samples)
 source $env(CASROOT)/samples/tcl/bottle.tcl
 
diff --git a/tests/demo/samples/cad b/tests/demo/samples/cad
new file mode 100644 (file)
index 0000000..a2ec5f6
--- /dev/null
@@ -0,0 +1,8 @@
+# test for generating funny shape 
+source $env(CASROOT)/samples/tcl/cad.tcl
+
+# check shape validity and make a snapshot
+checkshape res
+vdump $imagedir/${test_image}.png
+
+puts "TEST COMPLETED"
diff --git a/tests/demo/samples/cutter b/tests/demo/samples/cutter
new file mode 100644 (file)
index 0000000..3549d1c
--- /dev/null
@@ -0,0 +1,7 @@
+# test for creation of cutter shape
+source $env(CASROOT)/samples/tcl/cutter.tcl
+
+# make a snapshot
+vdump $imagedir/${test_image}.png
+
+puts "TEST COMPLETED"
diff --git a/tests/demo/samples/drill b/tests/demo/samples/drill
new file mode 100644 (file)
index 0000000..02eb211
--- /dev/null
@@ -0,0 +1,7 @@
+# test for creation of drill shape
+source $env(CASROOT)/samples/tcl/drill.tcl
+
+# make a snapshot
+vdump $imagedir/${test_image}.png
+
+puts "TEST COMPLETED"
diff --git a/tests/demo/samples/materials b/tests/demo/samples/materials
new file mode 100644 (file)
index 0000000..7ef5cda
--- /dev/null
@@ -0,0 +1,7 @@
+# test for visual properties of materials in 3d viewer
+source $env(CASROOT)/samples/tcl/materials.tcl
+
+# make a snapshot
+vdump $imagedir/${test_image}.png
+
+puts "TEST COMPLETED"
diff --git a/tests/demo/samples/xde b/tests/demo/samples/xde
new file mode 100644 (file)
index 0000000..72c2d74
--- /dev/null
@@ -0,0 +1,7 @@
+# test for XDE sample
+source $env(CASROOT)/samples/tcl/xde.tcl
+
+# make a snapshot
+vdump $imagedir/${test_image}.png
+
+puts "TEST COMPLETED"