Associated Files
Save Pdf Dwg and Step V1.1 Full.swp
|
Downloads: | 678 |
Description: | This macro automates the process of saving SolidWorks drawings, their associated 3D models, and managing custom properties based on certain criteria. Users can use this macro to streamline their workflow when working with SolidWorks drawings.
1-Check if a Drawing is Open: The macro starts by checking if a drawing document is open. If not, it displays an error message and exits.
2-Get Drawing Information: It gets information from the opened drawing, such as file path.
3-Check and Create PDF Folder: It checks if a folder named "PDF" exists in the same directory as the drawing file. If not, it creates the folder.
4-Get the Second View: It gets the second view in the drawing (if available).
5-Get Custom 2D Drawing Properties: It attempts to get custom properties like "Draw number," "Description," and "Revision" from the drawing.
6-Get 3D Model Properties: If the 2D drawing properties are not set, it attempts to get these properties from the referenced 3D model.
7-Check for Empty Properties: It checks if any of the properties (drawNumber, description, revision) are empty. If they are, it displays an error message.
8-Generate File Names: It generates file names for PDF, DWG, and STEP files based on the properties.
9-Save Drawing as PDF: It saves the drawing as a PDF file in the "PDF" folder.
10-Check PDF Saving Success: It checks if the PDF file was saved successfully.
11-Check and Create DWG Folder: It checks if a folder named "DWG" exists in the same directory as the drawing file. If not, it creates the folder.
12-Save Drawing as DWG: It saves the drawing as a DWG file in the "DWG" folder.
13-Call SaveModelAsSTEP: It calls the SaveModelAsSTEP subroutine to save the referenced 3D model as a STEP file if it's not an assembly.
14-SaveModelAsSTEP Subroutine: This subroutine checks if the document is a part (not an assembly), edits and rebuilds the 3D model, and then saves it as a STEP file in the "STEP" folder.
15-IsDrawing and IsAssembly Functions: These f |
Precondition:
|
Run the macro with an open drawing right after you have edited the code with the custom properties that are found in the file. |
Postcondition:
|
This macro, when launched in the design environment, will create subfolders within the directory where the files are, and will save the design as .pdf and .dwg, it will also save the file associated with the design file as .step, if the file has a revision the files will be saved with the revision exponent. Finally, all files will be saved in their respective folders. |
SOLIDWORKS version:
|
Any |
Programming Language:
|
SW_VBA |