SolidWorksAPI是由组成组成SolidWorks 软件的COM组件提供的.
对象模型结构简介:
SldWorks对象最为根本,有他可以直接或间接的访问多有其他对象
部分对象只能间接地被访问,比如SketchSpline不能独自出现,只能存在于某种对象中,只能借助上一级来调用
另一部分API只能单独调用,因为用户界面中没有用于交互的对象
SolidWorks类层次结构
与MFC或.NET的层次结构不尽相同,因为它们十分依赖类的继承等,可以从类体系获得很多好处,而SolidWorks则基于COM的API,使用接口,接口继承,方法库返回已知或新建的对象的接口
通过QueryInterface在接口间跳跃
QueryInterface:
IAssemblyDoc, IDrawingDoc, or IPartDoc can QueryInterface to IModelDoc2.
IEdge, IFace2, IFeature, ILoop2, or IVertex can QueryInterface to IEntity.
IBomTableAnnotation, IHoleTableAnnotation, IRevisionTableAnnotation, or IWeldmentCutListAnnotation can QueryInterface to ITableAnnotation.
IAttribute also can QueryInterface to IFeature.
ISketchArc, ISketchEllipse, ISketchLine, ISketchParabola, ISketchPoint, ISketchSpline, or ISketchText can QueryInterface to ISketchSegment.
PropertyManagerPage controls, such as IPropertyManagerPageActiveX, IPropertyManagerPageBitmap, IProperty