All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: To create a GUI for all the final checks Objective: To create buttons to delete displayed geometric entities, delete empty entities, re-order and re-number entities by name and also create a master button in red that will execute all the above operations. Code: set a .window catch {destroy…
Akash M
updated on 26 Nov 2021
Aim:
To create a GUI for all the final checks
Objective:
To create buttons to delete displayed geometric entities, delete empty entities, re-order and re-number entities by name and also create a master button in red that will execute all the above operations.
Code:
set a .window
catch {destroy $a}
toplevel $a -class TopLevel
wm title $a "Final Check"
wm geometry $a 500x650+100+50; update
wm resizable $a 0 0
wm deiconify $a
label $a.01 -text "Delete Geometric entities" -bg grey -font {times 10 bold}; place $a.01 -x 20 -y 20 -width 450 -height 50
button $a.02 -text "Delete Solids" -command "delete solids" -bg white -font {times 10 bold}; place $a.02 -x 20 -y 80 -width 200 -height 30
button $a.03 -text "Delete Surfaces" -command "delete surfaces" -bg white -font {times 10 bold}; place $a.03 -x 250 -y 80 -width 200 -height 30
button $a.04 -text "Delete Points" -command "delete points" -bg white -font {times 10 bold}; place $a.04 -x 20 -y 120 -width 200 -height 30
button $a.05 -text "Delete Lines" -command "delete lines" -bg white -font {times 10 bold}; place $a.05 -x 250 -y 120 -width 200 -height 30
proc delete {a} {
*createmark $a 1 "displayed"
if {[hm_marklength $a 1] !=0} {*deletemark $a 1}
}
label $a.06 -text "Delete Empty and unused entities" -bg grey -font {times 10 bold}; place $a.06 -x 20 -y 160 -width 450 -height 50
button $a.07 -text "Delete Assemblies" -command "empty assemblies" -bg white -font {times 10 bold}; place $a.07 -x 20 -y 220 -width 200 -height 30
button $a.08 -text "Delete Components" -command "empty components" -bg white -font {times 10 bold}; place $a.08 -x 250 -y 220 -width 200 -height 30
button $a.09 -text "Delete Materials" -command "unused materials" -bg white -font {times 10 bold}; place $a.09 -x 20 -y 260 -width 200 -height 30
button $a.10 -text "Delete Properties" -command "unused properties" -bg white -font {times 10 bold}; place $a.10 -x 250 -y 260 -width 200 -height 30
proc empty {b} {
*EntityPreviewEmpty $b 1
if {[hm_marklength $b 1] !=0} {*deletemark $b 1}
}
proc unused {c} {
*EntityPreviewUnused $c 1
if {[hm_marklength $c 1] !=0} {*deletemark $c 1}
}
label $a.11 -text "Re-order and Re-number entities" -bg grey -font {times 10 bold}; place $a.11 -x 20 -y 300 -width 450 -height 50
button $a.12 -text "Reorder Assemblies" -command "reorder assemblies" -bg white -font {times 10 bold}; place $a.12 -x 20 -y 360 -width 200 -height 30
button $a.13 -text "Reorder Components" -command "reorder components" -bg white -font {times 10 bold}; place $a.13 -x 250 -y 360 -width 200 -height 30
button $a.14 -text "Reorder Materials" -command "reorder materials" -bg white -font {times 10 bold}; place $a.14 -x 20 -y 400 -width 200 -height 30
button $a.15 -text "Reorder Properties" -command "reorder properties" -bg white -font {times 10 bold}; place $a.15 -x 250 -y 400 -width 200 -height 30
proc reorder {d} {
*createmark $d 1 "all"
if {[hm_marklength $d 1] !=0} {*collectormarkmove $d 1 1 1}
}
button $a.16 -text "Renumber Assemblies" -command "renumber assemblies" -bg white -font {times 10 bold}; place $a.16 -x 20 -y 440 -width 200 -height 30
button $a.17 -text "Renumber Components" -command "renumber components" -bg white -font {times 10 bold}; place $a.17 -x 250 -y 440 -width 200 -height 30
button $a.18 -text "Renumber Materials" -command "renumber materials" -bg white -font {times 10 bold}; place $a.18 -x 20 -y 480 -width 200 -height 30
button $a.19 -text "Renumber Properties" -command "renumber properties" -bg white -font {times 10 bold}; place $a.19 -x 250 -y 480 -width 200 -height 30
proc renumber {e} {
*createmark $e 1 "all"
if {[hm_marklength $e 1] !=0} {*renumbersolverid components 1 1 1 0 0 0 0 0}
}
button $a.20 -text "MASTER" -command "master" -bg red -font {times 15 bold}; place $a.20 -x 150 -y 520 -width 150 -height 50
proc master {} {
delete solids
delete surfaces
delete points
delete lines
empty assemblies
empty components
unused materials
unused properties
reorder assemblies
reorder components
reorder materials
reorder properties
renumber assemblies
renumber components
renumber materials
renumber properties
}
Procedure and code explanation:
Open notepad++ and create a dummy.tcl file
set a .window is the command. .window is the window name or path by which it will be referred saved in.
catch {destroy $a} is the command where catch is used to hide errors and destroy is used to close any previously existing window by same name.
toplevel $a -class TopLevel is the command that builds the window.
wm title $a "Final Check" is the command that is used to create title of the window.
wm geometry $a 500x650+100+50 is the command that is used to create dimension of the window. 500x650 is width and height of the window. +100+50 is the origin of the hypermesh window where the windoe shoud be placed.
wm resizable $a 0 0 is the command that is used to fix the window means we can not resize the window by dragging. If you put 1 0, you can drag or resize the window on x axix, if you put 0 1, you can drag or resize it on y axix and if you put 1 1, you can drag and resize on both axis.
wm deiconify $a is the command that is used to make the window as active window.
And then we have to create label called "Delete Geometric entities". The syntax for create label is label $windowpath -text "Label" -bg grey -font {times 20 bold} ; place $windowpath -x value -y value -width value -height value. Using this syntax the label is created.
We have to create four buttons called 'Delete Solids', 'Delete Surfaces', 'Delete points', 'Delete Lines'. The syntax for create button is button $windowpath -text "text" -command {something}; place $windowpath -x value -y value -width value - height value. Using these syntax buttons are created. To execute commands we have to create procedure.
Create procedure for delete displayed entities and also use null case for not getting any error if the user not selected any entities.
Using the above procedure create labels and buttons for delete empty and unused entities and re-order and re-number entities. Here, the entities could be assemblies, components, materials, properties. Use procedure for all these buttons.
Also create a master button in red and create one procedure and assign all the commands into these procedure. So, that all the above operations can be performed at one click.
Output:
Conclusion:
Sucessfully created buttons to delete displayed geometric entities, delete empty entities, re-order and re-number entities by name and also created a master button in red that will execute all the above operations.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Project - 2 - Generating the report for hypermesh file
Aim: To generate the report for hypermesh file Objective: To create an ergonomic and visually appealing excel (.xlsm) report that contains following information about your model: User name, date, time Profile/deck; count of component, prop, material, elements Count of empty comp/prop/mats Elements…
20 Dec 2021 07:48 AM IST
Project 1- Building a Master TCL/TK Macro
Aim: To create a master TCL/TK macro that performs several operations such as finding and correcting normals, final checks, creating components, reflecting geometry, creating connections and identify identical components. Objective: It should contain buttons that will call all utilities created as assignments during…
10 Dec 2021 05:13 AM IST
Week - 9 - Reflecting the geometry
Aim: To create a code that performs reflecting the geometry Objective: Create a macro that will reflect given multicomponent FE part with ease It should be independent of deck The inputs should be original CAD comp, reflected CAD comp and original FE comps …
07 Dec 2021 03:01 PM IST
Week - 12 - Creating the locator, writing and reading the node data
Aim: To create a code that performs connections, identify the identical components and reading nodes from a file. Objective: Create a macro that builds a GUI containing 4 buttons. Component creator, weld, xloc, yloc, zloc. Upon pressing the buttons corresponding 1D element must be created…
07 Dec 2021 12:35 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.