Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API: Save eDrawing data

Status
Not open for further replies.

linqur

Mechanical
Mar 10, 2001
100
How to set the option to save eDrawing data into SolidWorks file with ModelDoc2::SaveAsSilent? Can it be done in API?
BR
Linqur
 
Replies continue below

Recommended for you

In SW2003, SaveAsSilent has been superseded by SaveAs4. In the settings, you can do a silent save and specify swSaveAsOptions_SaveEmodelData in the Options. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Well, I cannot find this:

swSaveAsOptions_e:
swSaveAsOptions_Silent - Save document silently or not

swSaveAsOptions_Copy - Save document as a copy or not

swSaveAsOptions_SaveReferenced - Save referenced documents or not (drawings and parts only)

swSaveAsOptions_AvoidRebuildOnSave - Avoid rebuild on Save or SaveAs, if swSaveAsOptions_Silent

swSaveAsOptions_UpdateInactiveViews - Update views of inactive sheets, if swSaveAsOptions_Silent

I take it from SW 2001+SP6 API help for command ModelDoc2.SaveAs4.

Linqur
 
Although I took it from 2003, the SaveAs4 should be the same, otherwise they would have made it SaveAs5. Here is what I have:

retval = ModelDoc2.SaveAs4 ( Name, Version, Options, &Errors, &Warnings )

Input:
(BSTR) Name
New name of the document. The file extension indicates any conversion that should be performed (for example, "Part1.igs" to save to IGES)
Input:
(long) Version
Version information for this save as defined in swSaveAsVersion_e
Input:
(long) Options
Option indicating how to save the document as defined in swSaveAsOptions_e
Output:
(long) Errors
Errors that caused the save to fail as defined in swFileSaveError_e
Output:
(long) Warnings
Warnings or extra information generated during the save operation as defined in swFileSaveWarning_e
Output:
(BOOL) retval
TRUE if the save is successful, FALSE if not

From swConst:
Public Enum swSaveAsVersion_e
swSaveAsCurrentVersion = 0 ' default
swSaveAsSW98plus = 1 ' save SW model in SW98plus model format - NO LONGER SUPPORTED
swSaveAsFormatProE = 2 ' save Sw part as Pro/E format .prt/.asm extension (not as Sw .prt/.asm)
End Enum

Public Enum swSaveAsOptions_e
swSaveAsOptions_Silent = &H1 ' Save document silently or not
swSaveAsOptions_Copy = &H2 ' Save document as a copy or not
swSaveAsOptions_SaveReferenced = &H4 ' Save referenced documents or not (drawings and parts only)
swSaveAsOptions_AvoidRebuildOnSave = &H8 ' Avoid rebuild on Save or SaveAs, if swSaveAsOptions_Silent
swSaveAsOptions_UpdateInactiveViews = &H10 ' Update views of inactive sheets, if swSaveAsOptions_Silent
swSaveAsOptions_OverrideSaveEmodel = &H20 ' Override system setting for saving emodel data of document
swSaveAsOptions_SaveEmodelData = &H40 ' If OverrideSaveEmodel is True, use this as the value instead
End Enum

Public Enum swFileSaveError_e
swGenericSaveError = &H1
swReadOnlySaveError = &H2
swFileNameEmpty = &H4 ' The filename must not be empty
swFileNameContainsAtSign = &H8 ' The filename can not contain an '@' character
swFileLockError = &H10
swFileSaveFormatNotAvailable = &H20 ' The save as file type is not valid
swFileSaveWithRebuildError = &H40 ' NO LONGER USED IN SW2001PLUS, moved to swFileSaveWarning_e
swFileSaveAsDoNotOverwrite = &H80 ' The user chose not to overwrite an existing file
swFileSaveAsInvalidFileExtension = &H100 ' The file extension differs from the Sw document type
End Enum

Public Enum swFileSaveWarning_e
swFileSaveWarning_RebuildError = &H1 ' The file was saved, but with a rebuild error
swFileSaveWarning_NeedsRebuild = &H2 ' The file was saved, but needs a rebuild
swFileSaveWarning_ViewsNeedUpdate = &H4 ' The file was saved, but views of inactive sheets need updating
End Enum

Messy, but that's it.
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
You are right about SaveAs5. I will try that. Thanks for help so far.

Linqur
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor