https://github.com/openvmp/partcad Skip to content Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} openvmp / partcad Public * Notifications * Fork 1 * Star 37 Package manager for CAD files and modelling framework for mechanical systems License Apache-2.0 license 37 stars 1 fork Activity Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Security * Insights openvmp/partcad This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/o] Use Git or checkout with SVN using the web URL. [gh repo clone openvm] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit Roman Kuzmenko Added a Discord channel link ... 1b27852 Dec 24, 2023 Added a Discord channel link 1b27852 Git stats * 11 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .vscode Packaging fixes to make the twine checks pass December 24, 2023 12:47 docs First version that handles simple tests December 15, 2023 21:33 examples Added "pc list-all". Stabilized "pc show". December 24, 2023 12:18 src/partcad Added "pc list-all". Stabilized "pc show". December 24, 2023 12:18 tests Added "pc list-all". Stabilized "pc show". December 24, 2023 12:18 .gitattributes Basic functionality: init, install, add, list, show... December 23, 2023 11:51 .gitignore Packaging fixes to make the twine checks pass December 24, 2023 12:47 LICENSE.txt First version that handles simple tests December 15, 2023 21:33 README.md Added a Discord channel link December 24, 2023 13:19 apache20.svg First version that handles simple tests December 15, 2023 21:33 pyproject.toml Packaging fixes to make the twine checks pass December 24, 2023 12:47 requirements.txt Basic functionality: init, install, add, list, show... December 23, 2023 11:51 tox.ini First version that handles simple tests December 15, 2023 21:33 View code [ ] PartCAD Installation Usage Create new package Add a dependency Create a basic assembly Render your project Modelling Parts Assemblies Scenes Packages Export Visualization Other modelling formats Purchasing / Bill of materials Tools for mechanical engineering History README.md PartCAD License PartCAD is the first package manager for CAD models, and a Python package to consume these packages in CAD scripts (cadquery and build123d). It brings the same power to CAD scripting as pip to Python, npm to JavaScript, maven to Java etc. Join our Discord channel! PartCAD allows to maintain information about mechanical parts, how they come together to form larger assemblies, and to reuse the same parts in multiple assemblies, multiple projects. The implementation of parts can change over time (e.g. optimize or migrate to CadQuery from STEP) without the need to update all of the consumers. * Installation * Usage + Create new package + Add a dependency + Create a basic assembly + Render your project * Modelling + Parts + Assemblies + Scenes + Packages * Export + Visualization + Other modelling formats + Purchasing / Bill of materials * Tools for mechanical engineering * History Installation The recommended method to install PartCAD for most users is: pip install partcad For contributors: git clone https://github.com/openvmp/partcad.git cd partcad python3 -m pip install -e . Usage Create new package Initialize new PartCAD package in the current directory (create the default partcad.yaml): pc init Add a dependency Use the following command to import parts from another package: pc add Create a basic assembly Here is an example that uses PartCAD to create a sample assembly. # partcad.yaml import: partcad-index: type: git url: https://github.com/openvmp/partcad-index.git assemblies: assembly_01: # declare an assembly object # assembly_01.py import partcad as pc assy = pc.Assembly() # create an empty assembly pc.finalize(assy) # this is the object produced by this PartCAD script Render your project Use the following shell command to render PartCAD parts and assemblies in the current package (the current directory): pc render If you are using VS Code then you can simply run your PartCAD script while having OCP CAD Viewer view open. Modelling This frameworks allows to create large models and scenes, one part at a time, while having parts and assemblies often maintained by third parties. Parts PartCAD allows to define parts using any of the following methods: Method Example Result parts: STEP file bolt: [bolt] type: step Original CadQuery parts: [cube] Gateway cube: Interface Other methods to define parts are in coming soon (e.g. build123d). Assemblies Assemblies are defined as parametrized instructions how to put parts and other assemblies together. [logo] import partcad as pc if __name__ != "__cqgi__": from cq_server.ui import ui, show_object bolt = pc.get_part("example_part_step", "bolt") bone = pc.get_part("example_part_cadquery_logo", "bone") head_half = pc.get_part("example_part_cadquery_logo", "head_half") model = pc.Assembly() model.add(bone, loc=pc.Location((0, 0, 0), (0, 0, 1), 0)) model.add(bone, loc=pc.Location((0, 0, -2.5), (0, 0, 1), -90)) model.add(head_half, pc.Location((0, 0, 27.5), (0, 0, 1), 0)) model.add(head_half, pc.Location((0, 0, 25), (0, 0, 1), -90)) model.add(bolt, loc=pc.Location((0, 0, 7.5), (0, 0, 1), 0)) pc.finalize(model, show_object) Assembly parameters can be of two kinds: build time and run time. Assembly instances with different build time parameters are different assemblies, different models. Assembly instances with different run time parameters are the same assembly, just visualized in a different state (e.g. different motion state). Scenes Scenes are defined as parametrized instructions how to place assemblies relative to each other for visualization purposes. Scenes are intended to be used for visualization, simulation, validation and testing purposes. Scenes are not intended to be used outside of the package where they are defined. Packages Each PartCAD project is a separate package. Each package may export parts, assemblies and scenes. Each package may import parts, assemblies and scenes from its dependencies (other PartCAD packages). Method Example Local files import: (present in other_directory your own type: local source code path: ../../other repository) External GIT import: repository other_directory (HTTPS, SSH) type: git url: https://github.com/openvmp/partcad import: External tar ball other_directory (HTTPS) type: tar url: https://github.com/openv...090ca.tar.gz The full syntax is below: import: : desc: <(optional) textual description> type: path: <(local only) relative-path> url: <(git|tar only) url-of-the-package> relPath: <(git|tar only) relative-path-within-the-repository> web: <(optional) package or maintainer's url> poc: <(optional) maintainer's email> Export Visualization Individual parts, assemblies and scenes can be rendered and exported into the following formats: * PNG * STL Other modelling formats Additionally, assemblies and scenes can be exported into the following formats: * SDF (not yet / in progress) * FreeCAD project (not yet / in progress) Purchasing / Bill of materials The bill of materials for each assembly can be produced using the following formats: * CSV * Markdown Tools for mechanical engineering Here is an overview of the open source tools to maintain mechanical projects. It shows where does this framework fit in the modern mechanical development workflows. flowchart TB subgraph repo["Your project's GIT repository"] subgraph custom_repo["Custom parts"] direction TB custom_part_internet["A STEP file\ndownloaded from Internet\nor the vendor site"] custom_part_cad["A part exported as a solid\nfrom a CAD tool not\nsuitable for collaboration"] custom_part_cq["An individual reusable part\nmaintained as a script\nunder a version control system"] custom_part_os["Another reusable part\nmaintained as a script\nunder a version control system"] end model["Your project's model\ndefined as Python code\nfor version control\nand collaboration"] subgraph scenes["Scenes"] test1["Capability 1\ntest scene"] test2["Capability 2\ntest scene"] end end subgraph external_repos["Third-party GIT repositories,\nCDN-hosted files or OCCI servers"] subgraph external_repo["Repository of standard\nor popular parts"] end end subgraph external_tools["External tools"] freecad["FreeCAD"] cadquery["CadQuery"] openscad["OpenSCAD"] gazebo["Gazebo"] partcad["PartCAD library"] style partcad fill:#c00 end custom_part_cad <--- |Individual\ncontributor|freecad custom_part_cq <--- |Part design\nworkflow| cadquery custom_part_os <--- |Part design\nworkflow| openscad external_repo ---> |Import| model custom_repo ---> |Import| model model -.-> |Import| test1 model -.-> |Import| test2 custom_repo <-. Maintained\nusing\nPartCAD\nconvention .- partcad external_repo <-. Maintained\nusing\nPartCAD\nconvention .- partcad model <--- partcad test1 <--- partcad test2 <--- partcad test1 -.-> |Export| gazebo test2 -.-> |Export| gazebo History PartCAD is the evolution of the modelling framework that was once used internally in OpenVMP. It is now being maintained separately as a generic tool. The motivation behind this framework is to build a packaging and dependency tracking layer on top of CadQuery and traditional CAD tools to enable version control and other features required for effective collaboration. This framework currently uses CadQuery and, thus, OpenCASCADE under the hood. However this may change in the future if the python C bindings for OpenCASCADE remain a blocker for unlocking multithreaded performance. About Package manager for CAD files and modelling framework for mechanical systems Topics cad mechanical-engineering mechanical-design cadquery build123d Resources Readme License Apache-2.0 license Activity Stars 37 stars Watchers 1 watching Forks 1 fork Report repository Releases No releases published Languages * Python 100.0% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.