Challenge

Week - 11 - Element quality check

Objective:

This challenge objective is to create script for marking elements which have not passed quality criteria check. Marking them with temporary nodes makes it easy to identify areas in mesh that need remeshing. By the use of script marking elements that are checked for multiple criteria is possible.

Problem Statement:

Bulit in functions allow to check elements against quality criteria, by default elements are highlited white. Finding those places is not easy task, to have them clearly visible temp nodes can be placed in nodes of each element that did not pass quality criteria. To check quality for multiple criteria each time elements need to be saved to user mark, then tmp nodes are inserted in place of nodes. This process is time consuming and can be automated by script.

Tcl command explanation:

I have slightly changed objectives of this task to match my requirements: Marking elements can happen for each criteria separetely or for multiple simultaniously by selecting checkbox next to criteria name, and then by pressing Mark all selected button nodes will appear for all selected criteria.

Script starts with defining list of criteria and their default values, if needed list can be extended (gui will update automatically).

Then five procedures are defined:

- MarkTmpNodes - simply creates tmp nodes from list of elements passed to it.

- CheckTicks - when invoked collects info about ticks next to each criteria and their value, then populates tick_list that will be the input for CheckElements proc.

- CheckElements - is core function for this script. Input has to be provided as nested list of {{tick cirteria_name value} {tick ... }}. At first displayed elements are passed to mark id 1 (if no visible return from proc). Triases and quads are stored in separate lists (needed for max and min interia angle). Then foreach loop goes thorough all elements of tick_list, at first if condition checks whether checkbox is selected and criteria check has to be evaluated. Then second element of $tick goes through switch and enters corresponding part - elements that do not pass qualitycheck by hm_getelemcheckelems hypermesh function are stored to seperate list, which is then concatenated with main list of elements to mark. Lastly number of selected elements is updated with global variable displayed in gui. Eventually elements list is sorted from duplicate elements that did not pass more than one criteria.

- SingleCheck - is function that is linked with criteria name button and is used to trigger CheckElements proc for single criteria, it overrides tick_list with nested list containing single criteria to check, eventually tmp nodes are created.

- MarkAllSelected - is function that runs when mark all selected button is clicked. At first it collects data from all criteria, then number of marked elements is updated, eventually tmp nodes are created.

Window is created to be topmost and not resizable. For loop creates first part of gui, it sources criteria_list and iteratively creates checkbox, button, entry, label and number variable of marked elements. End part creates Mark all selected button and information about number of makred elements.

Conclusion:

Script functionality was adapted to my daily use. It works on 2D elements, allows for multiple criteria check, saves number of elements marked. Number of criteria can be extended by editing criteria_list and creating corresponding part inside part controlled by switch command.

created by Adam

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.