This code initializes the SOLIDWORKS application, gets the active document, and then opens a new part document at the file path specified. Example 2: Retrieving dimensions from a drawing document using ModelDoc2 interfacecsharp ModelDoc2 swModel; swModel = (ModelDoc2)swApp.ActiveDoc; if (swModel.GetType() == (int)swDocumentTypes_e.swDocDRAWING) { DrawingDoc swDrawing = (DrawingDoc)swModel; SelectionMgr swSelMgr = swDrawing.SelectionManager; int count = swSelMgr.GetSelectedObjectCount2(-1); if (count != 0) { Object[] vArray; vArray = (Object[])swSelMgr.GetSelectedObjects(); for (int i = 0; i < count; i++) { Dimension swDimension = (Dimension)vArray[i]; double value = swDimension.Value; string name = swDimension.Name; Console.WriteLine(name + ": " + value); } } } ``` This code checks if the active document is a drawing, and if so, retrieves the selected dimensions and prints their names and values to the console. ModelDoc2 is part of the SOLIDWORKS API, which is provided as a package with the SOLIDWORKS software.