版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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 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 c
3、ams 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 gl
4、obal 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 icur
5、rentlevel 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 icircl
6、e2rad = 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.documen
7、ts.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 ca
8、tia.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) op
9、art.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
10、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 ori
11、gin 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.shapefactor
12、y.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 defi
13、nition 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, _ inumbero
14、fcylinders+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 =
15、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 =
16、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 ocurrent
17、line1 = 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 = ofactory
18、2d.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.createreferencefromobj
19、ect(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)
20、 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.createrefere
21、ncefromobject(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 refere
22、nce set orefcircle1endpt = opart.createreferencefromobject(ocurrentcircle1.endpoint) dim orefcircle2startpt as reference set orefcircle2startpt = opart.createreferencefromobject(ocurrentcircle2.startpoint) dim orefcircle2endpt as reference set orefcircle2endpt = opart.createreferencefromobject(ocurr
23、entcircle2.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.addmonoelt
24、cst(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
25、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 ocons
26、traint = 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(catcsttyp
27、eon, _ 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.a
28、ddnewpad ( 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 = opart
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 商业综合体消防设施维保方案
- 医疗大模型临床应用评估方案
- 医院护理信息化建设方案
- 污水管网改造更新工程申请报告
- 橡胶塑料制品企业班组安全建设方案
- 智慧办公楼建筑设计方案
- 丝绸印染项目商业计划书
- 社区家长学校提质建设实施方案
- 社区养老中心建筑设计方案
- 托育综合服务中心室内环境管控规范
- 服务方案进度计划保障措施
- 专项突破4电路故障练习(课件)-浙教版八年级科学上册
- 山东省建筑工程质量风险分级管控实施差异化监管技术指南1.0(试行2022.9.30)
- T/CASTEM 1006-2022科技评估报告编制通用要求
- 急诊病人风险管理
- 中华民族共同体概论学习通超星期末考试答案章节答案2024年
- 林权代持协议书
- 构造地貌的形成-板块运动与地貌 教学设计高二地理人教版(2019)选择性必修1
- 中考物理《电功和电功率的计算》专项练习题(附有答案)
- GB/T 41261-2022过程工业报警系统管理
- GB/T 12703.4-2010纺织品静电性能的评定第4部分:电阻率
评论
0/150
提交评论