Unformatted text preview:

Clevis IconExercise Description:Files:File Supplied/Created DescriptionExercise Procedure:1. Create an icon similar to the one shown below. The bitmap command varies on different machines:2. Using the bitmap editor, create the icon which looks like:3. Using the vi editor (or jot), edit clevis_ui.pcl to add a label icon to the top of the form.4. When you have completed generating the function, run it through the C Pre-Processor. For the m...5. Compile clevis_ui.cpp6. Start MSC/PATRAN by typing p3 in your xterm window.7. Test the function by picking Exercise 16 under the training menu.Sample Solution:Objectives:PATRAN 304 Exercise Workbook 16-1EXERCISE 16Clevis IconObjectives:■ Revise the Clevis Parametric Design Form to includean icon16-2 PATRAN 304 Exercise WorkbookEXERCISE 16 Clevis IconPATRAN 304 Exercise Workbook 16-3Exercise Description:In this exercise, you will modify class clevis_ui topresent an icon at the top of the form. The icon willindicate the meaning of the input values for clevis radius,width and length.The exercise requires that you use the bitmap editor tocreate the clevis icon.Files:All the files that used in this exercise are listed below.Each list includes the file, where it originated, and asummary of information of how it relates to the exercise.File Supplied/Created Descriptionclevis_ui.pcl Created This file should have already beencreated in an earlier exercise.Exercise Procedure:1. Create an icon similar to the one shown below. Thebitmap command varies on different machines:SGI: /usr/bin/X11/bitmap -size 80x50 clevis.iconHP: /usr/contrib/bin/X11/vueicon -size 80x50 clevis.iconSUN Solaris: /usr/openwin/bin/bitmap -size 80x50clevis.icon2. Using the bitmap editor, create the icon whichlooks like:3. Using the vi editor (or jot), edit clevis_ui.pcl to adda label icon to the top of the form.4. When you have completed generating the function,16-4 PATRAN 304 Exercise Workbookrun it through the C Pre-Processor. For themachine specific commands refer to the previousexercises.cpp -I/patran/patran3/customization clevis_ui.pcl clevis_ui.cpp5. Compile clevis_ui.cppStart the MSC⁄PATRAN compiler by typingp3pclcomp in your xterm window.Then input the file by typing the following line:!!input clevis_ui.cppAll the error messages and diagnostics will be writtenin the xterm window under the previous lines.6. Start MSC/PATRAN by typing p3 in your xtermwindow.7. Test the function by picking Exercise 16 underthe training menu.EXERCISE 16 Clevis IconPATRAN 304 Exercise Workbook 16-5Sample Solution::::::::::::::::clevis_ui.pcl:::::::::::::: /*$$ Use of PCL in creating customized forms/widgets * * Purpose: * Create the user interface for the Clevis Design Project. * * Input: * <None> * * Output: * <None> * * Log: * * Notes: * */#include “appforms.p”CLASS clevis_ui /* Variable initialization */ CLASSWIDE widget form_id, @ dimension_button, @ constraint_button, @ apply_button, @ cancel_button FUNCTION INIT() REAL x_pos,y_loc /* * Create the form */form_id=UI_FORM_CREATE( @ /* callback */ ““, @ /* x */ FORM_X_LOC, @ /* y */ FORM_Y_LOC, @ /* position */ “UL”, @ /* width */ FORM_WID_SML, @ /* height */ FORM_HGT_FULL, @ /* label */ “Clevis Parametric Design”, @ /* iconname */ ““ ) y_loc = FORM_T_MARGIN /* * Create the icon */16-6 PATRAN 304 Exercise Workbook x_pos = FRAME_WID_SINGLE / 2. - @ 80. * PIXEL_WID / 2. ui_labelicon_create( @/* parent */ form_id, @/* lab_name */ ““, @/* x */ x_pos, @/* y */ y_loc, @/* icon */ “clevis.icon” ) y_loc += 50. * PIXEL_HGT + INTER_WIDGET_SPACE /* * Create the “Dimension” button */ dimension_button = ui_button_create( @ /* parent */ form_id, @ /* callback */ “dimension_cb”, @ /* x */ BUTTON_FULL_X_LOC1, @ /* y */ y_loc, @ /* width */ BUTTON_WID_FULL, @ /* height */ 0.0, @ /* label */ “Dimension...”, @ /* labelinside */ TRUE, @ /* highlight */ TRUE )y_loc += BUTTON_HGT + BUTTON_DEFAULT_BORDER_HGT + @ 2*INTER_WIDGET_SPACE /* * Create the “Constraint button */ constraint_button = ui_button_create( @/* parent */ form_id, @/* callback */ “constraint_cb”, @/* x */ BUTTON_FULL_X_LOC1, @/* y */ y_loc, @/* width */ BUTTON_WID_FULL, @/* height */ 0.0, @/* label */ “Constraint...”, @/* labelinside */ TRUE, @/* highlight */ TRUE ) y_loc += BUTTON_HGT + BUTTON_DEFAULT_BORDER_HGT + @2*INTER_WIDGET_SPACE /* * create the separator */ ui_separator_create( form_id, EMPTY_STR, @ ZERO, y_loc, @ FORM_WID_SML, TRUE ) y_loc += LINE_THICKNESS + INTER_WIDGET_SPACEEXERCISE 16 Clevis IconPATRAN 304 Exercise Workbook 16-7/* * Create the “Apply” button */ apply_button = ui_button_create( @ /* parent */ form_id, @ /* callback */ “apply_cb”, @ /* x */ BUTTON_HALF_X_LOC1, @ /* y */ y_loc, @ /* width */ BUTTON_WID_HALF, @ /* height */ 0.0, @ /* label */ “Apply”, @ /* labelinside */ TRUE, @ /* highlight */ TRUE )/* * Create the “Cancel” button */ cancel_button = ui_button_create( @/* parent */ form_id, @/* callback */ “cancel_cb”, @/* x */ BUTTON_HALF_X_LOC2, @/* y */ y_loc, @/* width */ BUTTON_WID_HALF, @/* height */ 0.0, @/* label */ “Cancel”, @/* labelinside */ TRUE, @/* highlight */ FALSE ) y_loc += BUTTON_DEFAULT_HGT + FORM_B_MARGIN ui_wid_set( form_id, “HEIGHT”, y_loc ) END FUNCTION FUNCTION DISPLAY()ui_form_display( “clevis_ui”) END FUNCTION FUNCTION dimension_cb() ui_exec_function(“dimension”, “display”) END FUNCTION /* dimension_cb end of Function */ FUNCTION constraint_cb() ui_exec_function(“clevis_loads”, “display”) END FUNCTION /* constraint_cb end of Function */ FUNCTION apply_cb()16-8 PATRAN 304 Exercise Workbook/* * calling the routines to create the Clevis Design */> lug_create()> lug_mesh()> lug_load() END FUNCTION /* apply_cb */ FUNCTION cancel_cb() /* * Save the data entered in the dimension & constraint forms * and hide all of the forms!! */ ui_form_hide( “clevis_ui”) END FUNCTION /* cancel_cb */END CLASS /* clevis_ui


View Full Document

KIT PAT 304 - Clevis Icon

Download Clevis Icon
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Clevis Icon and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Clevis Icon 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?