Public Member Functions | Public Attributes

MLSolidWorksApp Class Reference

MLSolidWorksApp implements the ISldWorks interface of SolidWorks. More...

#include <+SolidWorks/MLSolidWorksApp.h>

Inheritance diagram for MLSolidWorksApp:
Inheritance graph
[legend]
Collaboration diagram for MLSolidWorksApp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

function MLSolidWorksApp (in passkey)
 Class constructor of main SolidWorks Interface.
function ExitApplication (in obj)
 Exit SolidWorks and invalidate all references to SolidWorks.
function OpenDoc (in obj, in fullFileName)
 OpenDoc will open the cad file specified by the full file name.
function ActivateDoc (in obj, in name)
 Activates a document that has already been loaded.
function GetActiveDocRaw (in obj)
 Returns a raw COM pointer to the active doc.
function ActivateTaskPane (in obj, in swTaskPaneTab_e)
 Activates the specified task pane.
function AddFileOpenItem (in obj, in Cookie, in MethodName, in Description, in Extension, in OptionLabel, in OptionMethodName)
 Adds file types to the SolidWorks File Open dialog box.
function AddFileSaveAsItem (in obj, in Cookie, in MethodName, in Description, in Extension, in DocumentType)
 Adds a file type to the SolidWorks Save As dialog box.
function AddMenuItem (in obj, in DocumentType, in Cookie, in MenuItem, in Position, in MenuCallback, in MenuEnableMethod, in HintString, in BitmapFilePath)
 Adds a menu item and bitmap to the SolidWorks interface.
function AddMenuPopupItem (in obj, in DocumentType, in Cookie, in SelectType, in PopupItemName, in MenuCallback, in MenuEnableMethod, in HintString, in CustomNames)
 Adds a menu item, or submenu and menu item, to a shortcut menu.
function AddToolbar (in obj, in Cookie, in Title, in SmallBitmapImage, in LargeBitmapImage, in MenuPositionForToolbar, in DocumentType)
 A Windows-style, dockable toolbar that contains a set of application-defined buttons.
function AddToolbarCommand (in obj, in Cookie, in ToolbarId, in ToolbarIndex, in ButtonCallback, in ButtonEnableMethod, in ToolTip, in HintString)
 Specifies the application functions called by a toolbar button or sets a button to be a separator.
function AllowFailedFeatureCreation (in obj, in yesNo)
 Sets whether to allow the creation of a feature that has rebuild errors.
function ArrangeIcons (in obj)
 Arranges the icons in SolidWorks.
function ArrangeWindows (in obj, in style)
 Arranges the open windows in SolidWorks.
function BlockSkinning (in obj)
 Blocks skinning a window, which prevents a window from looking like a SolidWorks window.
function CheckpointConvertedDocument (in obj, in fullDocName)
 Saves the specified open document if its version is older than the version of the SolidWorks product being used.
function CloseAllDocuments (in obj, in includeUnsaved)
 Closes all open documents in the SolidWorks session.
function CloseDoc (in obj, in documentName)
 Closes the specified document.
function CreateNewWindow (in obj)
 Creates a client window containing the active document.
function DisplayStatusBar (in obj, in onOff)
 Sets whether to display the status bar.
function DocumentVisible (in obj, in visible, in swDocumentTypes_e)
 Allows the application to control the display of a document in a window upon creation or retrieval.
function GetActiveConfigurationName (in obj, in filePathName)
 Gets the name of the active configuration in the specified SolidWorks document.
function EnablePhotoWorksProgressiveRender (in obj, in enableIt)
 Enables or disables PhotoWorks progressive rendering.
function GetAddInObject (in obj, in ClassID)
 Gets an object from an add-in DLL.
function GetApplySelectionFilter (in obj)
 Gets the current state of the selection filter.
function GetConfigurationCount (in obj, in filePathName)
 Gets the number of configurations in the SolidWorks document, whether the document is opened or closed.
function GetCurrentFileUser (in obj, in filePathName)
 Gets the name of the user who has the the specified document open.
function GetCurrentLanguage (in obj)
 Gets the current language used by SolidWorks.
function GetCurrentMacroPathFolder (in obj)
 possible return values
function GetCurrentMacroPathName (in obj)
 Gets the path name for the macro currently running.
function GetCurrentWorkingDirectory (in obj)
 Gets the current working directory being used by the SolidWorks application.
function GetDataFolder (in obj, in showErrorMsg)
 Gets the data directory name currently used by SolidWorks.
function GetDocumentCount (in obj)
 Gets the number of open documents in the current SolidWorks session.
function GetDocumentDependencies (in obj, in document, in traverseflag, in searchflag, in addReadOnlyInfo)
 Gets all of the model dependencies for a document.
function GetDocuments (in obj)
 Gets the open documents is this SolidWorks session.
function RefreshTaskpaneContent (in obj)
 Refreshes the view of the Design Library tab in the Task Pane.
function ActivateEvents (in obj)
 Activates SolidWorks events for CADLab use.
function DeactivateEvents (in obj)
 Activates SolidWorks events for CADLab use.
function NewDocument (in obj, in documentType)
 Creates a new document given the type of document.
function GetEventsXMLFileName (in obj)
 Gets the full path to the Events Definition XML file.
function SetEventsXMLFileName (in obj, in eventsXMLFileName)
 Sets the full path to the Events Definition XML file.

Public Attributes

 FrameHeight
 Gets or Sets the SolidWorks window frame height.
 FrameLeft
 Gets or Sets the SolidWorks window frame left co-ordinate.
 FrameState
 Gets or sets the window state (minimum, maximum, or normal) for the SolidWorks window.
 FrameTop
 Gets or sets the top position of the SolidWorks window.
 FrameWidth
 Gets or sets the width of the frame of the SolidWorks window.
 Visible
 Gets and sets the visibility property of the SolidWorks application.
 CommandInProgress
 Improves performance of out-of-process applications by informing SolidWorks that a sequence of API calls will be made by the out-of-process application.
 EnableFileMenu
 Gets or sets whether to enable file-related menus and toolbars.
 TaskPaneIsPinned
 Gets or sets whether the SolidWorks Task Pane is pinned.
 UserControl
 Gets and sets whether the user has control over the application.
 UserControlBackground
 Gets and sets whether the user has control over the application.
 ActiveDoc
 Gets the currently active document.
 m_Application

Detailed Description

MLSolidWorksApp implements the ISldWorks interface of SolidWorks.

The MLSolidWorksApp This interface is the highest-level object in the SolidWorks API. This interface provides a general set of functions that allow application-level operations such as create, open, close, and quit documents, arrange icons and windows, change the active document, and create attribute definitions.

For more information please refer to the SolidWorks API documentation.


Constructor & Destructor Documentation

function MLSolidWorksApp ( in  passkey )

Class constructor of main SolidWorks Interface.


Member Function Documentation

function ActivateDoc ( in  obj,
in  name 
)

Activates a document that has already been loaded.

This file becomes the active document, and this method returns a pointer to that document object.

Parameters:
objis the instance if the object calling and is implicit.
'name'is the name of document to activate that is already open. It is a string value.
Return values:
retObjis a MLSolidWorksDoc object.

EXAMPLE: IMLSolidWorksPartDoc = thisObj.ActivateDoc('foobarAssembly');

function ActivateEvents ( in  obj )

Activates SolidWorks events for CADLab use.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
swLoadAddinError_eError status of loading the CADLabEventManager Add-In
function ActivateTaskPane ( in  obj,
in  swTaskPaneTab_e 
)

Activates the specified task pane.

Parameters:
objis the instance if the object calling and is implicit.
swTaskPaneTab_eis the an enum defined by swTaskPaneTab.

swTaskPaneTab has the following values:

CADLab.SolidWorks.MLSWConst.swTaskPaneTab.swDesignLibrary = 1; CADLab.SolidWorks.MLSWConst.swTaskPaneTab.swFileExplorer = 2; CADLab.SolidWorks.MLSWConst.swTaskPaneTab.swResources = 3; CADLab.SolidWorks.MLSWConst.swTaskPaneTab.swClipBoard = 4; CADLab.SolidWorks.MLSWConst.swTaskPaneTab.swCustomProps = 5;

Return values:
retObjis True if the specified task pane is activated, false if not.

EXAMPLE: isActive = thisObj.ActivateDoc(CADLab.SolidWorks.MLSWConst.swTaskPaneTab.swFileExplorer);

function AddFileOpenItem ( in  obj,
in  Cookie,
in  MethodName,
in  Description,
in  Extension,
in  OptionLabel,
in  OptionMethodName 
)

Adds file types to the SolidWorks File Open dialog box.

Parameters:
objis the instance if the object calling and is implicit.
Cookiespecified in ISwAddin::ConnectToSW
MethodNameName of the application function used to open the file
DescriptionFile description displayed in the Files of Type menu
ExtensionFile extensions separated by semicolons
OptionLabelLabel for your options button or an empty string
OptionMethodNameName of the callback method to display your dialog, which appears when a user clicks your options button, or an empty string
Return values:
retValTrue if the item was added, false if not.

For more information please refer to the SolidWorks API documentation.

function AddFileSaveAsItem ( in  obj,
in  Cookie,
in  MethodName,
in  Description,
in  Extension,
in  DocumentType 
)

Adds a file type to the SolidWorks Save As dialog box.

Parameters:
objis the instance if the object calling and is implicit.
CookieCookie specified as defined in ISwAddin::ConnectToSW
MethodNameName of the application function used to save the file
DescriptionFile description
ExtensionFilename extension
DocumentTypeType of document to save as defined in swDocumentTypes_e
Return values:
retValTrue if the item was added to the menu, false if not.
function AddMenuItem ( in  obj,
in  DocumentType,
in  Cookie,
in  MenuItem,
in  Position,
in  MenuCallback,
in  MenuEnableMethod,
in  HintString,
in  BitmapFilePath 
)

Adds a menu item and bitmap to the SolidWorks interface.

Parameters:
objis the instance if the object calling and is implicit.
DocumentTypeDocument type to which the menu item is to be added as defined by swDocumentTypes_e
CookieCookie specified as defined in ISwAddin::ConnectToSW
MenuItemMenu string ("menuItem@subMenuString@menuString"); SolidWorks creates menus and submenus only if they do not already exist

  • NOTE: Use the & symbol to include an accelerator key, e.g, "MyItem@&File" adds MyItem to the File menu with an accelerator key. To display the accelerator key, press the Alt key in SolidWorks. The accelerator key is underlined.
PositionPosition at which to add the new menu item. The first item is at position 0; if Position is –1, the new menu item is added to the bottom of the list; this argument specifies the position of the menu item in relation to its immediate parent menu
MenuCallbackFunction to call when this menu item is selected
MenuEnableMethodOptional function that controls the state of the menu item

If specified, SolidWorks:

Calls this function before displaying the menu

Display of the menu item is controlled by the return value of MenuEnableMethod

If your method returns...

Then SolidWorks...

  • 0 - Deselects and disables the menu item
  • 1 - Deselects and enables the menu item; this is the default menu state if no update function is specified
  • 2 - Selects and disables the menu item
  • 3 - Selects and enables the menu item
Parameters:
HintStringText to show in the SolidWorks status bar when the user moves their mouse over this menu item; if you specify a HintString, it must be preceded by a comma
BitmapFilePathPath and filename of bitmap
Return values:
retValSolidWorks runtime command ID or -1 if the method fails

For more information please refer to the SolidWorks API documentation.

function AddMenuPopupItem ( in  obj,
in  DocumentType,
in  Cookie,
in  SelectType,
in  PopupItemName,
in  MenuCallback,
in  MenuEnableMethod,
in  HintString,
in  CustomNames 
)

Adds a menu item, or submenu and menu item, to a shortcut menu.

Parameters:
objis the instance if the object calling and is implicit.
DocumentTypeDocument type as defined by swDocumentTypes_e
CookieCookie specified as defined in ISwAddin::ConnectToSW
SelectTypeSelection type as defined in swSelectType_e
PopupItemNameDescription displayed on the shortcut menu
MenuCallbackFunction to be called when the user clicks your menu item (see description in ISldWorks::AddMenuItem4)
MenuEnableMethodOptional function that controls the state of the menu item

If specified:

SolidWorks calls this function before displaying the menu

Display of the menu item is controlled by the return value of MenuEnableMethod

If your method returns... Then SolidWorks...

  • 0 - Deselects and disables the menu item.
  • 1 - Deselects and enables the menu item (this is the default menu state if no update function is specified)
  • 2 - Selects and disables the menu item
  • 3 - Selects and enables the menu item
  • 4 - Hides the menu item
Parameters:
HintStringText to show in the SolidWorks status bar when the user moves their mouse over this menu item; if you specify a HintString, it must be preceded by a comma
CustomNamesSemi-colon separated list of the names of the custom feature types; this argument is applicable only if SelectType is a custom feature type (like swSelATTRIBUTES); in the case of swSelATTRIBUTES, set this field to the name of the attribute definition
Return values:
retValSolidWorks runtime command ID or -1 if the method fails
Remarks

Use the at-sign ("@") as a separator in PopupItemName to create a submenu. Enclosing PopupItemName in the double quotes (") adds a separator menu item.

For example, specifying:

  • "Edge" adds Edge to the shortcut menu
  • "Edge@Color" adds a submenu Edge and Color to the submenu Edge
  • "Edge@Appearance@Color" adds the submenu Edge, the submenu Appearance to the submenu Edge, and Color to the submenu Appearance
  • "Edge@" adds the submenu Edge and a separator to it
  • "Edge@Appearance@" adds the submenu Edge to the shortcut menu, the submenu Appearance to the submenu Edge, and a separator to the submenu Appearance
function AddToolbar ( in  obj,
in  Cookie,
in  Title,
in  SmallBitmapImage,
in  LargeBitmapImage,
in  MenuPositionForToolbar,
in  DocumentType 
)

A Windows-style, dockable toolbar that contains a set of application-defined buttons.

Parameters:
objis the instance if the object calling and is implicit.
CookieResource ID of the toolbar; this is the same cookie that you specified in ISwAddin::ConnectToSW
TitleTitle of the toolbar
SmallBitmapImageBitmap file to use for the small bitmap for the toolbar (see Remarks)
LargeBitmapImageBitmap file to use for the large bitmap for the toolbar (see Remarks)
MenuPositionForToolbarNot used (SolidWorks always puts toolbar names in alphabetical order)
DocumentTypeBitwise values indicating what frame window types should have this toolbar's name added to the View, Toolbars menu; values from swDocTemplateTypes_e
Return values:
retValToolbar ID for use with other methods or -1 if not created
Remarks

For information about using this method with the ISwAddin object, see Using ISwAddin to Create a SolidWorks Add-in.

This method:

  • Only operates properly when the application is implemented as a DLL and not as an .exe.
  • Adds the toolbar name to the View, Toolbars menu.
  • Only creates the toolbar and passes the image for the buttons to SolidWorks. To add functionality, use ISldWorks::AddToolbarCommand2.
  • The bitmap images should contain the bitmaps for each of the buttons, including separators, in the toolbar as a single bitmap. For a small bitmap, the image for each button must be 16x16; for a large bitmap, it must be 24x24. The bitmaps should use a 256-color palette. Use gray (RGB 192, 192, 192) for transparent areas in your bitmap.

If either SmallBitmapImage or LargeBitmapImage is NULL or empty, then the provided image is scaled to create the appropriately sized bitmap for the other argument.

When your add-in is unloaded, you must call ISldWorks::RemoveToolbar2 to remove this toolbar.

If you want the toolbar to show up in specific locations only, do not use the now obsolete ISldWorks::ShowToolbar2 method. If your application uses that method, your application ignores the DocumentType argument. ISldWorks::ShowToolbar2 assumes that the application is controlling the visibility state of the toolbar, and not the user. This means that the toolbar will be available in all locations.

function AddToolbarCommand ( in  obj,
in  Cookie,
in  ToolbarId,
in  ToolbarIndex,
in  ButtonCallback,
in  ButtonEnableMethod,
in  ToolTip,
in  HintString 
)

Specifies the application functions called by a toolbar button or sets a button to be a separator.

Parameters:
objis the instance if the object calling and is implicit.
CookieResource ID of the toolbar. This is the same Cookie you specified in ISwAddin::ConnectToSW
ToolbarIdToolbar ID from SldWorks::AddToolbar4
ToolbarIndex0-based index of the bitmap button
ButtonCallbackFunction called when the user clicks the button
ButtonEnableMethodFunction called to check whether or not the button should be enabled; typically used to check the type of object selected (see Remarks)
ToolTipToolTip for the toolbar button
HintStringText that SolidWorks displays in the status bar when the user moves their mouse over this toolbar button
Return values:
retValTrue if successful, false if unsuccessful
Remarks

Call this method to specify the functions that get called by the SolidWorks software when the button is pressed and to check if the button is enabled. Until this method is called, the SolidWorks software does not display the button.

If ButtonEnableMethod is... Then in the user-interface, the button is...

  • 0 - Disabled and dimmed (also called grayed-out).
  • 1 - Enabled. This is the default state if an update function is not specified.
  • 2 - Disabled and pressed in.
  • 3 - Enabled and pressed in.

To create a separator, all of the method's string parameters (ButtonCallback, ButtonEnableMethod, ToolTip, and HintString) must be blank strings. A bitmap button must still be defined in the add-in's resources, but it will not be used.

function AllowFailedFeatureCreation ( in  obj,
in  yesNo 
)

Sets whether to allow the creation of a feature that has rebuild errors.

Parameters:
objis the instance if the object calling and is implicit.
yesNoTrue if features are to be created regardless of rebuild errors, false if not
Return values:
retValThe previous value, which is now replaced by the value for yesNo
Remarks

By default, features are not created when invalid geometry is specified; however, after calling this method with YesNo set to True, the features are created but with rebuild errors.

function ArrangeIcons ( in  obj )

Arranges the icons in SolidWorks.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValReturns the status. 0 is Ok and 1 indicates an error
function ArrangeWindows ( in  obj,
in  style 
)

Arranges the open windows in SolidWorks.

Parameters:
objis the instance if the object calling and is implicit.
styleType of arrangement where:

  • 0 - Cascade
  • 1 - Tile horizontally
  • 2 - Tile vertically
Return values:
retValReturns the status. 0 is Ok and 1 indicates an error
function BlockSkinning ( in  obj )

Blocks skinning a window, which prevents a window from looking like a SolidWorks window.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValTrue if successful, false if not
Remarks

You must call ISldWorks::ResumeSkinning after creating your unskinned window so that new windows created by SolidWorks and other add-ins are displayed as intended.

function CheckpointConvertedDocument ( in  obj,
in  fullDocName 
)

Saves the specified open document if its version is older than the version of the SolidWorks product being used.

Parameters:
objis the instance if the object calling and is implicit.
fullDocNameFull pathname of the file to save
Return values:
retVal0 for no error or a bitwise OR of the errors encountered as defined in swFileSaveError_e
Remarks

This saves the document even if the document is read-only. This method requires that the document is currently open in your SolidWorks session. It specifically checks if the document has been upgraded to the current version of the SolidWorks product in this session. If it has not, then this method has no effect.

Be careful when using this method because this method attempts to change the file permissions to read-write if the file is read-only, and if successful , it overwrites the file and restores the permission to read-only. Although it may appear the file is safe because it is read-only before and after the operation, it might have been overwritten by this method.

This method was designed to be used with the ISldWorks event DocumentConversionNotify. It does not require that the notification be used, but it should work in response to that notification.

function CloseAllDocuments ( in  obj,
in  includeUnsaved 
)

Closes all open documents in the SolidWorks session.

Parameters:
objis the instance if the object calling and is implicit.
includeUnsavedTrue = Close all documents, including the dirty documents false = Close all documents, excluding the dirty documents
Return values:
retValTrue if method executes successfully, false if not
function CloseDoc ( in  obj,
in  documentName 
)

Closes the specified document.

Parameters:
objis the instance if the object calling and is implicit.
documentNameName of document
function CreateNewWindow ( in  obj )

Creates a client window containing the active document.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValReturns the status. 0 is Ok and 1 indicates an error.
function DeactivateEvents ( in  obj )

Activates SolidWorks events for CADLab use.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
swLoadAddinError_eError status of unloading the CADLabEventManager Add-In
function DisplayStatusBar ( in  obj,
in  onOff 
)

Sets whether to display the status bar.

Parameters:
objis the instance if the object calling and is implicit.
onOffTrue if you want the status bar displayed, false if not
Return values:
retValReturns the status. 0 is Ok and 1 indicates an error.
function DocumentVisible ( in  obj,
in  visible,
in  swDocumentTypes_e 
)

Allows the application to control the display of a document in a window upon creation or retrieval.

Parameters:
objis the instance if the object calling and is implicit.
visibleTrue the documents of the specified type are displayed upon creation or retrieval, false they are not
swDocumentTypes_eType of document to which you apply visibility as defined in swDocumentTypes_e
Return values:
retValReturns the status. 0 is Ok and 1 indicates an error.
function EnablePhotoWorksProgressiveRender ( in  obj,
in  enableIt 
)

Enables or disables PhotoWorks progressive rendering.

Parameters:
objis the instance if the object calling and is implicit.
enableItTrue to enable PhotoWorks progressive rendering, false to not.
Return values:
retValReturns the status. 0 is Ok and 1 indicates an error.
function ExitApplication ( in  obj )

Exit SolidWorks and invalidate all references to SolidWorks.

objects

Parameters:
objis the instance if the object calling and is implicit.

EXAMPLE: thisObj.ExitApplication();

function GetActiveConfigurationName ( in  obj,
in  filePathName 
)

Gets the name of the active configuration in the specified SolidWorks document.

Parameters:
objis the instance if the object calling and is implicit.
filePathNamePath for the SolidWorks document
Return values:
retValName of the active configuration
function GetActiveDocRaw ( in  obj )

Returns a raw COM pointer to the active doc.

This function is mainly used for INTERNAL USE.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
modelDocObjis the raw COM pointer to the active doc.

swTaskPaneTab has the following values:

function GetAddInObject ( in  obj,
in  ClassID 
)

Gets an object from an add-in DLL.

Parameters:
objis the instance if the object calling and is implicit.
ClassIDClass ID of the add-in as registered with SolidWorks. See SolidWorks API help for more details
Return values:
addInDllObjectHandle to your add-in object. This is used by CADLab to get a handle to SolidWorks Simulation object.
function GetApplySelectionFilter ( in  obj )

Gets the current state of the selection filter.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValTrue if the selection filter is active, false if not
function GetConfigurationCount ( in  obj,
in  filePathName 
)

Gets the number of configurations in the SolidWorks document, whether the document is opened or closed.

Parameters:
objis the instance if the object calling and is implicit.
filePathNamePath and file name for the SolidWorks document
Return values:
retValNumber of configurations in SolidWorks document
function GetCurrentFileUser ( in  obj,
in  filePathName 
)

Gets the name of the user who has the the specified document open.

Parameters:
objis the instance if the object calling and is implicit.
filePathNameFull path and filename of the document
Return values:
retValUser name
function GetCurrentLanguage ( in  obj )

Gets the current language used by SolidWorks.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValCurrent Language
Remarks
Possible return values are:
  • chinese
  • chinese-simplified
  • czech
  • english
  • french
  • german
  • italian
  • japanese
  • korean
  • polish
  • portugese-brazilian
  • russian
  • spanish
function GetCurrentMacroPathFolder ( in  obj )

possible return values

Gets the name of the folder where the macro resides.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValName of the folder where macro resides
function GetCurrentMacroPathName ( in  obj )

Gets the path name for the macro currently running.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValPath name for the macro currently running
function GetCurrentWorkingDirectory ( in  obj )

Gets the current working directory being used by the SolidWorks application.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValCurrent working directory with trailing backslash

For more information please refer to the SolidWorks API documentation.

function GetDataFolder ( in  obj,
in  showErrorMsg 
)

Gets the data directory name currently used by SolidWorks.

Parameters:
objis the instance if the object calling and is implicit.
showErrorMsgTrue to show any error messages in a dialog or false to avoid these dialogs (that is, data directory could not be found messages)
Return values:
retValData directory currently used by the SolidWorks application
function GetDocumentCount ( in  obj )

Gets the number of open documents in the current SolidWorks session.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValNumber of open documents
function GetDocumentDependencies ( in  obj,
in  document,
in  traverseflag,
in  searchflag,
in  addReadOnlyInfo 
)

Gets all of the model dependencies for a document.

Parameters:
objis the instance if the object calling and is implicit.
documentName of the document
traverseflagTrue if you want to traverse down into all dependent files, false if you want only the highest level within the dependencies
searchflagSet this argument to True if you want to use the search rules to find dependencies, false looks where the documents were last saved
addReadOnlyInfoTrue if you wish to have read-only information with the filenames; false if not
Return values:
retValArray of strings with two strings for each document returned in this list of dependent files:

  • a. File name
  • b. Filename with the complete pathname; (this combination repeats itself for each dependent file found for this document)
function GetDocuments ( in  obj )

Gets the open documents is this SolidWorks session.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
retValArray of open documents in this SolidWorks session
function GetEventsXMLFileName ( in  obj )

Gets the full path to the Events Definition XML file.

Parameters:
objis the instance if the object calling and is implicit.
Return values:
eventsXMLFileThe full path to the Events Definition XML file.
function NewDocument ( in  obj,
in  documentType 
)

Creates a new document given the type of document.

Parameters:
objis the instance if the object calling and is implicit.
documentTypeType of new document wanted. It can be sldprt, sldasm or slddrw.
Return values:
retObjis a CADLab.SolidWorks.MLSolidWorksPartDoc, CADLab.SolidWorks.MLSolidWorksAssmDoc or CADLab.SolidWorks.MLSolidWorksDrwDoc object depending on the new document type.

EXAMPLE: IMLSolidWorksPartDoc = thisObj.NewDocument(`sldprt`); NOTE: Use SaveAs to save this document with an appropriate name.

function OpenDoc ( in  obj,
in  fullFileName 
)

OpenDoc will open the cad file specified by the full file name.

Parameters:
objis the instance if the object calling and is implicit.
fullFileNameis the full path to the SolidWorks file. It is a string value.
Return values:
retObjis a CADLab.SolidWorks.MLSolidWorksPartDoc, CADLab.SolidWorks.MLSolidWorksAssmDoc or CADLab.SolidWorks.MLSolidWorksDrwDoc object depending if the file is .SLDPRT, .SLDASM or .SLDDRW respectively.

EXAMPLE: IMLSolidWorksPartDoc = thisObj.OpenDoc('C:.sldprt');

function RefreshTaskpaneContent ( in  obj )

Refreshes the view of the Design Library tab in the Task Pane.

Parameters:
objis the instance if the object calling and is implicit.
function SetEventsXMLFileName ( in  obj,
in  eventsXMLFileName 
)

Sets the full path to the Events Definition XML file.

Parameters:
objis the instance if the object calling and is implicit.
eventsXMLFileNameThe full path incluing the file name to the EventsXML definition file

Member Data Documentation

Gets the currently active document.

It returns an instance of CADLab.SolidWorks.MLSolidWorksDoc.

This is a read-only property.

EXAMPLE: IMLSolidWorksDoc = thisObj.ActiveDoc;

Improves performance of out-of-process applications by informing SolidWorks that a sequence of API calls will be made by the out-of-process application.

The value is an boolean.

EXAMPLE: val = thisObj.CommandInProgress; thisObj.CommandInProgress = true;

Gets or sets whether to enable file-related menus and toolbars.

The value is an boolean.

EXAMPLE: val = thisObj.EnableFileMenu; thisObj.EnableFileMenu = true;

Gets or Sets the SolidWorks window frame height.

The value is an integer.

EXAMPLE: val = thisObj.FrameHeight; thisObj.FrameHeight = 800;

Gets or Sets the SolidWorks window frame left co-ordinate.

The value is an integer.

EXAMPLE: val = thisObj.FrameLeft; thisObj.FrameLeft = 800;

Gets or sets the window state (minimum, maximum, or normal) for the SolidWorks window.

The value is an integer.

EXAMPLE: swWindowState_e = thisObj.FrameHeight; thisObj.FrameHeight = CADLab.SolidWorks.MLSWConst.swWindowState_e.swWindowNormal;

swWindowNormal - The window is displayed in its normal state swWindowMaximized - The window fills the whole client area swWindowMinimized - The window is represented by an icon only

Gets or sets the top position of the SolidWorks window.

The value is an integer.

EXAMPLE: val = thisObj.FrameTop; thisObj.FrameTop = 800;

Gets or sets the width of the frame of the SolidWorks window.

The value is an integer.

EXAMPLE: val = thisObj.FrameWidth; thisObj.FrameWidth = 800;

m_Application [inherited]

Gets or sets whether the SolidWorks Task Pane is pinned.

The value is an boolean.

EXAMPLE: val = thisObj.TaskPaneIsPinned; thisObj.TaskPaneIsPinned = true;

Gets and sets whether the user has control over the application.

The value is an boolean.

EXAMPLE: val = thisObj.UserControl; thisObj.UserControl = true;

Gets and sets whether the user has control over the application.

The value is an boolean.

EXAMPLE: val = thisObj.UserControlBackground; thisObj.UserControlBackground = true;

Gets and sets the visibility property of the SolidWorks application.

The value is a boolean.

EXAMPLE: val = thisObj.Visible; thisObj.Visible = true;


The documentation for this class was generated from the following file: