×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API: Save eDrawing data

API: Save eDrawing data

API: Save eDrawing data

(OP)
How to set the option to save eDrawing data into SolidWorks file with ModelDoc2::SaveAsSilent? Can it be done in API?
BR
Linqur

RE: API: Save eDrawing data

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.

RE: API: Save eDrawing data

(OP)
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

RE: API: Save eDrawing data

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.

RE: API: Save eDrawing data

(OP)
You are right about SaveAs5. I will  try that. Thanks for help so far.

Linqur

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources