Adams命令

1. FIND_MACRO_FROM_COMMAND(STRING): 通过宏命令找到宏所在位置

2. DEFAULT_GROUND($_topgui.model): 获取默认地面Part

3. DB_DEFAULT(.System_Defaults,”Model”)': 默认值

4. prod_info(“raw_product”)': 获取当前Adams产品种类

5. DB_CHILDREN($_self, “Variable”):获取子集

6. acar toolkit warning warning=(eval(“message”))

7. obj_exists(db_default(system_defaults,”model”),”part_name”)

8. USER_STRING(“.model.part.marker.location”):  获取用户输入的位置等内容。

    cond=(USER_STRING(‘$f_body.ground_part’)!=’True’)

9. for var=$_topgui.loopObj obj=(eval(db_children($_topgui,”GRaphic_Interface_Field”)): 循环界面上所有Field控件

"for var=$_topgui.loopObj obj=(eval(db_children($_topgui,'GRaphic_Interface_Field')))", &
" int field set field=(eval($_topgui.loopObj)) action=replace strings=''", &
"end", &

"interface container undisplay container_name = (eval(DB_CHILDREN($_parent,\"graphic_interface_container\")))",  &

10. symmetric_obj($_topgui.current_element).ref_marker: 获取对称位置的OBJECT

11. STR_CHAR_SWAP(“r”,”lrrl”,1): 用于获取对称字符

12. DB_MOVE(marker, new_part)': 移动所属的父类

13. ACAR.variables.vehicle_left@{1,2,3}:向量相乘之和

14. symmetry({x,y,z}):对称位置坐标

15. db_ancestor(object, “part”): 获取父类中part的object

16.simulation set solver_preference = internal   设置使用内部Solver

 17.删除UDE:assembly delete instance_name   或者 entity delete entity

18.添加图片:var set var=.db_base.variables.i int=(eval(PUTENV(       "MDI_AVIEW_BITMAPS",getenv("MDI_AVIEW_BITMAPS")//";"//getenv("db_base")//"/bitmap")))

interface label create  icon_file = "nikon.png"

 19. 删除文件:variable set variable=$_self.tmpret int=(eval(remove_file($_self.tmprptfil)))

 20. 询问对话框:variable set variable = $_self.yes_no_cancel int = (eval(alert(\"Information\",\"Save the property file?\",\"Yes\",\"No\",\"Cancel\",2)))

21. 1rad:弧度对应值

22. 旋转坐标时要考虑旋转方式的影响

undo begin sup=yes
variable set variable=.mdi.TmpDefOriS str=(eval(user_string(".system_defaults.orientation_type")))
defaults unit orientation_type=body123
move rotation marker_name = $attach_marker &
csmarker_name = $attach_marker &
a1=$sprocket_mis_x a2=$sprocket_mis_y a3=0.0 about=yes
defaults unit orientation_type = (eval(.mdi.TmpDefOriS))
undo end

23.获取DBOX所有filed控件

" for variable = $_topgui.loopObj object = (eval(db_children($_topgui, \"Graphic_Interface_Field\")))", &
" interface field set field_name = (eval($_topgui.loopObj)) &", &
" strings = \"\" execute = no", &
" end", &

 

24. acar中的对称性检查obj_typecheck($reference_frame,"l")

25.UNIQUE_NAME数据库里唯一名字

26. UNIQUE_NAME_IN_HIERARCHY在当前模型数据库里唯一名字

26.循环删除特定子内容

if condition = (db_obj_exists($chain_links_name, "span_at_*_a"))

for variable_name = $_self.loopObj object = $chain_links_name."span_at_*_a" type = request

variable set variable_name = $_self.request_name &

string_value = (eval($_self.loopObj.object_value))

variable set variable_name = $_self.loopObj &

object_value = (none)

amachinery standard_interface belt span_request delete &

request_name = (eval($_self.request_name.string_value))

end

end

27. DB_MOVE: 移动maker所属PART   var set var=$_self.move_g int=(eval(db_move((eval($_self.con_guid_obj.object_value.ref_marker.object_value)),(eval($f_guide_conn)))))

 

 28. 单位随公式条件:

variable set variable=$_self.angle &
real=(eval(($_self.angle[1]<0)+0.0 ? (360d+$_self.angle[1]) : ($_self.angle[1])))

29.NORMALIZE({1,1,4})

单位正交

 29.dot product:

real_value = (eval(acos(DOT($_self.u2, $_self.u3))))

30. TMAT获取旋转矩阵,并对u1坐标进行旋转

real_value = (eval(TMAT({-$_self.the2, 0.0, 0.0}, "space313") @ TRANSPOSE($_self.u1))) 

 31. 对称性检查:

obj_typecheck($reference_frame,"l")

 32.DM算距离,VR算径向速度差

(DM(sprocketset_2tappet_g5.housing_part.housing_attach_marker,sprocketset_2tappet_g5.piston_part.piston_attach_marker)

-sprocketset_2tappet_g5.offsetCalc)*-sprocketset_2tappet_g5.stiffness

+VR(sprocketset_2tappet_g5.housing_part.housing_attach_marker,sprocketset_2tappet_g5.piston_part.piston_attach_marker)

*-sprocketset_2tappet_g5.damping

33. if cond =(USER_STRING('$f_body_external.ground_part')!='True') :  判断是否为地面

34. 将数据转为location等三维数据

data modify matrix full matrix_name = $guide_name.curve_object_matrix &
row_count = (eval($_self.tmp_pro_index) / 3) &
column_count = 3 &
input_order = by_row &
values = (eval($_self.tmp_pro))
!
variable set variable_name=$guide_name.guide_prop.profile_values_1 &
real=(eval($guide_name.curve_object_matrix.values[*,1]))
variable set variable_name=$guide_name.guide_prop.profile_values_2 &
real=(eval($guide_name.curve_object_matrix.values[*,2]))
variable set variable_name=$guide_name.guide_prop.profile_values_3 &
real=(eval($guide_name.curve_object_matrix.values[*,3]))
!
geometry modify curve polyline &
poly=$guide_name.guide_part.guide_POLY1 &
location=(eval({$guide_name.guide_prop.profile_values_1,$guide_name.guide_prop.profile_values_2,$guide_name.guide_prop.profile_values_3})) &
relative_to=$guide_name.guide_part.guide_geo &
close=yes

35.代码中执aview行命令:

variable set variable_name = $_self.command_exec &

int = (eval(EXECUTE_VIEW_COMMAND($_self.loopObj[1]//".planar_axes = "//$_self.command_int)))

36. adams的路径设置

(eval(PUTENV( "MDI_AVIEW_BITMAPS",getenv("MDI_AVIEW_BITMAPS")//";"//getenv("my")//"/bitmap")))

"variable set variable=$_self.dlgs &", &
" integer=(eval(Set_Background_Image(\".ACAR.dboxes.about_acar\",\"Adams_help_about1.png\")))", &
".ACAR.dboxes.about_acar.info[4]=(\"Installation Directory: \" //AVIEW_NT2UNIX_PATH(GETENV(\"topdir\")))", &
".ACAR.dboxes.about_acar.se_info[4]=(\"Installation Directory: \" //AVIEW_NT2UNIX_PATH(GETENV(\"topdir\")))", &
".ACAR.dboxes.about_acar.se_info[5]=(\"Expiry Date: \" //PROD_INFO(\"expiry_date\"))", &
"interface field set field=.ACAR.dboxes.about_acar.field_1 &", &
" strings=(eval(security_check(\"EDU_View\") ? .ACAR.dboxes.about_acar.se_info : .ACAR.dboxes.about_acar.info))" &

 37. 删除文件:variable set variable_name = $error_variable  integer_value = (eval(remove_file($_self.shell_file)))

38. 判断是否为其中某个:integer=(eval(anym(\"$option_Coulomb_On_Off\" == {\"on\",\"dynamics_only\"})))

39. 所有都满足:=(allm({$_value.contact_array.object_value.poisson_penalty,$_value.contact_array.object_value.restitution_coefficient} != 0.0))",

40. object的类型判断:" if cond=(eval(db_type($_value)=='roller_sprocket'))",

41.调用系统命令行:

"system command=\"$command\" &", &
" send_output_to_info_window=$info_window_toggle &", &
" echo_to_logfile=$command_window_toggle" &

 42.获取工作路径:GETCWD () 

43. 更改斜杠为反斜杠AVIEW_NT2UNIX_PATH(getcwd())

44.获取当前操作系统: cdb_get_os() == "nt"

45.信息窗口的使用:

info empty
info read file=(eval($_self.ext_files[$_self.loopCnt]))

46. 界面设置控件隐藏性的通用方法

interface entity modify entity=$_topgui.f_step_count display=(yes_no(anym(\"$_value\"=={\"\",\"number_of_steps\"})))

 

 

 99. 读取acar中的属性文件信息:

acar toolkit read property_files &
assembly=$assembly &
verbose=yes &
error_variable=$error_variable

 

100.将宏写到文本的方法:

[sourcecode language='bash'  padlinenumbers='true' collapse='false']
file text open file=".ACAR.macros.mac_ana_act_sub.txt" open_mode=overwrite
file text write format="%s" newline=yes value=(eval(user_string(".ACAR.macros.mac_ana_act_sub.commands_to_be_executed")))
file text close file=".ACAR.macros.mac_ana_act_sub.txt"
[/sourcecode]

posted @ 2018-01-05 09:08  马语者  阅读(2418)  评论(0编辑  收藏  举报