三、对玻壳模具自动化设计的联合开发
根据对玻壳模具结构及其成型曲面的分析和设计数据的处理,运用UG中的知识熔接技术(UG/KF),把玻壳模具的设计方法、设计步骤和设计计算融合在一起,从而生成玻壳模具自动设计的UG/KF二次开发应用程序。联合开发的步骤为:用UG/KF编写DFA程序→编写Menuscript脚本文件→用UIStyler生成对话框→重新启动UG。
下面以玻壳锥凹模为例,介绍UG/KF、Menuscript和UIStyler对玻壳模具自动化设计的联合开发。
运用UG/KF编写的锥凹模自动设计程序如下:
#! UG/KF 19.0
DefClass:Funnel_Bottom_Mold (ug_base_part);
(string modifiable Parameter)Funnel_Glass_
Out_Surface_DataFile:
"e:\rqh\data_files\datafile_outter.prt";
(child) ss:{
class; ug_spreadsheet;
part_file; Funnel_Glass_Out_Surface
_DataFile:;
};
(list modifiable)range_number:ss:
ask_named_range:("iso_range");
(list modifiable) body_range_number: ss:ask_named_range:("body_range");
(number modifiable parameter) Funnel_
Bottom_MM_Long_Axis_Contraction: 1.90;
(number modifiable parameter) Funnel_
Bottom_MM_Diagonal_Axis_Contraction: 2.35;
(number modifiable parameter) Funnel_
Bottom_MM_Short_Axis_Contraction: 1.65;
(number modifiable parameter) Funnel_
Bottom_Thickness: 35;
(number modifiable parameter) Funnel_
Bottom_Base_Diameter: if(ss:ask_number:(2,4)/12.7>=20)then
275 else 250;
(number modifiable ) rad: Funnel_Bottom_
Base_Diameter:/2;
(number modifiable ) Funnel_Bottom_Tottal
_Height: ceiling(ss:ask_number:(2,1)
+5);
(number modifiable parameter) milling_part
_height: 3.5;
(Child) out:{
Class,botom_mold_sheet_out_simple;
datafile,Funnel_Glass_Out_Surface_
DataFile:;
value_long_axie,Funnel_Bottom_MM_
Long_Axis_Contraction:;
value_diagonal_axie,Funnel_Bottom_MM_
Diagonal_Axis_Contraction:;
value_short_axie,Funnel_Bottom_MM_
Short_Axis_Contraction:;
milling_part_height,milling_part_
height:;
};
(number modifiable) Leng:ss:ask_number:
(2,2)+Funnel_Bottom_Thickness:+10;
(number modifiable ) Wid: ss:ask_number:
(2,6)+Funnel_Bottom_Thickness:+10;
(child) block:{
class, ug_block ;
Length, Leng:;
Width, Wid:;
Height, ss:ask_number:(2,1);
Origin, Point(0,0,0);
X_Axis, Vector(1,0,0);
Y_Axis, Vector(0,1,0);
};
(child) out_offset:{
class, ug_offset_sheet_body ;
Face,{nth(1,ug_body_askFaces(out:
sheet_for_out:))};
Distance,-Funnel_Bottom_Thickness:;
Tolerances,{0.254,0.0254,0.0254};
};
(child)extend_out_offset:{
class, ug_extended_sheet;
Face,{nth(1,ug_body_askFaces(out_
offset:))};
Option, Tangent_Length;
Start_Object, {nth(1,ug_body_
askEdgeClosestToPoint(out_
offset:, Point(ss:ask_number:(2,4)
*cos(36.87), ss:ask_number:(2,4)*sin(36.87), ss:ask_number:(2,1))))};
Parameters, {10.0};
Tolerances, {0.0254,0.0254,0.0254};
};
(child)sew_surface:{
class, ug_sew_sheet;
Target_sheet,{out_offset:};
Tool_sheets,{extend_out_offset:};
Tolerances, {0.0254,0.0254,0.0254};
};
(child) out_offset_layer_control:{
class, ug_body; feature, {sew_surface:};
layer, 21;
};
(child) trim_body_1:{
class, ug_trim_body;
Target, {block:};
Trimming_Geometries,sew_surface:};
Retained_Face, {};
Reverse?, true;
};
…
…
…
(child)Bottom_mold_color_control:{
class, ug_body;
Feature,{Funnel_Bottom_With
_KeyWay:};
color, 12;
};
运用Menuscript和UIStyler生成的菜单和对话框如图1所示。

图1 菜单和对话框
在图1所示菜单栏中选择 “锥模具设计系统”→“锥模具设计”→“凹模设计”来调用锥凹模自动设计程序,会弹出“凹模设计参数”对话框。在该对话框中输入相应的参数后,单击“OK”或“APPLY”,程序会自动进行设计数据计算,完成锥凹模的设计并自动生成其三维造型,如图2所示。

图2 锥凹模的三维造型
四、结束语
运用知识熔接技术(UG/KF)、MenuScript和UIStyler可以实现系列化产品的自动化设计和标准零件库的建立,从而减少结构相同或相似的零件的重复建模,提高了设计效率和质量。