{"id":15621796,"url":"https://github.com/ldevillez/pyswtools","last_synced_at":"2025-04-28T17:02:12.206Z","repository":{"id":160862451,"uuid":"490598239","full_name":"ldevillez/pySwTools","owner":"ldevillez","description":"Set of tools to improve Solidworks usage","archived":false,"fork":false,"pushed_at":"2024-12-16T15:17:19.000Z","size":121,"stargazers_count":7,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-18T18:33:15.314Z","etag":null,"topics":["cli","python3","solidworks","solidworks-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ldevillez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-10T07:59:21.000Z","updated_at":"2025-04-16T04:02:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"f190268c-4d5a-4f16-a36c-81502f737963","html_url":"https://github.com/ldevillez/pySwTools","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldevillez%2FpySwTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldevillez%2FpySwTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldevillez%2FpySwTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldevillez%2FpySwTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ldevillez","download_url":"https://codeload.github.com/ldevillez/pySwTools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251352525,"owners_count":21575859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","python3","solidworks","solidworks-api"],"created_at":"2024-10-03T09:51:51.263Z","updated_at":"2025-04-28T17:02:12.188Z","avatar_url":"https://github.com/ldevillez.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pySwTools\n\npySwTools 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.\n\n## Installation\n\nYou can directly install it from pypi:\n```\npip install pySwTools\n```\n\nOr you can install it from this repository:\n```\npip install .\n```\n\nIf 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.\n\n\n## Contributing\n\nIf 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.\n\nList of ressources that can be helpful when starting with the solidworks API:\n- [Solidworks API](https://help.solidworks.com/2022/french/SolidWorks/sldworks/c_solidworks_api.htm?verRedirect=1)\n- [Python examples](https://mycad.visiativ.com/sites/default/files/questions/answer/15/11/2019/solidworks_python_api.pdf)\n\n## List of modules\n\n- CLI: handle all the modules\n- Config: handle the configuration\n- Ready-dxf: Prep the dxf outputed from SW to be laser cutted\n- Copy-full-assembly: Update the relative link from an assembly after a copy\n- Auto-export: export all the parts to `.stl` or `.dxf`\n- Stat: List all the parts from an assembly with their mass and density\n- Clean: List all the unused files from an assembly\n\n### CLI\nIt 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:\n```\npyswtools\n```\n\n### Config\nThis command helps you handling your config. By default, the config is the following:\n```\nsw_version: 2022 # This is important to set the correct version\n```\n\nIf you want to modify the config, you need to first create a file with :\n```\npyswtools config init\n```\n\nAnd you can reset to the default config with:\n```\npyswtools config init --force\n```\n\nIf you want to get the current config:\n```\npyswtools config dump\n```\nOr the path to the current config:\n```\npyswtools config dump --path\n```\n\n\n### Ready-dxf\nPrepare dxf files from solidworks to be laser cutted:\n- Remove the solidworks text from the output dxf file\n\n#### How to use\nYou can use the following command:\n```\npyswtools ready-dxf /path/to/file.dxf\n```\n\nIt will output a `clean.dxf` file.\n\nYou can also provide the path to a directory with dxf inside\n\n```\npyswtools ready-dxf /path/to/directory\n```\n\nIt will output a `directory_cleaned` directory with all the cleaned dxf. Do not include the `/` or `\\` at the end of the path of the directory\n\n\n### Copy-full-assembly\nThis tool help you when copying multiple file or assembly. It will help you by updating path reference to new path reference:\n- In the equation manager\n#### How to use\n```\npyswtools copy-full-assembly PATH_TO_DIR SRC_REPLACE TARGET_REPLACE\n```\n- `PATH_TO_DIR` is the path to directory with all the files to update\n- `SRC_REPLACE` is the string in the current path reference that you want to replace (probably the name of the old directory)\n- `TARGET_REPLACE` is the string in the current path reference that you want to replace (probably the name of the new directory)\n\n### Auto-export\n\nThis tool help you export a directory (or a part) to other file extensions. The current exrports are:\n- DXF\n- STL\n- Auto\n\nThe Auto mode will use the name of the part and see if an extension is specified in it (e.g. `DXF_my_part.SLDPRT`)\n\nThe 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.\n\nThe STL export will consider the z axis as being the vertical dimension.\n\n#### How to use\n\n\n```\npyswtools auto-export PATH/TO/DIR MODE\n```\n\nWith `Mode` being `AUTO`, `DXF` or `STL`. It will create directory with the extension used  and the corresponding files in it.\n\n### Stat\nThis 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.\n\n#### How to use\n\n```\npyswtools stat PATH/TO/ASSEMBLY OPTIONS\n```\n\nYou can select the display mode with `--type-output`:\n- `tree`: (default) It will follow the structure from the assembly file\n- `list`: It will output to a single list\n\nYou can select the sort mode with `--type-sort`:\n- `mass`: (default) sort with a decreasing total mass\n- `mass-part`: sort with a decreasing part mass\n- `name`: sort with alphabetical order\n\nYou can select the type of compoments to include with `--filter`:\n- `all`: (default) get both parts and assemblies\n- `part`: get only parts. Works only for list display\n- `assembly`: get only assemblies\n\nYou can select the export that you want with `--export`:\n- `none`: (default) no export, only the display\n- `csv`: generate a `bom.csv` in the same directory as the solidworks project\n- `clipboard`: put the bom in the clipboard. You can copy paste it directly in excel\n\nYou can get only the elements with a default density (1000 Kg/m³) with the option `--only-default-density`. This option only works with a `type `list`\n\n### Clean\nThis tool help you clean the directory of your project and remove unused files\n\n#### How to use\n\n```\npyswtools clean PATH/TO/DIR/PROJECT/ PATH/TO/MAIN/ASSEMBLY\n```\nIt will output all the solidworks files in `PATH/TO/DIR/PROJECT/` that are not used in the assembly.\n\n### Properties\nThis tool help you duplicate properties from a template to files\n\n#### How to use\n\n```\npyswtools properties PATH/TO/DIR/TEMPLATE_PART PATH/TO/FILE\n```\nIt will add to `PATH/TO/FILE` the properties of `PATH/TO/DIR/TEMPLATE_PART`. If the target is a file, it will add the properties. If it is an assembly it will apply it to all its children instead.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldevillez%2Fpyswtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fldevillez%2Fpyswtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldevillez%2Fpyswtools/lists"}