[37] | 1 | |
---|
| 2 | proc usage args { |
---|
| 3 | puts "" |
---|
| 4 | puts "Usage: vripnew <vrip_file> <conf_file> <bound_mesh> <res_in_meters>" |
---|
| 5 | puts " \[options\]" |
---|
| 6 | puts "" |
---|
| 7 | puts " Options:" |
---|
| 8 | puts " -carve_conservative" |
---|
| 9 | puts " -carve_agressive" |
---|
| 10 | puts " -carve_only" |
---|
| 11 | puts " -show_render" |
---|
| 12 | puts " -persp" |
---|
| 13 | puts " -linepersp" |
---|
| 14 | puts " -slicer" |
---|
| 15 | puts " -use_bigger_bbox" |
---|
| 16 | puts " -rampscale <scale factor>" |
---|
| 17 | puts " -ramplength <length>" |
---|
| 18 | puts " Note: options *must* be the last args." |
---|
| 19 | puts "" |
---|
| 20 | exit |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | # Print usage if necessary... |
---|
| 24 | if {$argc == 0 || [lindex $argv 0] == "-h"} { |
---|
| 25 | usage |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | vrip_param -quiet 1 |
---|
| 30 | |
---|
| 31 | set gridName [lindex $argv 0] |
---|
| 32 | set confFile [lindex $argv 1] |
---|
| 33 | set boundMesh [lindex $argv 2] |
---|
| 34 | set voxelSize [lindex $argv 3] |
---|
| 35 | set doChangeScale 0 |
---|
| 36 | set haveRampLength 0 |
---|
| 37 | |
---|
| 38 | #set voxelSize [expr $voxelSize/1000.0] |
---|
| 39 | |
---|
| 40 | # Sanity checks on the arguments to avoid obscure messages later |
---|
| 41 | if {[llength $argv] < 4} { |
---|
| 42 | puts stderr "Error: Insufficient arguments" |
---|
| 43 | usage |
---|
| 44 | } |
---|
| 45 | if {![file isfile $confFile]} { |
---|
| 46 | puts stderr "Error: Could not open conf file: $confFile" |
---|
| 47 | usage |
---|
| 48 | } |
---|
| 49 | if {![file isfile $boundMesh]} { |
---|
| 50 | puts stderr "Error: Could not open bound file: $boundMesh" |
---|
| 51 | usage |
---|
| 52 | } |
---|
| 53 | if {$voxelSize <= 0} { |
---|
| 54 | puts stderr "Error: voxelSize must be greater than zero" |
---|
| 55 | usage |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | set bmeshCmd bmesh |
---|
| 60 | set warp 0 |
---|
| 61 | |
---|
| 62 | if {$argc > 4} { |
---|
| 63 | for {set i 4} {$i < $argc} {incr i} { |
---|
| 64 | set arg [lindex $argv $i] |
---|
| 65 | if {$arg == "-carve_conservative"} { |
---|
| 66 | vrip_param -use_tails 1 |
---|
| 67 | } elseif {$arg == "-carve_agressive"} { |
---|
| 68 | vrip_param -use_tails 1 -fill_gaps 1 |
---|
| 69 | } elseif {$arg == "-rampscale"} { |
---|
| 70 | incr i |
---|
| 71 | set scaleFactor [lindex $argv $i] |
---|
| 72 | set doChangeScale 1 |
---|
| 73 | } elseif {$arg == "-ramplength"} { |
---|
| 74 | incr i |
---|
| 75 | set RampLength [lindex $argv $i] |
---|
| 76 | set haveRampLength 1 |
---|
| 77 | } elseif {$arg == "-use_bigger_bbox"} { |
---|
| 78 | set conservativeBbox 1 |
---|
| 79 | } elseif {$arg == "-carve_semi"} { |
---|
| 80 | vrip_param -use_tails 1 |
---|
| 81 | param -maxedge 0.01 |
---|
| 82 | } elseif {$arg == "-carve_only"} { |
---|
| 83 | vrip_param -use_tails 1 -tails_only 1 |
---|
| 84 | } elseif {$arg == "-show_render"} { |
---|
| 85 | show_render |
---|
| 86 | } elseif {$arg == "-slicer"} { |
---|
| 87 | slicer |
---|
| 88 | } elseif {$arg == "-linepersp"} { |
---|
| 89 | set bmeshCmd bmeshlin |
---|
| 90 | } elseif {$arg == "-persp"} { |
---|
| 91 | set bmeshCmd bmeshp |
---|
| 92 | } elseif {$arg == "-stzoom"} { |
---|
| 93 | incr i |
---|
| 94 | set arg [lindex $argv $i] |
---|
| 95 | set CywarpSTZoom $arg |
---|
| 96 | set warp 1 |
---|
| 97 | } elseif {$arg == "-yzoom"} { |
---|
| 98 | incr i |
---|
| 99 | set arg [lindex $argv $i] |
---|
| 100 | set CywarpYZoom $arg |
---|
| 101 | set warp 1 |
---|
| 102 | } elseif {$arg == "-wangle"} { |
---|
| 103 | incr i |
---|
| 104 | set arg [lindex $argv $i] |
---|
| 105 | set CywarpAngle $arg |
---|
| 106 | set warp 1 |
---|
| 107 | } |
---|
| 108 | } |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | if {$warp} { |
---|
| 112 | set bmeshCmd "${bmeshCmd}warp" |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | if {$bmeshCmd != "bmesh"} { |
---|
| 116 | alias bmesh $bmeshCmd |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | update |
---|
| 120 | |
---|
| 121 | if {[info exists resToScaleMap($voxelSize)]} { |
---|
| 122 | changeRampScale $resToScaleMap($voxelSize) |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | if {$doChangeScale} { |
---|
| 126 | changeRampScale $scaleFactor |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | if {$haveRampLength} { |
---|
| 130 | vrip_param -ramp_width $RampLength |
---|
| 131 | vrip_param -w1 [expr $RampLength * 1.5] |
---|
| 132 | vrip_param -w2 [expr $RampLength * 1.25] |
---|
| 133 | vrip_param -w3 [expr $RampLength * -0.5] |
---|
| 134 | vrip_param -w4 [expr $RampLength * -0.75] |
---|
| 135 | vrip_param -w5 [expr $RampLength * -1.0] |
---|
| 136 | set boundary [expr int(3 * ($RampLength / $voxelSize + 1))] |
---|
| 137 | vrip_param -max_boundary_steps $boundary |
---|
| 138 | puts "Using ramps of length $RampLength, with $boundary boundary steps" |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | newFromConf $gridName $confFile $boundMesh $voxelSize |
---|
| 142 | |
---|
| 143 | exit |
---|
| 144 | |
---|