您的位置:网站首页 > Proe教程

利用程序替换Proe组件中的元件

时间:2012-04-06 09:33:46 来源:未知

1.在“工具”菜单下面选择“程序(Program)”来打开程序菜单。

2.在菜单管理器中选择“编辑设计(Edit Design)”来进入程序。

3.写入程序。下面是一个例子,其中大部分都是Proe自动生存,我们自行编写的是蓝色加粗的字体部分。

VERSION 5.0
REVNUM 141
LISTING FOR ASSEMBLY ASM0001

INPUT
ASM_NAME STRING
“WOULD YOU LIKE ASSEMBLY “AB”, “AC”, OR “CYL”?”
/*上面的代码是再生模型的时候会产生用户交互提示用户输入AB,AC,CYL*/
END INPUT

RELATIONS
IF ASM_NAME == “AB”
VAR_NAME = “BLOCK_B.PRT”
ELSE
IF ASM_NAME == “AC”
VAR_NAME = “BLOCK_C.PRT”
ELSE
IF ASM_NAME == “CYL”
VAR_NAME = “CYL.PRT”
/*上面的代码是根据用户输入来设置Proe参数的值*/
ENDIF
ENDIF
ENDIF
END RELATIONS
ADD FEATURE (initial number 1)
INTERNAL FEATURE ID  1
DATUM PLANE

  NO.     ELEMENT NAME    INFO                                                
  —     ————-   ————-                                       
   1      Feature Name    Defined                                             
   2      Constraints     Defined                                             
   2.1    Constraint #1   Defined                                             
   2.1.1  Constr Type     X Axis                                              
   3      Flip Datum Dir  Defined                                             
   4      Fit             Defined                                             
   4.1    Fit Type        Default                                             

NAME = ASM_RIGHT

    FEATURE IS IN LAYER(S) :
      01__ASM_ALL_DTM_PLN – OPERATION = SHOWN
      01__ASM_DEF_DTM_PLN – OPERATION = SHOWN

END ADD
ADD FEATURE (initial number 2)
INTERNAL FEATURE ID  3
DATUM PLANE

  NO.     ELEMENT NAME    INFO                                                
  —     ————-   ————-                                       
   1      Feature Name    Defined                                             
   2      Constraints     Defined                                             
   2.1    Constraint #1   Defined                                             
   2.1.1  Constr Type     Y Axis                                              
   3      Flip Datum Dir  Defined                                             
   4      Fit             Defined                                             
   4.1    Fit Type        Default                                             

NAME = ASM_TOP

    FEATURE IS IN LAYER(S) :
      01__ASM_ALL_DTM_PLN – OPERATION = SHOWN
      01__ASM_DEF_DTM_PLN – OPERATION = SHOWN

END ADD
ADD FEATURE (initial number 3)
INTERNAL FEATURE ID  5
DATUM PLANE

  NO.     ELEMENT NAME    INFO                                                
  —     ————-   ————-                                       
   1      Feature Name    Defined                                             
   2      Constraints     Defined                                             
   2.1    Constraint #1   Defined                                             
   2.1.1  Constr Type     Z Axis                                              
   3      Flip Datum Dir  Defined                                             
   4      Fit             Defined                                             
   4.1    Fit Type        Default                                             

NAME = ASM_FRONT

    FEATURE IS IN LAYER(S) :
      01__ASM_ALL_DTM_PLN – OPERATION = SHOWN
      01__ASM_DEF_DTM_PLN – OPERATION = SHOWN

END ADD
ADD FEATURE (initial number 4)
INTERNAL FEATURE ID  7
TYPE = COORDINATE SYSTEM
NAME = ASM_DEF_CSYS
    FEATURE IS IN LAYER(S) :
      05__ASM_ALL_DTM_CSYS – OPERATION = SHOWN
      05__ASM_DEF_DTM_CSYS – OPERATION = SHOWN

END ADD

ADD PART BLOCK_A
INTERNAL COMPONENT ID 39
END ADD

ADD COMPONENT (VAR_NAME) /*该行代码是根据参数VAR_NAME值来选择装配的元件*/
INTERNAL COMPONENT ID 40
PARENTS = 39(#5)
END ADD

MASSPROP
END MASSPROP