KIT PAT 304 - Exercise 13 - Apply Load Function Graphical User Interface

Unformatted text preview:

Apply Load Function Graphical User InterfaceExercise Description:Files:File Supplied/Created DescriptionExercise Procedure:1. Edit the PCL function in the file exercise_13.template. Replace the blanks with the appropriat...2. Pre-Process the function.3. When you have completed the code for generating the function, type the command p3pclcomp to co...4. Edit the p3epilog.pcl file once again so that it contains:5. Start MSC/PATRAN once again making sure that you have these two files in your current working ...6. Open the database, lug.db.7. Test the function by bringing up the Load Create Form under the exercise 13 menu option..Sample Solution:Objectives:PATRAN 304 Exercise Workbook 13-1EXERCISE 13Objectives:■ Write a class to create the graphical user interface,GUI, for the apply_load_to_selected_nodes function.Apply Load FunctionGraphical User Interface13-2 PATRAN 304 Exercise WorkbookEXERCISE 13 Apply Load FormPATRAN 304 Exercise Workbook 13-3Exercise Description:This exercise, class load_form, will create a form thathandles the user interface for the loads. It provides twodataboxes to enter force and moment vectors inP3⁄PATRAN’s list processor format. Finally the applybutton will retrieve the information from the databoxes,and call apply_load_to_selected_nodes function createdin Exercise 8.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 Descriptionexercise_13.template Supplied A template file that you may use tofill in the missing PCL calls thatshould be added to the function.load_form.pcl Created The file will be created from theexercise_13.template after the filehas been completed with the correctPCL codes.Exercise Procedure:1. Edit the PCL function in the fileexercise_13.template. Replace the blanks with theappropriate PCL expressions. Rename the file toload_form.pcl when you are done.You should use the pre-defined variables for the widgetsize and spacing to make the form presentable.Use MSC⁄PATRAN list processor calls to parse out theentities inside the Select Nodes databox. As discussed inthe lecture, the list processor calls will accept a string asan input and output, and unique ID’s of a user specifiedattribute such as Nodes, Elements, etc.13-4 PATRAN 304 Exercise WorkbookYou may also use the template file your instructor willprovide for you to add the missing PCL code. The formthat you will be creating should look like the one shownbelow..2. Pre-Process the function.%cpp -I/patran/patran3/customization load_form.pclload_form.cppNote: Check the previous exercise for the machinespecific commands necesary to run the C Pre-Processor.Once again the -I switch tells cpp to search in⁄patran⁄patran3⁄customization directory for the includefiles.3. When you have completed the code for generatingthe function, type the command p3pclcomp tocompile the function withou having to start the fullPATRAN program.!!input load_form.cppThe prompt should say that it is compiling and thencompiled, if there are no errors in the code that you havejust generated.EXERCISE 13 Apply Load FormPATRAN 304 Exercise Workbook 13-54. Edit the p3epilog.pcl file once again so that itcontains:!!input load_form.cpp!!input apply_load_to_selected_nodes.pcl!!input training.pcltraining.init()5. Start MSC/PATRAN once again making sure thatyou have these two files in your current workingdirectory:1. p3epilog.pcl2. p3prolog.pclThe p3prolog.pcl file should still contain the values for theglobal real variables needed for the model of the lug.6. Open the database, lug.db.7. Test the function by bringing up the Load CreateForm under the exercise 13 menu option..File/Open ...lug.dbApplyTraining/Exercise 13Force Vector <0.0 -100.0 0.0>Moment Vector <0.0 0.0 0.0>Select Nodes Use the ctrl picking to selectthe nodes. Refer to next pageApply13-6 PATRAN 304 Exercise Workbook:Now, click in the Select Nodes databox and screen selectthe nodes shown on the next page.Use the polygon pick to select a series of nodes. To dothis, hold the <control> key and click with the left mousebutton enclosing the nodes you wish to select. To closethe polygon, click on the same vertex in which youstarted..EXERCISE 13 Apply Load FormPATRAN 304 Exercise Workbook 13-7Your form should appear as shown below.Upon clicking Apply, MSC⁄PATRAN will create a newload set.13-8 PATRAN 304 Exercise WorkbookSample Solution: /*$$ Use of PCL in creating customized forms/widgets * * Purpose: * Create the user interface for the function * apply_load_to_selected_nodes function. * * Input: * <None> * * Output: * <None> * * Log: * * Notes: * */***************1*************** Insert the include files discussed in lecture***************1***************CLASS load_form /* Variable initialization */ CLASSWIDE widget form_id, @dbx1_id, @dbx2_id, @apply_button, @cancel_button, @select_frame, @select_data_box1 FUNCTION INIT() REAL y_loc, select_data_box_width/* * Create the form *//* Add all the parameters to the next ui_form_create command. */form_id=ui_form_create ( @/* callback */ ****2**** @/* x */ ****2**** @/* y */ ****2**** @/* position */ ****2**** @/* width */ ****2**** @/* height */ ****2**** @/* label */ ****2**** @/* iconname */ ****2**** )y_loc = ****3**** Keep a running tab on the y location in this form/* * Create the “Force Vector Databox” */EXERCISE 13 Apply Load FormPATRAN 304 Exercise Workbook 13-9dbx1_id= ui_databox_create( @/* parent */ form_id, @/* callback */ ““, @/* x */ UNFRAMED_L_MARGIN, @/* y */ y_loc, @/* label_length */ 0.0, @/* box_length */ DBOX_WID_SINGLE, @/* label */ “Force Vector”, @/* value */ “<0.0 0.0 0.0 >”, @/* label_above */ TRUE, @/* datatype */ “STRING”, @/* num_vals */ 1 )y_loc += ****4****/* * Create the “Enter the Moment Vector Databox” */dbx2_id= ui_data_box_create( @/* parent */ form_id, @/* callback */ ““, @/* x */ ****5**** @/* y */ ****5**** @/* label_length */ ****5**** @/* box_length */ ****5**** @/* label */ “Moment Vector”, @/* value */ “<0.0 0.0 0.0 >”, @/* label_above */ TRUE, @/* datatype */ “STRING”, @/* num_vals */ 1 )y_loc += ********************6******************* /* * select data frame for element selection */select_frame = ui_selectframe_create ( @/* parent */ ****7**** @/* callback */ ****7**** @/* Left_margin */ ****7**** @/* y */ ****7**** @/* col_width */ SFRAME_WID_SINGLE, @/* height */


View Full Document

KIT PAT 304 - Exercise 13 - Apply Load Function Graphical User Interface

Documents in this Course
Load more
Download Exercise 13 - Apply Load Function Graphical User Interface
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 Exercise 13 - Apply Load Function Graphical User Interface 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 Exercise 13 - Apply Load Function Graphical User Interface 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?