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 code that performs checking and correcting the edges Objective: To create a code that displayed free and T edges for displayed elements To create a code that assigns red color to free edges and cyan color to T edges To create a code that makes all other…
Akash M
updated on 28 Nov 2021
Aim:
To create a code that performs checking and correcting the edges
Objective:
To create a code that displayed free and T edges for displayed elements
To create a code that assigns red color to free edges and cyan color to T edges
To create a code that makes all other component must be transparent expect for edges
To create a code that creates temp nodes automatically for free edges
To create a code to turn off free edges display and restore the window to the way it was
To create a tk widget that performs all these operations
Code:
set a .window
catch {destroy $a}
toplevel $a -class TopLevel
wm title $a "Free Edges"
wm geometry $a 300x200+100+50; update
wm resizable $a 0 0
wm deiconify $a
button $a.01 -text "Free Edges" -command {free_edges} -bg red -font {times 10 bold}; place $a.01 -x 20 -y 20 -width 100 -height 30
button $a.02 -text "T edges" -command {T_edges} -bg cyan -font {times 10 bold}; place $a.02 -x 140 -y 20 -width 100 -height 30
button $a.03 -text "both" -command {both} -bg white -font {times 10 bold}; place $a.03 -x 70 -y 70 -width 100 -height 30
button $a.04 -text "off" -command {off} -bg grey -font {times 10 bold}; place $a.04 -x 70 -y 120 -width 100 -height 30
proc free_edges {} {
*setdisplayattributes 4 1
*createmark components 1 "free_edges"
set a [hm_getmark components 1]
if {$a !=0} {
*createmark elements 1 "displayed"
*findedges1 elements 1 0 0 0 30
*setvalue components name={^edges} name={free_edges}
*createmark components 1 "free_edges"
*setvalue components mark=1 color=3
*createmark elements 1 "displayed"
*equivalence elements 1 0.01 0 0 30
*createmark elements 1 "displayed"
*equivalence elements 1 0.01 3 0 30
*createmark nodes 1 "retrieve"
*nodemarkaddtempmark 1
*setcomponentdisplayattributes "free_edges" 2 1
}
}
proc T_edges {} {
*setdisplayattributes 4 1
*createmark components 1 "T_edges"
set b [hm_getmark components 1]
if {$b !=0} {
*createmark elements 1 "displayed"
*findedges1 elements 1 1 0 0 30
*setvalue components name={^edges} name={T_edges}
*createmark components 1 "T_edges"
*setvalue components mark=1 color=30
*createmark elements 1 "displayed"
*equivalence elements 1 0.01 0 0 30
*createmark elements 1 "displayed"
*equivalence elements 1 0.01 3 0 30
*createmark nodes 1 "retrieve"
*nodemarkaddtempmark 1
*setcomponentdisplayattributes "T_edges" 2 1
}
}
proc both {} {
free_edges
T_edges
*setcomponentdisplayattributes "free_edges" 2 1
*setcomponentdisplayattributes "T_edges" 2 1
}
proc off {} {
*createmark components 1 "free_edges"
*hideentitybymark 1 1 2
*createmark components 1 "T_edges"
*hideentitybymark 1 1 2
*createstringarray 2 "elements_on" "geometry_off"
*setdisplayattributes 2 1
}
Procedure and code explanation:
Create a procedure called 'free_edges'
*setdisplayattributes is a command that transparent all the components.
We need to give a null case condition if there is no exixt component.
*createmark elements 1 "displayed" is a command that used to store all the displayed elements into a mark id 1.
*findedges1 elements 1 0 0 0 30 is the command that is used to find the edges. 1 represent the mark id and 0 indicated free edges and 30 is the break andle of the free edges.
*setvalue components name={^edges} name={free_edges} is used to change the name of the component.
*setvalue components mark=1 color=3 is used to change the color to red.
*equivalence elements 1 0.01 0 0 30 is checking where nodes to be equivalence for the tolerance value of 0.01 for the free edges
*equivalence elements 1 0.01 3 0 30 is saves the nodes which needs to be equivalence.
*createmark nodes 1 "retrieve" is used to retrive the saved nodes.
*nodemarkaddtempmark 1 is adding the nodes.
*setcomponentdisplayattributes "free_edges" 2 1 is the command that used to display thr free edges and T edges into the solid mesh representation.
Use the same procedure to check the T edges. Replae the procedure name into T_edges and use edge type as 1.
Also create a procedure that performs both operations and create a procedure to turn off free edge display and restore the window to the way it was. *createmark components 1 "free_edges"; *hideentitybymark 1 1 2 is the command that is used to turn off the free edges. Using this same method to turn off the T_edges.
*setdisplayattributes 2 1 is the command that used to resore the shaded element and mesh line.
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 "Free Edges" is the command that is used to create title of the window.
wm geometry $a 300x200+100+50 is the command that is used to create dimension of the window. 300x200 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.
We have to create buttons for all the operations. The syntax for create button is button $windowpath -text "text" -command {something}; place $windowpath -x value -y value -width value - height value. Using this syntax 'Free edges', 'T edges', 'both' and 'off' buttons are created.
Output:
Free edges operation:
T edges operation:
'both' button operation:
Nodes need to be eqivalence:
'off' button operation:
Conclusion:
Sucessfully created code that checking and correcting the edges. Also created tk widgets for the 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.