Changeset 5635 for trunk/gui/scripts
- Timestamp:
- May 29, 2015, 7:24:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/mesh.tcl
r5633 r5635 540 540 set numCoords [$all length] 541 541 if { [info exists zNum] } { 542 if { ![info exists yNum] || ![info exists xNum] } { 543 puts stderr "WARNING: bad grid \"$path\": missing grid dimension" 544 blt::vector destroy $all $xv $yv $zv 545 return 0 546 } 542 547 set _dim 3 543 548 set _numPoints [expr $xNum * $yNum * $zNum] … … 545 550 if { ($_numPoints*3) != $numCoords } { 546 551 puts stderr "WARNING: bad grid \"$path\": invalid grid: \# of points does not match dimensions <xdim> * <ydim> * <zdim>" 552 blt::vector destroy $all $xv $yv $zv 547 553 return 0 548 554 } 549 555 if { ($numCoords % 3) != 0 } { 550 556 puts stderr "WARNING: bad grid \"$path\": wrong \# of coordinates for 3D grid" 557 blt::vector destroy $all $xv $yv $zv 551 558 return 0 552 559 } … … 559 566 append out "DIMENSIONS $xNum $yNum $zNum\n" 560 567 append out "POINTS $_numPoints double\n" 561 append out [$all range 0 end] 562 append out "\n" 568 foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] { 569 append out "$x $y $z\n" 570 } 563 571 set _vtkdata $out 564 572 } elseif { [info exists yNum] } { 573 if { ![info exists xNum] } { 574 puts stderr "WARNING: bad grid \"$path\": missing grid dimension" 575 blt::vector destroy $all $xv $yv $zv 576 return 0 577 } 565 578 set _dim 2 566 579 set _numPoints [expr $xNum * $yNum] … … 568 581 if { ($_numPoints*2) != $numCoords } { 569 582 puts stderr "WARNING: bad grid \"$path\": \# of points does not match dimensions <xdim> * <ydim>" 583 blt::vector destroy $all $xv $yv $zv 570 584 return 0 571 585 } 572 586 if { ($numCoords % 2) != 0 } { 573 587 puts stderr "WARNING: bad grid \"$path\": wrong \# of coordinates for 2D grid" 588 blt::vector destroy $all $xv $yv $zv 574 589 return 0 575 590 } 591 $all split $xv $yv 576 592 foreach axis {x y} { 577 593 set vector [set ${axis}v] … … 584 600 append out "DIMENSIONS $xNum $yNum 1\n" 585 601 append out "POINTS $_numPoints double\n" 586 append out [$all range 0 end] 587 append out "\n" 602 foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] { 603 append out "$x $y $z\n" 604 } 588 605 set _vtkdata $out 589 606 } else { … … 593 610 if { $_numPoints != $numCoords } { 594 611 puts stderr "WARNING: bad grid \"$path\": \# of points does not match <xdim>" 612 blt::vector destroy $all $xv $yv $zv 595 613 return 0 596 614 } 615 $all dup $xv 597 616 set _limits(x) [$xv limits] 598 617 set _limits(y) [list 0 0] … … 604 623 append out "DIMENSIONS $xNum 1 1\n" 605 624 append out "POINTS $_numPoints double\n" 606 append out [$all range 0 end] 607 append out "\n" 625 foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] { 626 append out "$x $y $z\n" 627 } 608 628 set _vtkdata $out 609 629 }
Note: See TracChangeset
for help on using the changeset viewer.