Jump to content

Search the Community

Showing results for tags 'tclscript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Altair Support Forum
    • Welcome to Altair Support Forum
    • Installation and Licensing
    • Modeling (Preprocessing)
    • Analysis (Solvers)
    • Optimization and Design Exploration
    • Visualization (Postprocessing)
    • Model Based Development
    • Conceptual design and Industrial design
    • Manufacturing Simulation
    • CAE Process Automation
  • Academic Partner Alliance Forum
    • APA - Composites
    • APA - CFD & Thermal
    • APA - Vehicle Dynamics
    • APA - Manufacturing
    • APA - Crash and Safety
    • APA - Noise, Vibration and Harshness
    • APA - System Level Design
    • APA - Structural and Fatigue
    • APA - Marine
  • Forum for India Academic Users and AOC India Participants
    • India EDU Installation FAQ
    • India EDU Modeling and Visualisation
    • India EDU Linear, Non-Linear Solver ( Implicit/Explicit)
    • India EDU Multi-Body Dynamics
    • India EDU CFD
    • India EDU Optimisation
    • India EDU Report Generation
  • Solver Forum for India Commercial Users
    • IND - OptiStruct for Linear & Non-Linear Implicit
    • IND - OptiStruct & HyperStudy for Optimisation
    • IND - RADIOSS for Impact Safety & Non-Linear Explicit Applications
    • IND - MotionSolve for Multi-Body Dynamics
    • IND - HyperWorks CFD forum
    • IND - FEKO, Winprop & Flux
  • Forum for our Australia and New Zealand Based Users
    • ANZ - HyperWorks
    • ANZ - Electromagnetics
    • ANZ - HPC (PBS)
  • Japanユーザーフォーラム
    • ユーザーフォーラムへようこそ
    • インストールとライセンス
    • モデリング(プリプロセッシング)
    • シミュレーション技術(ソルバー)
    • データ可視化(ポストプロセッシング)
    • モデルベース開発
    • コンセプト設計と工業デザイン
    • 製造シミュレーション
    • CAE プロセスの自動化

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Interests

Found 1 result

  1. Hello all, This is my first post on the forum. I'm trying to do some scripting in order to automate some actions that we do quite frequently. I'm new to the TCL language and programming in general, so please forgive me if I'm making beginners mistakes. For this script I'm trying to add a note with a predefined text and layout to a selected element. I started by editing a few scripts that I found on the exchange. I've managed to attach the note to a hard-coded element, so the next step is to attach the note to a selected element and that's where I get stuck. I should be able to pass the selected elements on to the note handler, but I'm not able to do that. This is what I've come up with so far: namespace eval ::hw::post::Company { } proc ::hw::post::Company::BuildInitialUI {} { variable m_strFileName; variable panelPost; if { [ post panel get frame "addNoteStress" ] == "" } { set panelPost [ post panel add "addNoteStress"]; } if {[winfo exists $panelPost.f1] == 0} { set top [frame $panelPost.f1 -bd 0 ]; grid rowconfigure $panelPost 0 -weight 1; grid columnconfigure $panelPost 0 -weight 1; grid rowconfigure $top 3 -weight 1; grid columnconfigure $top 2 -weight 1; grid $top -row 0 -column 0 -sticky news -padx 0 -padx 4; set frm_mainFrame [frame $top.frm_mainFrame]; pack $frm_mainFrame -anchor nw -fill both -expand 1 -padx 5 -pady 5; # Pack the main frame ::hwt::AddPadding $frm_mainFrame -height 5; label $frm_mainFrame.lbl -text "Selection:"; pack $frm_mainFrame.lbl -side top -anchor n -padx 5 -pady 5; set ::hw::post::Company::elemCol [ post::Collector $frm_mainFrame.entCol entity "vecEntCol" ::post::SelectionSetCollector \ -notifyFunc ::hw::post::Company::NotifyFuncForElemCol \ -withreset 1 \ -text "Elements" \ -types "Elements"]; pack $frm_mainFrame.lbl $frm_mainFrame.entCol -side left -anchor w -padx 5; focus -force $frm_mainFrame.entCol.colContainer.collectorButton; set n_width [::hwt::DluWidth 55]; set n_height [::hwt::DluHeight 14]; set frm_actionFrame [frame $top.frm_actionFrame]; pack $frm_actionFrame -anchor nw -fill both -expand 1 -padx 5 -pady 5; set btnCreate [::hwt::CanvasButton $frm_actionFrame.btnCreate $n_width $n_height \ -text "Create" \ -takefocus 1 \ -help "Create a note" \ -command "::hw::post::Company::CreateNote" ]; set btnClose [::hwt::CanvasButton $frm_actionFrame.btnClose $n_width $n_height \ -text "Close" \ -takefocus 1 \ -help "Close the toplevel" \ -command "::hw::post::Company::CloseUI" ]; pack $btnCreate $btnClose -side left -anchor w -padx 5; } post panel draw "addNoteStress"; } proc ::hw::post::Company::NotifyFuncForElemCol {type id args} { variable elemCol; ::hw::post::Company::OnMultipleEntityColSel $elemCol [namespace current]::lst_elemsFromElemCol $type $id $args ::hw::post::Company::CreateNote $elemCol [namespace current]::lst_elemsFromElemCol $type $id $args } proc ::hw::post::Company::GetEntitiesFromSelectionSetCol {str_compCol} { set t [::hw::GetT] hwi OpenStack; set compCol $str_compCol ::post::GetActiveModelHandle modHandle$t; set selSetId [$compCol cget -id]; if { $selSetId != "ElemEntCol"} { modHandle$t GetSelectionSetHandle selSetHandle$t $selSetId selSetHandle$t SetSelectMode all; set lst_entityList [selSetHandle$t GetList]; if {[catch {set lst_elemsList [selSetHandle$t GetList]} error]} { #tk_messageBox -message "$error - unable to create selection set handle to get selected entities." -icon error -title "IIHS"; hwi CloseStack; return 0; } selSetHandle$t Clear; selSetHandle$t ReleaseHandle; modHandle$t ReleaseHandle hwi CloseStack; return $lst_entityList; } else { #tk_messageBox -message "Unable to create selection set handle to get selected entities." -icon error -title "IIHS"; #hwi ReleaseAllHandles; modHandle$t ReleaseHandle; hwi CloseStack; return -1; } #hwi ReleaseAllHandles; modHandle$t ReleaseHandle; hwi CloseStack; return -1; } proc ::hw::post::Company::OnMultipleEntityColSel {col lst_entitiesVar type id args } { if { ![::post::IsModelLoaded] } { return } #puts "$col-- $lst_entitiesVar -- $type -- $id -- $args" if { $type == "update" } { #Apply; ::post::ShowSetStatisticsInExtendedSelectionPanel [$col cget -id]; set lst_entity [::hw::post::Company::GetEntitiesFromSelectionSetCol $col]; foreach ent $lst_entity { if {[lsearch -exact [set $lst_entitiesVar] $ent] == -1} { lappend [set lst_entitiesVar] $ent; } } #set $lst_entitiesVar [lsort -unique [join [set $lst_entitiesVar]]]; return; } if { $type == "update_id" } { # update collector id $col configure -id $id; # enable id visibility hwi OpenStack; set t [::post::GetT]; ::post::GetActiveModelHandle m$t; m$t GetSelectionSetHandle s$t $id; s$t SetIDVisibility true; hwi CloseStack; ::post::ShowSetStatisticsInExtendedSelectionPanel $id; set $lst_entitiesVar ""; return; } if { $type == "update_selection" } { ::post::_Draw; ::post::ShowSetStatisticsInExtendedSelectionPanel [$col cget -id]; # set $lst_entitiesVar ""; return; } if {$type == "type_change" } { #CreateCheckBoxes return; } if { $type == "quick_window_select" } { #Apply; # re-activate regular window picking if it was active ::post::ReactivateByWindowSelection $col; return; } if { $type == "quick_window_menu" } { # pop up the quick window options ::post::postBuildQuickWindowMenu; # re-activate regular window picking if it was active ::post::ReactivateByWindowSelection $col; } } proc ::hw::post::Company::CreateNote {} { #::hw::post::Company:GetEntitiesFromSelectionSetCol::str_compCol set t [::hw::GetT] hwi OpenStack; #set compCol $::hw::post::Company:GetEntitiesFromSelectionSetCol::lst_entityList ::post::GetActiveModelHandle modHandle$t; #set selSetId [$compCol cget -id]; if { $selSetId != "ElemEntCol"} { modHandle$t GetSelectionSetHandle selSetHandle$t $selSetId selSetHandle$t SetSelectMode all; set lst_entityList [selSetHandle$t GetList]; if {[catch {set lst_elemsList [selSetHandle$t GetList]} error]} { #tk_messageBox -message "$error - unable to create selection set handle to get selected entities." -icon error -title "IIHS"; hwi CloseStack; return 0; } selSetHandle$t Clear; selSetHandle$t ReleaseHandle; modHandle$t ReleaseHandle hwi CloseStack; return $lst_entityList; } else { #tk_messageBox -message "Unable to create selection set handle to get selected entities." -icon error -title "IIHS"; #hwi ReleaseAllHandles; modHandle$t ReleaseHandle; hwi CloseStack; return -1; } #hwi ReleaseAllHandles; modHandle$t ReleaseHandle; hwi CloseStack; return -1; set elemIDsare $lst_entityList foreach el_id $elemIDsare { ::post::GetPostHandle pst$t set nid [pst$t AddNote] pst$t GetNoteHandle n$t $nid n$t SetAttachment "element $el_id" n$t SetPositionToAttachment false n$t SetText "Element ID: {entity.id} \n{entity.contour_val,%.2f} MPa" n$t SetTransparency false n$t SetBackgroundColor "255 255 255" n$t SetColor "0 0 0" n$t SetTextColor "0 0 0" n$t ReleaseHandle pst$t ReleaseHandle ::post::Draw } } proc ::hw::post::Company::CloseUI {} { if { [winfo exists .postPanel.addNoteStress] } { # Destroy the panel catch {destroy .postPanel.addNoteStress} strError; } } ::hw::post::Company::BuildInitialUI I'd appreciate all help and feedback. Thank you! Best regards, Ruben
×