当前位置:文档之家› 三维详图设计软件Tekla Structures图纸尺寸标注二次开发

三维详图设计软件Tekla Structures图纸尺寸标注二次开发

三维详图设计软件Tekla Structures图纸尺寸标注二次开发摘要:本文介绍了三维详图设计软件tekla structures中采用.net二次开发技术的实际应用,通过实例介绍一个.net的二次开发,解决了软件创建的构件图尺寸定位不清晰,甚至混乱的情况。

关键词:.net三维详图设计软件详图深化设计 tekla structures 二次开发the developmentoftekla structures 3d detailing software for drawings dimension.zhou shubing(zhejiang hang xiao steel structure co.ltd,hang zhou)abstract: this article describes the tekla structures 3d detailing software using net secondary development of the practical application of the technology, a secondary development. net is introduced through examples, to resolve the size of the software component diagrams created position is not clear, and even confusionsituation.keywords:. net 3d detailing software design tekla structures detailing development中图分类号: u442.6 文献标识码: a 文章编号:1、引言tekla structures作为一个优秀的钢结构详图设计软件在建模及节点方面有巨大的优势,但其构件图纸表达方面,因其自身算法或者说中外图纸表达方式不同,其尺寸标注效果不尽人意,尤其是一些斜的连接板或非正交的构件,往往需要后期做大量人工处理。

这样势必导致工作效率的下降。

因此,对tekla structures进行二次开发,以提高工作效率和企业竞争力,具有重要意义。

针对用户需求,tekla structures公司在13.0的版本中推出了.net的接口,通过此接口,用户可以利用.net(可以选择 或c#语言)对建模、节点及图纸做一些二次开发,从而达到更加高效的目的。

下面作者通过.net开发梁构件图纸尺寸自动标注工具的一个实例,阐述tekla structures二次开发所能带来的优势,以期达到抛砖引玉的作用。

2、开发思路:作为一个典型的梁构件,其组成主要有连接板、劲板、支撑牛腿、支撑连接板等。

如何将这些零件准确定位,同时构件图面保持相对清晰整洁,方便车间工人按图加工制作构件,这就需要一个科学合理的尺寸标注原则。

结合多年工作经验及车间加工制作习惯,将标注的尺寸分3类:主零件轮廓尺寸、正交零件定位尺寸、斜交零件角度定位尺寸,例如:以支撑牛腿与梁中心交点作为工作点w.p.(working point),以板侧边、牛腿外侧中心点、支撑板外侧螺栓中心点作为组立点a.p.(assembling point),本次开发引进基准线定位原则,尺寸标注以梁最左边点作为基准线(base line),各定位点在增加到基准线长度的绝对尺寸。

连接板、劲板板、水平支撑板等于梁腹板连接的板件在构件顶视图中显示为清晰明确,故相关的尺寸标注在顶视图中,同时根据梁中心线将板件分为上下两道尺寸标注,如此两道尺寸加上一道构件总尺寸就将构件在腹板连接范围内的板件定位尺寸清晰的标注出来了,简洁不失精度要求。

同理在梁的前视图中主要表达与上下翼缘连接的支撑牛腿或板件。

3、所需实现的界面及功能:软件通过4个按钮来实现“顶视图”、前视图”、“剖视图”、“选择图纸列表批量标注”的功能。

4、代码实现过程简介:关键功能及代码介绍:“拾取视图”代码需用到tekla.structures.drawing.ui命名空间。

tsd.viewbase pickedviewbase;tsg.point pickedpoint;tsd.ui.picker picker= mydrawinghandler.getpicker(); picker.pickpoint(“请拾取视图内一点”, out pickedpoint, out pickedviewbase);程序通过此代码来触发标注程序的启动。

“获取零件”代码://获取当前视图的所有零件drawingobjectenumerator allparts =pickedview.getallobjects(typeof(tsd.part));//循环判断while (allparts.movenext()){tsd.modelobject modelobject =(tsd.modelobject)allparts.current;view partview = modelobject.getview() as view; getmodelobjectfromdrawingmodelobject(m ymodle, modelobject);...........}通过此代码,程序根据零件的图纸id来获取模型中的id,从而获取对应的空间几何信息。

以下为获取主零件空间定位信息及外轮廓点集的函数。

private void getmainpartpointandsize(tsm.modelobject modelobject, view partview, out pointlist beamoutsidepoints) {tsm.beam beam = modelobject as tsm.beam;//获取当前视图的坐标的转换矩阵matrix convmatrix =matrixfactory.tocoordinatesystem(partview.displaycoordina tesystem);获取主零件的最大点和最小点point beammaxpoint = beam.getsolid().maximumpoint; beammaxpoint = convmatrix.transform(beammaxpoint);//找到梁外轮廓点beamoutsidepoints = new pointlist();solid mainbeamsolid = beam.getsolid();faceenumerator faceenum =mainbeamsolid.getfaceenumerator();while (faceenum.movenext()){face face = faceenum.current as face;loopenumerator loopenum = face.getloopenumerator();while (loopenum.movenext()){loop loop = loopenum.current as loop;vertexenumerator vertexenum =loop.getvertexenumerator(); while (vertexenum.movenext()){point currentextrema = vertexenum.current as point; currentextrema = convmatrix.transform(currentextrema); currentextrema.z = 0;if (!beamoutsidepoints.contains(currentextrema)) beamoutsidepoints.add(currentextrema);}}}//找到梁外轮廓点结束}同理,可以编写板件的外轮廓控制点获取函数。

一般板件我们只需过滤出最大包围矩形的四个角度就可进行标注点的选择了。

其中currentextrema = convmatrix.transform(currentextrema);将模型空间的坐标值转换为当前图纸视图的坐标值非常关键,只有如此才能正确在图纸视图上标注尺寸。

获取控制点坐标列表后,通过“冒泡排序”方法来获取板件的最左、最右、最上、最下的点。

最后需对收集的点集进行标注,标注上部尺寸代码如下://定义标注方向vector updimvector = new vector(0, 1, 0);//定义标注线类型straightdimensionsethandler newdimset = newtsd.straightdimensionsethandler();//开始创建尺寸newdimset.createdimensionset(pickedview, updimpointlist, updimvector, 500, attributes);完成所有点集标注后,顶视图的尺寸自动标注功能就基本完成了。

同理可依次完成前视图、剖视图的尺寸自动标注功能。

5、效果:启动标注程序,分别点击“创建顶视图”、“创建前视图”、“创建剖视图”,选取视图内任一点,按创建如下所示典型梁截面的顶视图及前视图定位尺寸程序共耗时约6秒,若由人工创建则需3~5分钟,提升的效率非常明显,而且准确性更高。

6、结语:通过本例可见:在tekla structures软件平台上进行二次开发能够显著提高详图工作的准确性和工作效率,能够有效减少工期,使详图设计更为标准化、提高质量,有利于工厂加工制作。

相关主题