KIT PAT 304 - Exercise 12 Group Elemens

Unformatted text preview:

Group ElementsExercise Description:Files:File Supplied/Created DescriptionExercise Procedure:1. Edit the PCL function in the file exercise_12.template. Replace the blanks with the appropriat...2. To run the C Pre-processor on the PCL function that you just created type in one of the follow...3. Type in the command p3pclcomp into your x-term window.4. Create or edit your p3epilog.pcl file. The file should now contain the following commands:5. Use the vi or jot editors to edit the training.pcl file in order to “unghost” the exercise 12 ...6. Start PATRAN once again with all the changes made to those files. Pull down the training menu ...7. Open the database elements.db. .8. Test the form and function that you built..Sample Solution:Objectives:PATRAN 304 Exercise Workbook 12-1EXERCISE 12Objectives:■ Write a class that creates a form with a switch,databox, apply and cancel buttons. The callback for theapply button will get the user defined element shapeand group name and call put_element_in_group,created in Exercise 7.Group Elements12-2 PATRAN 304 Exercise WorkbookEXERCISE 12 Group ElementsPATRAN 304 Exercise Workbook 12-3Exercise Description:Create a form that handles the user interface for theaddition of elements of a given shape to groups using theput_element_in_group function created in Exercise 7.The function requires a switch that contains the optionsfor the shape of element to be added to the new group.Finally, the apply button will fetch the informationsupplied by the user and call the put_element_in_groupfunction to create the group.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_12.template Supplied A template file that you may use tofill in the missing PCL calls thatshould be added to the function.group_elements.pcl Created This file should be created after allthe blanks are filled in theexercise_12.template file.group_elements.cpp Created This file should be created when thePCL file is run through the C Pre-Processor.p3epilog.pcl Created A file that needs to be created inorder to input the files needed forthe exercise upon startup ofPATRAN.Exercise Procedure:1. Edit the PCL function in the fileexercise_12.template. Replace the blanks with theappropriate PCL expressions. Rename the filegroup_elements.pcl when you are done editing thefile.The form you create should look like the one shownbelow. You should use the pre-defined variables for thewidget size and spacing to make the form presentable.These variables are accessed by placing12-4 PATRAN 304 Exercise Workbook#include appforms.pat the top of your PCL function and running the filethrough the C pre-processor prior to compilation.You may also use the template file your instructor willprovide for you to add the missing PCL code.If no errors are found in the PCL code then run the CPre-Processor.2. To run the C Pre-processor on the PCL functionthat you just created type in one of the followingcommands:For Sun Solaris:%/usr/ccs/lib/cpp -I/patran/patran3/customizationgroup_elements.pcl group_elements.cppFor SUNOS:%/usr/lib/cpp -I/patran/patran3/customizationgroup_elements.pcl group_elements.cppEXERCISE 12 Group ElementsPATRAN 304 Exercise Workbook 12-5For HP-UX(Earlier than version 10.2)%/lib/cpp -I/patran/patran3/customizationgroup_elements.pcl group_elements.cppFor HP-UX(Version 10.2 or later):%/usr/ccs/lbin/cpp -I/patran/patran3/customizationgroup_elements.pcl group_elements.cppNote: The command for SUNOS should also work for all Silicon Graphics machines.The -I switch tells cpp to search in ⁄patran⁄patran3⁄customizationdirectory for the include files.3. Type in the command p3pclcomp into your x-term window.At the compiler’s prompt type in the following command:!!input group_elements.cppIf there are no errors in the code then you will need to create ap3epilog.pcl file.4. Create or edit your p3epilog.pcl file. The file should now containthe following commands:!!input put_element_in_group.pcl!!input group_elements.cpp!!input training.pcltraining.init ()5. Use the vi or jot editors to edit the training.pcl file in order to“unghost” the exercise 12 menu option.To unghost the rest of the exercise options you will need to commentout several of the lines in the code. In order to comment out these linesyou will need to enclose each line with a:“/*” at the beginning of each line and,“*/” at the end of each line.The lines that you will need to comment out are similar to the oneshown below and the rest should all be grouped together./*ui_wid_set(item12, “ENABLE”, FALSE)*/Note: Be sure to comment out items 13 thru 17 as well12-6 PATRAN 304 Exercise Workbook6. Start PATRAN once again with all the changes made tothose files.Pull downthe trainingmenu inPATRAN, youshould notice that all of the menu options are able to beselected. If you cannot select the exercise 12 option thenyou need to make sure that those lines were commentedout in the training.pcl code and then re-execute thefunction training.init()7. Open the database elements.db. .Your model should appear as shown below.File/Open ...elements.dbApplyPATRANFile Group Viewport Viewing Display Preferences Tools Help$put_element_in_group(“tria”,”group_of_trias”)$$# 4 quad elements added to new group: group_of_quads$put_element_in_group( “quad”, “group_of_quads”)Geometry Finite Elements Loads/BCs Materials Properties Load Cases Fields Results Insight XY Plot◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆EXERCISE 12 Group ElementsPATRAN 304 Exercise Workbook 12-78. Test the form and function that you built..MSC⁄PATRAN responds:4 Quad elements added to new group: my_QUADsTry the function with the group of trias as well to see if both functions work.Training/Exercise12◆ QuadGroup Name my_QuadsApplymy_QUADs12-8 PATRAN 304 Exercise WorkbookSample Solution: /*$$ Use of PCL in creating customized forms/widgets * * Purpose: * Create a form with a switch, a databox, apply and cancel buttons. * The callback for the apply button will get the element shape and * the group name and call put_element_in_group which was written * for an earlier exercise. * * Input: * <None> * * Output: * <None> * * Log: * * Notes: * Things to learn from this exercise * Using the cpp pre-processor (appforms.p) * Positioning widgets with parameters * Databox, switch widgets * Callback and get


View Full Document

KIT PAT 304 - Exercise 12 Group Elemens

Download Exercise 12 Group Elemens
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 12 Group Elemens 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 12 Group Elemens 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?