版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、option explicit copyright dassault systemes 2001* purpose : 创建一个凸轮轴 assumptions : dassault systemes author :cym_sd languages : vbscript locales : english (united states) catia level : v5r14*number of cylinders - dim inumberofcylinders as integer shaft data - - shaft origin dim icenterx as integer di
2、m icentery as integer - distance between two cams of two different cylinders dim icylinderspacing as integer - bearing diameter dim ibearingdiam as integer - distance between the cylinders centers dim ibearinglength as integer - pin diameter between two cams dim ipindiam as integer - distance betwee
3、n 2 cams of a single cylinder dim ipinlength as integer cam data - - thickness dim icamthickness as integer - circle 1 diameter dim icircle1rad as integer - circle 2 diameter dim icircle2rad as integer - distance between the 2 circle centers dim icircledist as integer pi definition - dim dpi as doub
4、le global data to define the different elements of the camshaft - - cam sketch and cam sketch elements dim ocurrentsketch as sketch dim ocurrentline1 as anyobject dim ocurrentline2 as anyobject dim ocurrentcircle1 as anyobject dim ocurrentcircle2 as anyobject - current distance from shaft origin dim
5、 icurrentlevel as integer part definition - - part dim opart as part - main tool of the part dim opartbody as body - definition of yz plane as work plane dim oplaneyz as reference * main program *sub catmain() - initialize global variables inumberofcylinders = 4 icamthickness = 15 icircle1rad = 25 i
6、circle2rad = 15 icircledist = 35 icentery = 0 icenterx = 0 icylinderspacing = 100 ipindiam = 15 ipinlength = 20 ibearingdiam = 32 ibearinglength = icylinderspacing - ipinlength - 2*icamthickness dpi = 3.14159265358979323846 icurrentlevel = 0 dim opartdocument as document set opartdocument = catia.do
7、cuments.add ( part ) set opart = opartdocument.part set opartbody = opart.mainbody set oplaneyz = opart.createreferencefromgeometry( opart.originelements.planeyz ) - shading view mode catia.activewindow.activeviewer.renderingmode = 1 msgbox create five bearings call createpatternbearing() opart.upda
8、te catia.activewindow.activeviewer.reframe msgbox create first cam set call createcamset (0) opart.update catia.activewindow.activeviewer.reframe msgbox create second cam set call createcamset (90) opart.update catia.activewindow.activeviewer.reframe msgbox create third cam set call createcamset (18
9、0) opart.update catia.activewindow.activeviewer.reframe msgbox create fourth cam set call createcamset (270) opart.update catia.activewindow.activeviewer.reframe msgbox create driving wheel call createcylinder (ipinlength/2, ibearingdiam ) opart.update catia.activewindow.activeviewer.reframe msgbox
10、this is the macro endend sub * purpose: defines the cylinders between cylinders inputs : *sub createpatternbearing() cylinder definition: pad from a circular sketch - - the yz plane is the sketch plane set ocurrentsketch = opartbody.sketches.add ( oplaneyz ) - the sketch is a circle centered on shaf
11、t origin and of ibearingdiam diameter dim ofactory2d as factory2d set ofactory2d = ocurrentsketch.openedition set ocurrentcircle1 = ofactory2d.createclosedcircle ( icenterx, icentery, ibearingdiam/2 ) ocurrentsketch.closeedition creation of the cylindrical pad dim opad as pad set opad = opart.shapef
12、actory.addnewpad ( ocurrentsketch, ibearinglength ) creating the pattern - dim originelements1 as originelements set originelements1 = opart.originelements dim orefplanexy as reference set orefplanexy = opart.createreferencefromgeometry( opart.originelements.planexy ) dim rectpattern1 as rectpattern
13、 definition of the pattern: - element to be duplicated - number of instances in first direction - number of instances in second direction - spacing in first direction - spacing in second direction - direction 1 - direction 2 - angle set rectpattern1 = opart.shapefactory.addnewrectpattern(opad, _ inu
14、mberofcylinders+1, _ 1, _ icylinderspacing, _ 0.0, _ 1, _ 1, _ orefplanexy, _ orefplanexy, _ true, _ true, _ 0.0) - update of the current level icurrentlevel = ibearinglengthend sub * purpose: creation of a cam from an angle value inputs : angle: the angle *sub createcam(angle) dim drad as double dr
15、ad = angle*dpi/180 dim ddsin1 as double ddsin1 = icircle1rad*sin(drad) dim ddcos1 as double ddcos1 = icircle1rad*cos(drad) dim ddsin2 as double ddsin2 = icircle2rad*sin(drad) dim ddcos2 as double ddcos2 = icircle2rad*cos(drad) dim dcsin as double dcsin = icircledist*sin(drad) dim dccos as double dcc
16、os = icircledist*cos(drad) create a sketch - set ocurrentsketch = opartbody.sketches.add ( oplaneyz ) create base elements in the sketch - dim ofactory2d as factory2d set ofactory2d = ocurrentsketch.openedition dim drad1 as double drad1 = drad - dpi/4 dim drad2 as double drad2 = drad + dpi/4 set ocu
17、rrentline1 = ofactory2d.createline ( _ icenterx - ddsin1, icentery + ddcos1, _ icenterx + dccos + ddsin2, icentery - dcsin + ddcos2 ) set ocurrentline2 = ofactory2d.createline ( _ icenterx + ddsin1, icentery - ddcos1, _ icenterx + dccos - ddsin2, icentery - dcsin - ddcos2 ) set ocurrentcircle1 = ofa
18、ctory2d.createcircle ( _ icenterx, icentery, _ icircle1rad, drad2, drad1) set ocurrentcircle2 = ofactory2d.createcircle ( _ icenterx + dccos, icentery + dcsin, _ icircle2rad, drad1, drad2) get references from elements to constraint - dim orefline1 as reference set orefline1 = opart.createreferencefr
19、omobject(ocurrentline1) dim orefcircle1 as reference set orefcircle1 = opart.createreferencefromobject(ocurrentcircle1) dim orefline2 as reference set orefline2 = opart.createreferencefromobject(ocurrentline2) dim orefcircle2 as reference set orefcircle2 = opart.createreferencefromobject(ocurrentcir
20、cle2) dim orefline1startpt as reference set orefline1startpt = opart.createreferencefromobject(ocurrentline1.startpoint) dim orefline1endpt as reference set orefline1endpt = opart.createreferencefromobject(ocurrentline1.endpoint) dim orefline2startpt as reference set orefline2startpt = opart.creater
21、eferencefromobject(ocurrentline2.startpoint) dim orefline2endpt as reference set orefline2endpt = opart.createreferencefromobject(ocurrentline2.endpoint) dim orefcircle1startpt as reference set orefcircle1startpt = opart.createreferencefromobject(ocurrentcircle1.startpoint) dim orefcircle1endpt as r
22、eference set orefcircle1endpt = opart.createreferencefromobject(ocurrentcircle1.endpoint) dim orefcircle2startpt as reference set orefcircle2startpt = opart.createreferencefromobject(ocurrentcircle2.startpoint) dim orefcircle2endpt as reference set orefcircle2endpt = opart.createreferencefromobject(
23、ocurrentcircle2.endpoint) create constraints - dim oconstraints as constraints set oconstraints = ocurrentsketch.constraints dim oconstraint as constraint - fix circle1 set oconstraint = oconstraints.addmonoeltcst(catcsttypereference, _ orefcircle1) - fix circle2 set oconstraint = oconstraints.addmo
24、noeltcst(catcsttypereference, _ orefcircle2) - tangency line1 circle1 set oconstraint = oconstraints.addbieltcst(catcsttypetangency, _ orefline1, _ orefcircle1) - tangency line1 circle2 set oconstraint = oconstraints.addbieltcst(catcsttypetangency, _ orefcircle2, _ orefline1) - coincidence circle1 s
25、tart point line1 start point set oconstraint = oconstraints.addbieltcst(catcsttypeon, _ orefcircle1startpt, _ orefline1startpt) - coincidence circle2 end point line1 end point set oconstraint = oconstraints.addbieltcst(catcsttypeon, _ orefcircle2endpt, _ orefline1endpt) - tangency line2 circle1 set
26、oconstraint = oconstraints.addbieltcst(catcsttypetangency, _ orefline2, _ orefcircle1) - tangency line2 circle2 set oconstraint = oconstraints.addbieltcst(catcsttypetangency, _ orefline2, _ orefcircle2) - coincidence circle1 end point line2 start point set oconstraint = oconstraints.addbieltcst(catc
27、sttypeon, _ orefcircle1endpt, _ orefline2startpt) - coincidence circle2 start point line2 end point set oconstraint = oconstraints.addbieltcst(catcsttypeon, _ orefcircle2startpt, _ orefline2endpt) ocurrentsketch.closeedition create the pad from the sketch - dim opad as pad set opad = opart.shapefact
28、ory.addnewpad ( ocurrentsketch, icamthickness + icurrentlevel ) opad.secondlimit.dimension.value = icurrentlevel*-1 end sub * purpose: create a cylindric pad inputs : thickness: length of the cylinder radius : radius of the cylinder *sub createcylinder(thickness, radius) - create a sketch set ocurrentsketch = opar
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年城市NOA渗透率22%市场规模百万台分析
- 2026年小学实验室安全教育
- 2026年AI幻觉频发错误医疗建议风险防范与验证机制
- 2026年GaN射频模块在6G基站设备中的应用:国博电子布局进展解析
- 投资方案经济效果评价的指标和方法
- 2026年网络安全攻防技术
- 急诊护理与医患沟通
- 急诊科专科护理标准化操作流程
- 泌尿外科护理中的心理支持技巧
- 2025-2026学年浙江省杭州市三墩中学八年级(上)月考数学试卷(1月份)(含答案)
- 2026年内蒙古公务员录用考试《行测》题(含答案)
- 2026年南京铁道职业技术学院单招职业技能测试题库附答案详解(考试直接用)
- 统编版2025-2026学年语文四年级下册 语文园地一 教学课件
- 2026年内蒙古机电职业技术学院单招职业技能测试题库附参考答案详解(b卷)
- 线路施工班组考核制度
- 2026年南京城市职业学院单招职业适应性考试题库及一套完整答案详解
- 2026四川能投综合能源有限责任公司招聘19人备考题库及答案详解(基础+提升)
- 2025年河南农业职业学院单招职业技能考试题库附答案解析
- 公共浴池卫生管理制度
- 第7课《月亮是从哪里来的》课件
- 人教版七年级数学下册《第七章相交线与平行线》单元测试卷(带答案解析)
评论
0/150
提交评论