TeklaAPI_图纸尺寸标注.pptx_第1页
TeklaAPI_图纸尺寸标注.pptx_第2页
TeklaAPI_图纸尺寸标注.pptx_第3页
TeklaAPI_图纸尺寸标注.pptx_第4页
TeklaAPI_图纸尺寸标注.pptx_第5页
已阅读5页,还剩30页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Tekla Open API Advanced Training,Drawing Plugins Bolt Dimension Sample,Charles Pool Solutions Engineer,Agenda,Some Key concepts Plugin Architecture Setup Plugin Basic Architecture Together Creating Actual Dimension in Drawing HelperMethods Questions and Answers,Date,2,Date,3,Some Key concepts,Drawin

2、g Handler Drawing Parts Views Dimensions,Tekla Open API Drawing Basic Training/ Charles Pool,Drawing Handler,new DrawingHandler(); Check if a drawing is currently open GetActiveDrawing() check if null or Drawing Gets Picker for getting input from user Closes, Saves, and Opens drawings Can open drawi

3、ng hidden in background SetActiveDrawing(myDrawing, false); Get drawings from drawing list,Date,4,Drawing objects,Drawing objects are not the same as model objects Presentation object that represents the model object in the drawing interface. E.g. Color, accuracy, symbol Can be many different types

4、of objects including text, lines, marks Can get model object identifier for the model part that the drawing part represents You can not change the Model object when a drawing is open, but you can get information from it,Date,5,Drawing Bolt vs. Model Bolt,Date,6,Tekla.Structures.Drawing.Bolt,Tekla.St

5、ructures.Model.BoltGroup,Drawing Architecture (Assembly Drawing with Single Part),Date,7,Example Assembly Drawing,Date,8,Container View - Sheet,View (Assembly Front View),Container View,View (Single Part),Dimension Architecture,Date,9,Drawing Part,Offset,Direction Vector,Dimension Points,Dimension D

6、irection Vectors,Sets the up position relative to the direction that is to be dimensioned, always *90 from dimension line Horizontal, Vertical, Skew dimension Sets the direction to where dimension is placed Left, Right, Up, Down from object it is dimensioning Set using a Vector (x value, y value, z

7、value) Relative to DisplayCoordinateSystem,Date,10,StraightDimensionSetHandler,new StraightDimensionSetHandler(); Easiest way to create dimension set Set is multiple dimensions grouped together CreateDimensionSet(View, Points, Direction, Offset);,Date,11,2011 User Meeting / Charles Pool,Example: Cre

8、ate dimension to bolts,Date,12,Date,13,Plugin Architecture,Getting input from user, starting plugin Examine Startup template architecture,Tekla Open API Drawing Basic Training/ Charles Pool,Startup Class,Start new project using template “UM11_DrawingPlugin_Dimension” Open PluginStartupClass.cs This

9、class contains the main plugin meat”, the run() and DefineInput() Use this to get user input and setup the initial plugin behavior,Date,14,Tekla Open API Drawing Basic Training/ Charles Pool,Plugin Settings,Plugin has name Shown in ComponentCatalog Dependancy UI (INP based versus WinForms) Update me

10、thod Must inherit the DrawingPluginBase,Date,15,Tekla Open API Drawing Basic Training/ Charles Pool,Internals and Constructor,Store attributes data, can use Property Must have public Constructor,Date,16,Tekla Open API Drawing Basic Training/ Charles Pool,Plugin Attributes,Data from UI Can be in the

11、same startup class or separate class as shown here Define public attributes Set the StructuresField to match exactly the WinForm Property for AttributeName and type should also match the AttributeTypeName field,Date,17,Tekla Open API Drawing Basic Training/ Charles Pool,Always passed a List to store

12、 user inputs. Run only once when plugin is inserted Used for getting pick points and objects from user for plugin input Store input from user into List, return List Use try, catch with: Add Input using:,Date,18,Tekla Open API Drawing Basic Training/ Charles Pool,Inherits the List input as an argumen

13、t automatically from the DefineInput() method Extract data from inputs List using InputDefinitionFactory.GetView(inputs0); InputDefinitionFactory.GetPoint(inputs0); Load defaults from UI attributes Get model objects needed from drawing objects,Date,19,Tekla Open API Drawing Basic Training/ Charles P

14、ool,Bug Workarounds: Work plane,When plugin inserts the current coordinate system is different than when the plugin is modified Can explicitly set the work plane to desired place so that it is always consistent Set manually for now: HelperMethods.SetWorkPlane(myView.DisplayCoordinateSystem);,Date,20

15、,Tekla Open API Drawing Basic Training/ Charles Pool,Bug Workarounds: View select,When getting the view it is not always selected by default When getting objects from the view they will not always be selected in the view coordinate system Run myView.Select() manually for now,Date,21,Tekla Open API D

16、rawing Basic Training/ Charles Pool,Bug Workarounds: Check Identifer.ID,When getting drawing part from picker, in some cases the ModelIdentifier.ID has a value of 0 In such cases it will not be possible to get the model equivalent part from the drawing part and most likely your application will need

17、 to catch this and terminate Example Catch:,Date,22,Tekla Open API Drawing Basic Training/ Charles Pool,Launching separate class to run logic from input,Not required but makes plugin easier to manage Can return bool value from child method,Date,23,Tekla Open API Drawing Basic Training/ Charles Pool,

18、Date,24,Setup Plugin Basic Architecture Together,BoltDimension1,Tekla Open API Drawing Basic Training/ Charles Pool,In group:,1 person coding Several brainstorming Start with MS Visual Studio Plugin Template UM11_DrawingPlugin_Dimension,Date,25,Tekla Open API Drawing Basic Training/ Charles Pool,Sta

19、rt with PluginStartup.cs,Setup input in DefineInput() method Get point from user Store to inputs Fill in Run() method Get data from inputs (view, model part) Get input defaults Launch separate class to create new template BoltDimension.cs,Date,26,Tekla Open API Drawing Basic Training/ Charles Pool,U

20、ser Interface and Attributes,Open Designer View for MainForm Create needed text or combo boxes Create new always For each field set the values for the Tekla Structures attributes,Date,27,Tekla Open API Drawing Basic Training/ Charles Pool,Open PluginAttributes.cs For each field in UI with Tekla Stru

21、ctures attributes set, create new fields here that match,Date,28,Creating Actual Dimension in Drawing,DimensionLogic,Tekla Open API Drawing Basic Training/ Charles Pool,Main logic,Code for this section us under the folder TemplateLogic Open BoltDimension.cs Start with CreateDimension() Method Notice

22、 arguments from PluginStartup,Date,29,Tekla Open API Drawing Basic Training/ Charles Pool,Main logic for you to implement: Add bolt points from group Add additional picked point from user Setup dimension direction vectors Set distance past object constant: E.g. 200mm Create new Dimension set handler

23、 with attributes Create new X direction dimension Create new Y direction dimension,Date,30,Tekla Open API Drawing Basic Training/ Charles Pool,Dimension Set Hander Tips,Creating a new handler: var dimSetHandler = new StraightDimensionSetHandler(); Creating a new settings object: var settings = new StraightDimensionSet. StraightD

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论