




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
option explicit copyright dassault systemes 2001* purpose : 创建一个凸轮轴 assumptions : dassault systemes author :cym_ languages : vbscript locales : english (united states) catia level : v5r14*number of cylinders - dim inumberofcylinders as integer shaft data - - shaft origin dim icenterx as integer dim 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 between 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 double 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 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 icircle2rad = 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.documents.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.update 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 (180) 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 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 shaft 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.shapefactory.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 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, _ inumberofcylinders+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 drad = 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 dccos = 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 ocurrentline1 = 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 = ofactory2d.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.createreferencefromobject(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(ocurrentcircle2) 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.createreferencefromobject(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 reference set orefcircle1endpt = opart.createreferencefromobject(ocurrentcircle1.endpoint) dim orefcircle2startpt as reference set orefcircle2startpt = opart.createreferencefromobject(ocurrentcircle2.startpoint) dim orefcircle2endpt as reference set orefcircle2endpt = opart.createreferencefromobject(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.addmonoeltcst(catcsttypereference, _ orefcircle2) - tangency line1 circle1 set oconstraint = oconstraints.addbieltcst(catcsttypetangency, _ orefline1, _ orefcircle1) - tangency line1 circle2 set oconstraint = oconstraints.addbieltcst(catcsttypetangency, _ orefcircle2, _ orefline1) - coincidence circle1 start 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 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(catcsttypeon, _ 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.shapefactory.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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025江苏南京技师学院招聘20人考前自测高频考点模拟试题及一套参考答案详解
- 基坑内搭设架体施工方案
- 2025汽车租赁合同规定范围
- 发展理论考试试题及答案
- 无锡网格员考试题及答案
- 黄浦区老厨房施工方案
- 热镀锌方管大棚施工方案
- 深泽自建轻钢房施工方案
- 进航银行从业考试及答案解析
- 基础护理题库华医网及答案解析
- 国家能源集团陆上风电项目通 用造价指标(2025年)
- 融媒体中心保密方案
- 输油管线牺牲阳极法阴极保护施工方案
- 篮球教学室内课件
- 2025年四川省高考历史试卷(含答案)
- 2025党考试题及答案
- 乳牙龋齿护理配合过程
- 2025至2030中国轨道交通行业发展分析及投资前景与战略规划报告
- 健康教育和健康促进课件
- 新东方合同协议书
- 2025年北京海淀区九年级中考二模数学试卷试题(含答案详解)
评论
0/150
提交评论