internal static bool SupportsHighResIcons(this ISldWorks app) { const int SW_2017_REV = 25; var majorRev = int.Parse(app.RevisionNumber().Split('.')[0]); return(majorRev >= SW_2017_REV); }
/// <summary> /// Returns the major version of SOLIDWORKS application /// </summary> /// <param name="app">Pointer to application to return version from</param> /// <param name="servicePack">Version of Service Pack</param> /// <param name="servicePackRev">Revision of Service Pack</param> /// <returns>Major version of the application</returns> public static SwVersion_e GetVersion(this ISldWorks app, out int servicePack, out int servicePackRev) { var rev = app.RevisionNumber().Split('.'); var majorRev = int.Parse(rev[0]); servicePack = int.Parse(rev[1]); servicePackRev = int.Parse(rev[2]); return((SwVersion_e)majorRev); }
public bool isAwake() { if (app.RevisionNumber() != null) { return(true); } else { return(false); } }
public void Startup() { try { app = StartSwApp(SW_PATH); System.Diagnostics.Debug.WriteLine(app.RevisionNumber()); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Failed to connect to SOLIDWORKS instance:" + ex.Message); } }
static void Main(string[] args) { using (var app = SwApplicationFactory.Create(SwVersion_e.Sw2020, ApplicationState_e.Background)) { ISldWorks swApp = app.Sw; Console.WriteLine(swApp.RevisionNumber()); var doc = app.Documents.Open(@"D:\model1.SLDPRT", Documents.Enums.DocumentState_e.ReadOnly); var swModel = (doc as ISwDocument).Model; Console.WriteLine(swModel.GetTitle()); app.Close(); } }
internal static bool SupportsHighResIcons(this ISldWorks app, HighResIconsScope_e scope) { var majorRev = int.Parse(app.RevisionNumber().Split('.')[0]); switch (scope) { case HighResIconsScope_e.CommandManager: return(majorRev >= (int)SolidWorksRevisions_e.Sw2016); case HighResIconsScope_e.TaskPane: return(majorRev >= (int)SolidWorksRevisions_e.Sw2017); default: Debug.Assert(false, "Not supported scope"); return(false); } }
internal static bool SupportsHighResIcons(this ISldWorks app, HighResIconsScope_e scope) { //TODO: rewrite this using the IsVersionNewerOrEqual var majorRev = int.Parse(app.RevisionNumber().Split('.')[0]); switch (scope) { case HighResIconsScope_e.CommandManager: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2016)); case HighResIconsScope_e.TaskPane: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2017)); case HighResIconsScope_e.MacroFeature: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2017)); default: //Debug.Assert(false, "Not supported scope"); return(false); } }