From a347ef35b42408298f5a41c9292a7a53e84c411d Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 12 Sep 2014 11:07:56 +0400 Subject: [PATCH] 0025236: Sample DRAW script to demonstrate XDE features 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 | 7 +++-- samples/tcl/{challenge.tcl => cad.tcl} | 3 +- samples/tcl/raytrace.tcl | 3 +- samples/tcl/xde.tcl | 43 ++++++++++++++++++++++++++ tests/demo/samples/bottle | 2 -- tests/demo/samples/cad | 8 +++++ tests/demo/samples/cutter | 7 +++++ tests/demo/samples/drill | 7 +++++ tests/demo/samples/materials | 7 +++++ tests/demo/samples/xde | 7 +++++ 10 files changed, 88 insertions(+), 6 deletions(-) rename samples/tcl/{challenge.tcl => cad.tcl} (94%) mode change 100755 => 100644 create mode 100644 samples/tcl/xde.tcl create mode 100644 tests/demo/samples/cad create mode 100644 tests/demo/samples/cutter create mode 100644 tests/demo/samples/drill create mode 100644 tests/demo/samples/materials create mode 100644 tests/demo/samples/xde diff --git a/dox/overview/overview.md b/dox/overview/overview.md index a350685550..899aca225a 100644 --- a/dox/overview/overview.md +++ b/dox/overview/overview.md @@ -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/challenge.tcl b/samples/tcl/cad.tcl old mode 100755 new mode 100644 similarity index 94% rename from samples/tcl/challenge.tcl rename to samples/tcl/cad.tcl index a0fc65e787..d6a5931b84 --- a/samples/tcl/challenge.tcl +++ b/samples/tcl/cad.tcl @@ -54,8 +54,9 @@ 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/raytrace.tcl b/samples/tcl/raytrace.tcl index f203a173b1..31ad19a691 100644 --- a/samples/tcl/raytrace.tcl +++ b/samples/tcl/raytrace.tcl @@ -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 index 0000000000..0ec06a2fa8 --- /dev/null +++ b/samples/tcl/xde.tcl @@ -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 diff --git a/tests/demo/samples/bottle b/tests/demo/samples/bottle index da284e662d..e61d00df36 100644 --- a/tests/demo/samples/bottle +++ b/tests/demo/samples/bottle @@ -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 index 0000000000..a2ec5f68bd --- /dev/null +++ b/tests/demo/samples/cad @@ -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 index 0000000000..3549d1cc9a --- /dev/null +++ b/tests/demo/samples/cutter @@ -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 index 0000000000..02eb21122c --- /dev/null +++ b/tests/demo/samples/drill @@ -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 index 0000000000..7ef5cda061 --- /dev/null +++ b/tests/demo/samples/materials @@ -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 index 0000000000..72c2d74002 --- /dev/null +++ b/tests/demo/samples/xde @@ -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"