1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

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
This commit is contained in:
abv
2014-09-12 11:07:56 +04:00
committed by bugmaster
parent 0179bbc641
commit a347ef35b4
10 changed files with 88 additions and 6 deletions

3
samples/tcl/challenge.tcl → samples/tcl/cad.tcl Executable file → Normal file
View File

@@ -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

View 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

43
samples/tcl/xde.tcl Normal file
View File

@@ -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