可能要用的函数:;)
function
上次更新時間: 08/09/2001 13:42:14
--------------------------------------------------------------------------------
ceil和floor均可有一個附加參數,用它可指定舍去的小數位.
ceil(parameter_name or number, number_of_dec_places).
floor(parameter_name or number, number_of_dec_places).
| |
參數名或數值. 要保留的小數位(可省略)
number_of_ded_places:它的取值的不同可有不同的結果.
i)可以為數值亦可為參數,若為實數則取整.
ii)若number_of_dec_place>8,則不作任何處理,用原值
若number_of_dec_place≦8,則舍去其后的小數位,則進位
例如:
Ceil(10.2)-->11 比10.2大的最小整數為11.
floor(-10.2)-->-11 比-10.2小的最大整數為-11.
floor(10.2)-->10 比10.2小的最大整數為10.
Ceil(10.255,2)-->10.26. 比10.255大的最小符合數.
Ceil(10.255,0)-->11
floor(10.255,1)-->10.2
Len1=ceil(20.5) ==>Len1=21
Len2=floor(-11.3) ==>Len2=-12
Len=Len1+Len2 ==>Len=9
--------------------------------------------------------------------------------
o string_length( )
用法:String_length(Parameter name or string).
參數名或字符串
例:
strlen1=string_length("material") 則 strlen1=8
若material="steel",strlen2=string_length(material),則strlen2=5,字符串要用" "括起,
空格亦算一個字符.
o rel_model_name( )
用法:rel_model_name( ) 注意括號內為空的,返回目前模型名稱.
例:
當前模型為-part1,則
partName=rel_model_name( )==>partName="part1"
如在裝配圖中,則需加上進程號(session Id),例如
partName=rel_model_name:2( )
o rel_model_type( ) 返回目前模型類型
用法: rel_model_type( )
例:
如當前模型為裝配圖
parttype=rel_model_type( ) ==>parttype="ASSEMBLY".
若為一零件圖則 ==>parttype=" ART".
o exists( ) 測試項目存在與否
用法:exists(Item) Item可以是參數或尺寸.
例:
If exists(d5) 檢查零件內是否有d5尺寸.
If exists("material") 檢查零件內是否有material參數.
o itos( ) 將整數換成字符串
用法: Itos(integer) 整數,若為實數則舍去小數點.
例:
S1=Itos(123)==>s1="123"
S2=itos(123.57)==>s2="123"
intl=123.5 s3=itos(intl)==>s3="123"
o search( ) 查找字串,返回位置值
用法:search(string,substring).
string:原字串
substring:要找的字串.
查到則返回位置,否則返回0,第一個字符位置值為1,依此類推.
例 :
  arstr=abcdef.則
Where=search(parstr,"bcd"")==>Where=2.
Where=search(parstr,"bed")==>where=0(沒查到).
o extract( ) 提取字符串
用法:extract(string,position,length)
| | |
原字串 提取位 提取字符數
position:大于0而小于字符串長度.
length: position+length-1 不能大于字符串長度.
例:
new=extraecl("abcded",2,3)==>new="bcd".
其含義是: 從"abcdef"串的第2個字符(b)開始取出3個字符.
--------------------------------------------------------------------------------
o lookup_inst( ) 從族表中找出符合條件的例證成員
用法: lookup_inst("generic_name",match_mode,"param_name1",match_value1,
"param_name2",match_value2,...)
參數說明:
generic_name: 一般模型文件名(*.prt;*.asm).
match_mode: 匹配方式,有如下取值:
==>-1:
==>0:
==>1:
|