C #-based SolidWorks plug-in development (1) -- SolidWorks API Introduction

Source: Internet
Author: User

This is a graduation project about SolidWorks plug-in development and company PDM integration written when I graduated two years ago. I have nothing to worry about recently.

 

1.1 SolidWorks API Interface

Correctly calling the SolidWorks API is the basis for completing the parametric design in the secondary development of SolidWorks. To call the SolidWorksAPI is to call SolidWorks events, methods, attributes, and related functions to complete the whole process of component entity modeling.

SolidWorks APIs are divided into two types: one is the IDispatch Technology Based on OLE Autonation, and the other is based on the Windows-based COM.

OLE (Object Linking and Embedding), short for OLE technology.

The IDispatch Technology Based on OLE Automation is a rapid development method. It is usually used in Interfaces of VB and Delphi programming languages and exposes the attributes and methods of objects through the IDispatch interface, to use these attributes in the client program and call the methods it supports. This technology can only develop programs in the form of EXE. The developed CAD system cannot be directly attached to the SolidWorks system interface and cannot be integrated with the SolidWorks system [12].

COM (Component Object Model, Component Object Model) [13] technology is the foundation of SolidWorks API. It is a standard protocol proposed by Microsoft and supported by most companies, it establishes a connection between a software module and another software module. After this connection is established, the two modules can communicate through interfaces. The COM interface is more concise and efficient. This technology can use the most SolidWorks API functions.

1.2 SolidWorks API object structure

Solidworks API organizes all interface objects through object-oriented ideas, as shown in 3.1

Solidworks API objects can be divided into the following categories.

(1) Application objects: The application objects include SldWorks, ModelDoc2, PartDoc, AssemblyDoc, and DrawingDoc.

(2) configuration file objects: configuration file objects manage the States of different modules (Part document mode) and different parts (assembly document mode) in the assembly body.

(3) event object: the Solidworks API provides event support, currently, the supported event types include AssemblyDoc, DrawingDoc, featm grview, ModelView, PartDoc, SldWorks, and SWPropertySheet.

(4) annotation object: Annotation of the Object Management document.

(5) model object: model object describes the internal data structure of SolidWorks.

(6) feature objects: Special Objects describe the feature operations provided by the SolidWorks application. These feature objects correspond to the feature operations provided by the SolidWorks software.

(7) Sketch objects: Sketch objects include all sketch elements, such as arcs, rectangles, and splines.

1.3 SolidWorks API object Overview

(1) SldWorks object: The SldWorks object is the parent class of all other objects and provides methods to directly or indirectly access all other SolidWorks API interfaces, in secondary development, access to other interfaces must pass through it. The SldWor ks object is the most important object in secondary development. Only through this object can the connection between the secondary development plug-in and the SolidWorks application be established.

(2) ModelDoc object: The ModelDoc object is a sub-object of the SldWorks object. It is also the parent object of all document model objects (PartDoc object, AssemblyDoc object, and DrawingDoc object, it encapsulates common attributes and methods for different document models, including document calling, closing, printing, and saving. In addition, the ModelDoc object provides methods to directly access the PartDoc object, AssemblyDoc object, and DrawingDoc object.

(3) PartDoc object: The PartDoc object provides operations in Part document mode.

(4) AssemblyDoc objects: AssemblyDoc objects are associated with the Assembly when managing the operations of the assembly body, such as importing parts, adding/canceling assembly relationships, and hiding/reality parts.

(5) DrawingDoc object: operations on the DrawingDoc object to manage the engineering drawing documents, such as creating, deleting, and viewing the documents.

(6) SelectionMgr object: The SelectionMgr object is a management object used to manage user selection operations. Through this object, you can obtain the elements that point to the current user selected in SolidWorks.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.