Framework for .NET (C# and VB.NET) to create modern application for CAD systems (SOLIDWORKS, SOLIDWORKS Document Manager, Autodesk Inventor, etc.)
Get technical support Connect to xCAD community on Discord server Explore code and application examples xCAD.NET Templates for Visual Studio and VS Code Access source code

Entry Point of xCAD framework


public override void OnConnect()
    // Initialize the add-in, create menu, load data etc.

This function is called within the ConnectToSw entry point. Override this function to initialize the add-in.

Thrown an exception to indicate that the initialization is unsuccessful. This will cancel the loading of the add-in.

This override should be used to validate license (return false if the validation is failed), add command manager, task pane views, initialize events manager, etc.


public override void OnDisconnect()
    // Dispose the add-in's resources

This function is called within the DisconnectFromSw function. Use the function to release all resources. You do not need to release the com pointers to SOLIDWORKS or command manager as those will be automatically released by xCAD framework.

Accessing SOLIDWORKS application objects

xCAD framework provides the access to the SOLIDWORKS specific add-in data and objects which are preassigned by the framework. This includes pointer to SOLIDWORKS application, add-in id, pointer to command manager.

private void AccessSwObjects() 
    int addInCookie = this.AddInId;
    ISldWorks swApp = this.Application.Sw;
    ICommandManager cmdMgr = this.CommandManager.CmdMgr;

Powered by Docify