Jump to content

joseamirandavelez

Members
  • Content Count

    2
  • Joined

  • Last visited

About joseamirandavelez

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  • Country
    Puerto Rico
  • Interests
    Robotics, programming, automation
  • Are you University user?
    No
  1. I need to create a mark of solids similarly to the "by box" option of the *createmark command. Unfortunately it does not support selecting solids... hm_getcog does not support solids either, so I cannot make my own procedure. Is there anything available to either create the mark or getting the solids COG/Centroid?
  2. Hi, I am making a big macro that basically hides and shows different FE models and geometries, re-orients the view, and take pictures. Since my models are cylindrical, I am taking square images by moving the model to the left side of the graphic window and saving only half of the window using hm_windowtofile. In order to move the model to the left I create some grids at certain distances from the model so that when I fit the view the model is put on the left, then I delete the temporary nodes. That's the only work around I found. My problem is that even after deleting the temporary nodes they appear in the photos. I even tried adding *nodecleartempmark to the beginning of my takePhoto procedure, but they still show. Sometimes I get stiff that is masked in the photo... If I run the macro line by line it works perfectly. It only happens when I run the macro from the script toolbar or menu. So I guess this must have to be some sort of screen update command I am missing. I tried to find any commands to update the screen in the API documentation but had no luck. Any ideas? Here is a shorter version of my macro: package require Img catch {namespace delete ::miranda } namespace eval ::miranda { } proc ::miranda::main {} { #photos are going to be stored here. Folder is created if it does not exist. set ::miranda::path "D:/model_images" catch {file mkdir $::miranda::path} catch {file attributes $::miranda::path -system} proc ::miranda::frontView {} { #get bound box for whole model *createmark elems 1 displayed set string [hm_getboundingbox elems 1 0 0 0] set xmin [lindex $string 0] set xmax [lindex $string 3] set ymin [lindex $string 1] set ymax [lindex $string 4] set zmin [lindex $string 2] set zmax [lindex $string 5] set width [hm_winfo graphicwidth] set height [hm_winfo graphicheight] set ratio [expr $width*1.0/$height] set height [expr $xmax-$xmin] set width [expr $height*$ratio] set emptySpace [expr ($width - ($ymax-$ymin))/4] *nodecleartempmark *view bottom *rotationangleset 90 hm_viewccw *createnode 0 [expr $width] 0 0 *createnode 0 [expr $ymin-$emptySpace/2] 0 0 *window 0 0 0 0 0 *nodecleartempmark } proc ::miranda::rearView {} { #get bound box for whole model *createmark elems 1 displayed set string [hm_getboundingbox elems 1 0 0 0] set xmin [lindex $string 0] set xmax [lindex $string 3] set ymin [lindex $string 1] set ymax [lindex $string 4] set zmin [lindex $string 2] set zmax [lindex $string 5] set width [hm_winfo graphicwidth] set height [hm_winfo graphicheight] set ratio [expr $width*1.0/$height] set height [expr $xmax-$xmin] set width [expr $height*$ratio] set emptySpace [expr ($width - ($ymax-$ymin))/4] *nodecleartempmark *view top *rotationangleset 90 hm_viewccw *createnode 0 [expr -1*$width] 0 0 *createnode 0 [expr $ymax+$emptySpace/2] 0 0 *window 0 0 0 0 0 *nodecleartempmark } proc ::miranda::takePhoto {filename} { *nodecleartempmark #Set graphics to color photos and white background *graphicsfilecolor 1 *graphicsfileblankbackground 1 #Take a photo catch {file delete -force $filename} hm_windowtofile [hm_winfo graphicx] [hm_winfo graphicy] [expr max([hm_winfo graphicwidth]/2-1,[hm_winfo graphicheight]-1)] [hm_winfo graphicheight] $filename } proc ::miranda::toggle {object subObject status} { switch $subObject { bdf {set e 1; set s 0;} solid {set e 0; set s 1;} both {set e 1; set s 1;} } foreach o $object { if { $status == on } { *createmark assem 1 $o *displaycollectorsallbymark 1 on $e $s *createmark assem 1 $o *displaycollectorsallbymark 1 off [expr ! $e] [expr ! $s] } elseif { $status == off } { *createmark assem 1 $o *displaycollectorsallbymark 1 off $e $s } } *unmaskall elements } } #set up procedures ::miranda::main #temporary file variables. Will be replaced by GUI. set xsectUG "path_to_File" set oldUG "path_to_File" set newUG "path_to_File" set oldBDF "path_to_File" set newBDF "path_to_File" # Old Geometry Plots ::miranda::toggle {oldModel newModel} both off ::miranda::toggle oldModel both on ::miranda::frontView ::miranda::toggle oldModel bdf off ::miranda::takePhoto "$::miranda::path/old_model_solid_front.jpg" ::miranda::toggle oldModel both on ::miranda::rearView ::miranda::toggle oldModel bdf off ::miranda::takePhoto "$::miranda::path/old_model_solid_rear.jpg" # New Geometry Plots ::miranda::toggle {oldModel newModel} both off ::miranda::toggle newModel both on ::miranda::frontView ::miranda::toggle newModel bdf off ::miranda::takePhoto "$::miranda::path/new_model_solid_front.jpg" ::miranda::toggle newModel both on ::miranda::rearView ::miranda::toggle newModel bdf off ::miranda::takePhoto "$::miranda::path/new_model_solid_rear.jpg" ##cleanup #::miranda::toggle newModel bdf on #::miranda::plotNormals 0 #::miranda::thicknessVisibility 0 #::miranda::elementColor components #::miranda::isoView front
×
×
  • Create New...