Class SldWorksExtensions
- Namespace
- Hymma.Solidworks.Extensions
- Assembly
- Hymma.Solidworks.Extensions.dll
extensions for SolidWorks.Interop.sldworks.SldWorks
public static class SldWorksExtensions
- Inheritance
-
SldWorksExtensions
- Inherited Members
Methods
FreezeGraphics(SldWorks)
sets visibility of solidworks to false
useful when you want to activate a document in silent mode
public static bool FreezeGraphics(this SldWorks solidworks)
Parameters
solidworksSldWorks
Returns
- bool
true if successful and false if not
make sure you set solidworks visibility to true at the end of operation UnFreezeGraphics(SldWorks)
Remarks
you should call this before any documents are open. In other words, if a document is open and you call this method, it will have not effect.
FreezeGraphics(SldWorks, Action)
freezes graphics during an Action and unfreeze it afterwards
public static void FreezeGraphics(this SldWorks solidworks, Action action)
Parameters
solidworksSldWorksactionAction
GetDefaultMapFilePath(SldWorks)
get the default map file in solidworks, does not check if map file actually exists on HDD
public static string GetDefaultMapFilePath(this SldWorks solidworks)
Parameters
solidworksSldWorks
Returns
- string
address of map file as set in solidworks settings
GetExecutableFullFileName(ISldWorks)
returns the path to SLDWORKS.exe on this computer.
public static string GetExecutableFullFileName(this ISldWorks sldWorks)
Parameters
sldWorksISldWorkscurrent running instance of SolidWorks
Returns
- string
path to SOLIDWORKS.exe on this computer
GetModel(SldWorks, string, string)
opens and activates a specific solidworks document
public static ModelDoc2 GetModel(this SldWorks solidworks, string modelPathName, string configuration)
Parameters
Returns
- ModelDoc2
GetModelType(SldWorks, string)
get the type of a solidworks document its extension name
public static swDocumentTypes_e GetModelType(this SldWorks solidworks, string modelPathName)
Parameters
solidworksSldWorksmodelPathNamestringfull file name of the document including the extensions
Returns
- swDocumentTypes_e
GetPreviewImage(ISldWorks, string, string)
get the preview thumbnail of the path provided. regardless the file is open or not.
public static Bitmap GetPreviewImage(this ISldWorks solidworks, string path, string configuration)
Parameters
solidworksISldWorkspathstringpath to the solidworks document.
configurationstringname of the configuration of the document
Returns
Remarks
Currently only in-process applications(that is add-ins) can use this method; out-of-process applications(that is, executables) will get an COMException error because the IPictureDisp interface cannot be marshalled across process boundaries.This is a Microsoft behavior by design.See the Microsoft Knowledge Base for details.
This method is not supported in macros or out-of-process applications in SOLIDWORKS x64.
Exceptions
UnFreezeGraphics(SldWorks)
unfreezes the graphics of the solidworks application
public static void UnFreezeGraphics(this SldWorks solidworks)
Parameters
solidworksSldWorks