Challenge

Week - 5 - Checking and correcting the Normals

Objective

To write a code to display normals of the elements and two buttons to reverse the normals as well as turn off normals display

Program

  • *setnormalsdisplaytpe is used to display the type of visualization whether with direction of normal (0)or color(1)
  • Then the elements displayed in were selected using *createmark command
  • Normals were displayed for the selected element with color representation using *normalsdisplay elems
  • Functions were created for the reversing the normals and select the elements using proc and these functions are called by assigning the respective buttons
  • To reverse the normals of the selected elements *normalsreverse command is used
  • hm_framework is used to create a separate tab
*setnormalsdisplaytype 1
*createmark elements 1 "displayed"
*normalsdisplay elements 1
*clearmark elems 1
proc x {} {
*createmarkpanel elems 1
set ::b [hm_getmark elems 1]
}
proc y {} {
if {$::d == {}} {
set popup [tk_messageBox -message "No elements were selected"]
} else { 
eval *createmark elems 1 $::b
*normalsreverse elems 1 
*createmark elements 1 "displayed"
*normalsdisplay elements 1
}
}
hm_framework removetab "Normals"
set a .normal
hm_framework addtab "NORMALS" [frame $a]
button $a.01 -text "ELEMENTS" -command x
place $a.01 -x 10 -y 10 -width 120 -height 20
button $a.02 -text "NORMAL OFF"  -command {*normalsoff}
place $a.02 -x 130 -y 10 -width 120 -height 20
button $a.03 -text "REVERSE NORMAL" -command y
place $a.03 -x 260 -y 10 -width 120 -height 20

RESULT

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.