Package: pyswtools
pySwToolspySwTools is a combination of tools that I made to help me with my workflow when working with Solidworks. Sometimes it is not directly link to SW but more to what I do with the CAD models.InstallationYou can directly install it from pypi:pip install pySwToolsOr you can install it from this repository:pip install .If you are on windows, maybe the directory where the script is installed will not be on the PATH but it can be added to directly be able to use the script from a command prompt.ContributingIf you found a bug or if you have any idea for the project feel free to open a new issue on github ! And if you want to directly contribute, you are welcome.List of ressources that can be helpful when starting with the solidworks API:Solidworks APIPython examplesList of modulesCLI: handle all the modulesConfig: handle the configurationReady-dxf: Prep the dxf outputed from SW to be laser cuttedCopy-full-assembly: Update the relative link from an assembly after a copyAuto-export: export all the parts to.stlor.dxfStat: List all the parts from an assembly with their mass and densityClean: List all the unused files from an assemblyCLIIt is the main module of this project. It allows you to select the actions that you want to apply. To directly get help from the tool simply type:pyswtoolsConfigThis command helps you handling your config. By default, the config is the following:sw_version: 2022 # This is important to set the correct versionIf you want to modify the config, you need to first create a file with :pyswtools config initAnd you can reset to the default config with:pyswtools config init --forceIf you want to get the current config:pyswtools config dumpOr the path to the current config:pyswtools config dump --pathReady-dxfPrepare dxf files from solidworks to be laser cutted:Remove the solidworks text from the output dxf fileHow to useYou can use the following command:pyswtools ready-dxf /path/to/file.dxfIt will output aclean.dxffile.You can also provide the path to a directory with dxf insidepyswtools ready-dxf /path/to/directoryIt will output adirectory_cleaneddirectory with all the cleaned dxf. Do not include the/or\at the end of the path of the directoryCopy-full-assemblyThis tool help you when copying multiple file or assembly. It will help you by updating path reference to new path reference:In the equation managerHow to usepyswtools copy-full-assembly PATH_TO_DIR SRC_REPLACE TARGET_REPLACEPATH_TO_DIRis the path to directory with all the files to updateSRC_REPLACEis the string in the current path reference that you want to replace (probably the name of the old directory)TARGET_REPLACEis the string in the current path reference that you want to replace (probably the name of the new directory)Auto-exportThis tool help you export a directory (or a part) to other file extensions. The current exrports are:DXFSTLAutoThe Auto mode will use the name of the part and see if an extension is specified in it (e.g.DXF_my_part.SLDPRT)The DXF export will only work when there is only one body in the part. Also the face that will be exported is a planar one with the biggest surface.The STL export will consider the z axis as being the vertical dimension.How to usepyswtools auto-export PATH/TO/DIR MODEWithModebeingAUTO,DXForSTL. It will create directory with the extension used  and the corresponding files in it.StatThis tool help you get stat on an assembly. It can gives you recursive information about the mass and the density of each component of an assembly.How to usepyswtools stat PATH/TO/ASSEMBLY OPTIONSYou can select the display mode with--type-output:tree: (default) It will follow the structure from the assembly filelist: It will output to a single listYou can select the sort mode with--type-sort:mass: (default) sort with a decreasing total massmass-part: sort with a decreasing part massname: sort with alphabetical orderYou can get only the elements with a default density (1000 Kg/m³) with the option--only-default-density. This option only works with atypelist`CleanThis tool help you clean the directory of your project and remove unused filesHow to usepyswtools clean PATH/TO/DIR/PROJECT/ PATH/TO/MAIN/ASSEMBLYIt will output all the solidworks files inPATH/TO/DIR/PROJECT/that are not used in the assembly.