77范文网 - 专业文章范例文档资料分享平台

Patran的PCL用户手册 - 图文(7)

来源:网络收集 时间:2019-03-10 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

Structure of a PCL Function

Simple PCL function Example

Function declaration Function arguments (null) FUNCTION a_very_simple_function() /* This is a simple function that writes: Comments (Who we “$# My favorite number is 29” kidding? We all know that everyone loathes in the MSC.Patran history window using 3 different commenting their “write” or “print” statements. code!) */ /* This is a comment. */ $ This is also a comment. Variable declaration INTEGER MyFavoriteNumber Variable initialization MyFavoriteNumber = 29 ui_writec(“My favorite number is %d \\n”, MyFavoriteNumber) ui_writef(“A21,1X,I3”, “My favorite number is”, MyFavoriteNumber) ui_write(“My favorite number is “//STR_FROM_INTEGER(MyFavoriteNumber)) END FUNCTION /* a_very_simple_function */ Statements or expressions Function terminator

MSC.Patran PCL Workshop Notes 04/13/16 31/236

Structure of a PCL Function

Sample output. The ui_write functions write text to the history window, the session file (patran.ses.##), and the journal file (model.db.jou)

Calling statement ? Another simple PCL function Function argument FUNCTION another_simple_function(MyFavoriteNumber) Note all variables must be INTEGER MyFavoriteNumber declared, including function INTEGER MyLeastFavoriteNumber arguments MyLeastFavoriteNumber = 13 ui_write(“My favorite number is “//str_from_integer(MyFavoriteNumber)) ui_write(“My least favorite number is “// @ str_from_integer(MyLeastFavoriteNumber)) END FUNCTION /* another_simple_function */

another_simple_function(29)

$#My favorite number is 29

$#My least favorite number is 13

Calling statement Sample output

MSC.Patran PCL Workshop Notes 04/13/16 32/236

Exercise 2: Hello World!

Write and execute a PCL function that accepts a single real number argument and echoes

Hello World, my favorite number is ….

to the MSC.Patran session file and history window.

Your function will use either the ui_write(…), ui_writef(…), or ui_writec(…) functions.

If you use the ui_writef(…) and ui_writec(…) functions, refer to the documentation for the correct format specifiers.

Extra credit: How would this function change if you wanted to

echo your favorite 10 numbers to the session file? Extra credit: How would this function change if you wanted to

echo your favorite color to the session file?

MSC.Patran PCL Workshop Notes 04/13/16 33/236

Exercise 3: Effective PCL

Write an essay on how the effective use of PCL could:

a) b) c) d)

Help create a lasting world peace Eliminate world hunger Conquer the common cold Stop global warming

Extra credit: How could PCL be used to find Elvis?

MSC.Patran PCL Workshop Notes 04/13/16 34/236

PCL Operators

Operators + ** * + // < || += - / - > -= ! <= = >= == != Comments Unary plus, minus, logical not Exponentiation Multiplication and division Additions and subtraction String concatenation Relational operators Logical or, logical and Increment, decrement, assignment && Examples

Dist = mth_sqrt((x2-x1)**2 + (y2-y1)**2 + (z2-z1)**2) MyString3 = MyString2//”hijk” IF (a == b) THEN c = d

IF (a == b && a == c) THEN ui_write(“Equilibrium”) x += 1 (this is equivalent to x = x + 1)

String comparisons

?

The string comparison operators are special in that they ignore trailing blanks and uppercase and lowercase. Therefore, all of the following expressions are TRUE

“ABC” == “ABC “ “ABC” == “abc”

? ?

Leading blanks are compared, i.e., “TEST” != “ TEST” To perform case sensitive comparisons use the str_equal() function, i.e.,

IF (str_equal(GroupName1, GroupName2)) THEN RETURN 0

MSC.Patran PCL Workshop Notes 04/13/16 35/236

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库Patran的PCL用户手册 - 图文(7)在线全文阅读。

Patran的PCL用户手册 - 图文(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/513782.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: