Framework for .NET (C# and VB.NET) to create modern application for CAD systems (SOLIDWORKS)
Get technical support Access source code Explore code and application examples

Using xCAD to create out-of-process (stand-alone) applications

xCAD framework can be used to create out-of-process (stand-alone) applications, such as Console, Windows Forms, WPF etc. in .NET Framework or .NET Core.

Call SwApplicationFactory.Create to connect to SOLIDWORKS instance in one of the following ways:

  • To the specified SOLIDWORKS version
  • To the latest SOLIDWORKS version (set the value of vers parameter to null)
  • By optionally providing additional arguments

In order to connect to existing (running process of SOLIDWORKS) use SwApplicationFactory.FromProcess method and pass the pointer to Process

using SolidWorks.Interop.sldworks;
using System;
using System.Threading.Tasks;
using Xarial.XCad.Documents;
using Xarial.XCad.Documents.Structures;
using Xarial.XCad.Enums;
using Xarial.XCad.SolidWorks;
using Xarial.XCad.SolidWorks.Documents;
using Xarial.XCad.SolidWorks.Enums;

namespace Xarial.XCad.Documentation
    class Program
        static void Main(string[] args)
            using (var app = SwApplicationFactory.Create(SwVersion_e.Sw2020, ApplicationState_e.Background))
                ISldWorks swApp = app.Sw;

                var doc = app.Documents.Open(@"D:\model1.SLDPRT", Documents.Enums.DocumentState_e.ReadOnly);

                var swModel = (doc as ISwDocument).Model;



Refer Console Model Generator example which demonstrates how to access xCAD.API from .NET Core console.

Powered by Docify