{"id":18370813,"url":"https://github.com/miho/occ-csg","last_synced_at":"2025-07-22T12:33:43.519Z","repository":{"id":47098386,"uuid":"126080836","full_name":"miho/OCC-CSG","owner":"miho","description":"Simple but powerful CSG tool based on OpenCascade","archived":false,"fork":false,"pushed_at":"2021-08-25T15:44:47.000Z","size":612,"stargazers_count":77,"open_issues_count":1,"forks_count":18,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-06T19:38:07.769Z","etag":null,"topics":["cad","csg","geometry","opencascade"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-20T20:51:05.000Z","updated_at":"2025-01-24T17:19:23.000Z","dependencies_parsed_at":"2022-08-24T03:20:42.634Z","dependency_job_id":null,"html_url":"https://github.com/miho/OCC-CSG","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/miho/OCC-CSG","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FOCC-CSG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FOCC-CSG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FOCC-CSG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FOCC-CSG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miho","download_url":"https://codeload.github.com/miho/OCC-CSG/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FOCC-CSG/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266496107,"owners_count":23938674,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cad","csg","geometry","opencascade"],"created_at":"2024-11-05T23:40:24.265Z","updated_at":"2025-07-22T12:33:43.490Z","avatar_url":"https://github.com/miho.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OCC-CSG\n\n[![Build Status](https://travis-ci.org/miho/OCC-CSG.svg?branch=master)](https://travis-ci.org/miho/OCC-CSG) [![Build status](https://ci.appveyor.com/api/projects/status/k4lxqsej71ughs48?svg=true)](https://ci.appveyor.com/project/miho/occ-csg)\n\n\nSimple but powerful CSG tool based on the [OpenCascade](https://www.opencascade.com/content/overview) CAD Kernel\n\nThis tool provides a simple command-line interface for applying boolean operations and transformations to 3D objects specified in either BREP/STEP or STL format. It contains a convenient STL importer for converting mesh based geometries to an eqivalent BREP representation (might cause performance issues for large STL files). Geometries can be exported as STL files as well.\n\nThere is a Java library [VCSG](https://github.com/miho/VCSG) and the corresponding [VRL-Studio plugin](https://github.com/miho/VRL-VCSG) for using OCC-CSG from Java and [VRL-Studio](https://vrl-studio.mihosoft.eu/).\n\n## Installation\n\nTo get started quickly, download a [binary release](https://github.com/miho/OCC-CSG/releases) (available for Linux, macOS and Windows on x64). On macOS occ-csg can be installed via [Homebrew](https://brew.sh):\n\n    brew install miho/tap/occ-csg\n\n## Sample\n\nThese three lines\n\n    occ-csg --create box -5,-5,-5,5,5,5 box.stp\n    occ-csg --create sphere 0,0,0,6.5 sphere.stp\n    occ-csg --csg difference box.stp sphere.stp cut.stp\n    \nproduce this hollow cube:\n\n\u003cimg src=\"resources/img/sample.jpg\" width=\"400px\"\u003e\n\nTo convert this resolution independent geometry to a triangulated STL file use:\n\n    occ-csg --convert cut.stp cut.stl 0.1\n\nThe number at the end specifies the tolerance for the STL triangulation. Smaller values lead to better approximations. If the value is ommitted a default value (currently 0.5) will be used. This is how the resulting STL might look like:\n\n\u003cimg src=\"resources/img/sample-stl.jpg\" width=\"400px\"\u003e\n\n## CLI\n\nTo get an overview over the CLI type `./occ-csg --help`:\n\n```\n-------------------------------------------------------------\n----        CSG Tool based on the OCCT CAD Kernel        ----\n----                    Version 0.9.9                    ----\n---- 2018-2019 by Michael Hoffer (info@michaelhoffer.de) ----\n----                   www.mihosoft.eu                   ----\n-------------------------------------------------------------\n\nUSAGE: \n\nHelp \u0026 Info:\n\n occ-csg --help\n occ-csg --version\n\nCreating Primitives:\n\n occ-csg --create box x1,y1,z1,x2,y2,z2                            box.stp\n occ-csg --create sphere x1,y1,z1,r                                sphere.stp\n occ-csg --create cyl x1,y1,z1,r,h                                 cyl.stp\n occ-csg --create cone x1,y1,z1,r1,r2,h                            cone.stp\n occ-csg --create helix r,profile_r,pitch,num_revolutions          helix.stp\n occ-csg --create helix r,profile_face.stp,pitch,num_revolutions   helix.stp\n occ-csg --create polygons x1,y1,z1,x2,y2,z2,... p1v1,p1v2,p1v3,...:p2v1,p2v2,p2v3,... polygons.stp\n occ-csg --create 2d:circle x,y,r                                  2dcircle.stp\n occ-csg --create 2d:polygon x1,y1,x2,y2,...                       2dpolygon.stp\n occ-csg --create 2d:rect x1,y1,x2,y2                              2drectangle.stp\n occ-csg --create 2d:round-rect x,y,width,height,corner_r          2drectangle.stp\n occ-csg --create extrusion:polygon ex,ey,ez,x1,y1,z1,x2,y2,z2,... extrude.stp\n occ-csg --create extrusion:file ex,ey,ez                          2dpath.stp extrude.stp\n\nFormat Conversion:\n\n occ-csg --convert file1.stl file1.stp\n occ-csg --convert file1.stp file1.stl 0.1\n\nGeometric Transformation:\n\n occ-csg --transform translate x,y,z                               file1.stp file1-translated.stp\n occ-csg --transform scale     sx,sy,sz                            file1.stp file1-scaled.stp\n occ-csg --transform rot       dir_x,dir_y,dir_z,angle file1.stp   file1-rotated.stp\n occ-csg --transform matrix    t1,t2,t3,...,t12 file1.stp          file1-transformed.stp\n\nBoolean Operators, Constructive Solid Geometry (CSG):\n\n occ-csg --csg union file1.stp file2.stp file-out.stp\n occ-csg --csg difference file1.stp file2.stp file-out.stp\n occ-csg --csg intersection file1.stp file2.stp file-out.stp\n\nShape Editing:\n\n occ-csg --edit split-shape shape.stp stp\n occ-csg --edit round-edges radius shape.stp shape-rounded.stp\n occ-csg --edit chamfer-edges radius shape.stp shape-chamfered.stp\n\n\nShape Info:\n\n occ-csg --info bounds file.stp      \n occ-csg --info bounds file.stp      bounds.stp\n occ-csg --info volume file.stp tol\n```\n\n## How to build OCC-CSG\n\n### Requirements\n\n- C+\\+ Compiler with C+\\+11 support (tested with Clang, GCC, MSVC+\\+ 2017 on x64)\n- CMake \u003e= 3.1\n- [OCC](https://github.com/miho/occ-for-occ-csg) \u003e= 7.3.0.x (official version is currently built with 7.4.0)\n\n#### Hints for building OCC:\n\nFor using `occ-csg` as independent command-line tool it is recommended to compile OCC as static library. This will increase the `occ-csg` file size but ensures the tool can be used without carrying too many additional libraries around. `occ-csg` comes with the freetype headers to simplify the build process on Windows. The recommended settings are:\n\n##### Dependencies required by OCC:\n\n- FreeType: if freetype cannot be found on Ubuntu then install libfreetype6-dev, we use freetype-2.7 on Windows and macOS, to build static freetype on macOS, make sure to build without zlib, libpng, bzip2 and harfbuzz (otherwise it will have dynamic dependencies to these libraries)\n- OpenGL:   if GL/GLU cannot be found on Unbuntu then install libglu1-mesa-dev and libgl1-mesa-dev\n- XQuartz:  only necessary on macOS. Whether XQuartz is necessary depends on the version of macOS and OCC, see OCC documentation. It might be necessary to adjust the X11 include path via `ln -s /opt/X11/include/X11 /usr/local/include/X11`\n\n#### Bash (Linux/macOS/Cygwin/other Unix-like Shell)\n\n    cd /path/to/project\n    mkdir build \u0026\u0026 cd build\n    cmake .. -DOpenCASCADE_DIR=/path/to/occ\n    make -j4\n\nOn Linux, it might be necessary to install fontconfig-devel to successfully link the executable. On Ubuntu the precise package name is libfontconfig-dev.\n\n#### Windows (CMD)\n\n    \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\vsdevcmd\" -arch=x64\n    cd \\path\\to\\project\n    mkdir build\n    cd build\n    cmake .. -DOpenCASCADE_DIR=\\path\\to\\occ\n    MSBuild .\\occ-csg-prj.sln  /property:Configuration=Release /property:Platform=x64\n    \nFor building large projects on Windows it might be preferable to use the x64 host compiler instead of the x86 compiler. Note that both compilers are able to produce x64 binaries. But the x64 compiler can use more memory during compilation. To really prevent that CMake picks the 64bit x86 host compiler just force cmake to use the x64 host compiler via\n\n    -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=X64 -G \"Visual Studio 15 2017 Win64\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiho%2Focc-csg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiho%2Focc-csg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiho%2Focc-csg/lists"}