{"id":13557376,"url":"https://github.com/CadQuery/CQ-editor","last_synced_at":"2025-04-03T11:31:57.971Z","repository":{"id":33512661,"uuid":"136604983","full_name":"CadQuery/CQ-editor","owner":"CadQuery","description":"CadQuery GUI editor based on PyQT","archived":false,"fork":false,"pushed_at":"2025-03-18T15:51:10.000Z","size":2857,"stargazers_count":851,"open_issues_count":112,"forks_count":128,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-03-18T16:44:33.219Z","etag":null,"topics":["3d","b-rep","cad","cadquery","occt","ocp","opencascade","parametric","pyqt","pyqt5","python","step","stl"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CadQuery.png","metadata":{"files":{"readme":"README.md","changelog":"changes.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}},"created_at":"2018-06-08T10:33:28.000Z","updated_at":"2025-03-18T15:51:15.000Z","dependencies_parsed_at":"2024-01-18T08:55:01.197Z","dependency_job_id":"a5908dfd-b383-4d95-ac22-c9774ba1a6cb","html_url":"https://github.com/CadQuery/CQ-editor","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CadQuery%2FCQ-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CadQuery%2FCQ-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CadQuery%2FCQ-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CadQuery%2FCQ-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CadQuery","download_url":"https://codeload.github.com/CadQuery/CQ-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246993119,"owners_count":20865939,"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":["3d","b-rep","cad","cadquery","occt","ocp","opencascade","parametric","pyqt","pyqt5","python","step","stl"],"created_at":"2024-08-01T12:04:18.710Z","updated_at":"2025-04-03T11:31:52.943Z","avatar_url":"https://github.com/CadQuery.png","language":"Python","readme":"# CadQuery editor\n\n[![Build status](https://ci.appveyor.com/api/projects/status/g98rs7la393mgy91/branch/master?svg=true)](https://ci.appveyor.com/project/adam-urbanczyk/cq-editor/branch/master)\n[![codecov](https://codecov.io/gh/CadQuery/CQ-editor/branch/master/graph/badge.svg)](https://codecov.io/gh/CadQuery/CQ-editor)\n[![Build Status](https://dev.azure.com/cadquery/CQ-editor/_apis/build/status/CadQuery.CQ-editor?branchName=master)](https://dev.azure.com/cadquery/CQ-editor/_build/latest?definitionId=3\u0026branchName=master)\n[![DOI](https://zenodo.org/badge/136604983.svg)](https://zenodo.org/badge/latestdoi/136604983)\n\nCadQuery GUI editor based on PyQT supports Linux, Windows and Mac.\n\n\u003cimg src=\"https://github.com/CadQuery/CQ-editor/raw/master/screenshots/screenshot2.png\" alt=\"Screenshot\" width=\"70%\" \u003e\n\u003cimg src=\"https://github.com/CadQuery/CQ-editor/raw/master/screenshots/screenshot3.png\" alt=\"Screenshot\" width=\"70%\" \u003e\n\u003cimg src=\"https://github.com/CadQuery/CQ-editor/raw/master/screenshots/screenshot4.png\" alt=\"Screenshot\" width=\"70%\" \u003e\n\n## Notable features\n\n* Automatic code reloading - you can use your favourite editor\n* OCCT based\n* Graphical debugger for CadQuery scripts\n  * Step through script and watch how your model changes\n* CadQuery object stack inspector\n  * Visual inspection of current workplane and selected items\n  * Insight into evolution of the model\n* Export to various formats\n  * STL\n  * STEP\n\n## Installation - Pre-Built Packages (Recommended)\n\n~~### Release Packages~~\n\n~~Stable release builds which do not require Anaconda are attached to the [latest release](https://github.com/CadQuery/CQ-editor/releases). Download installer for your operating system, extract it, and run the CQ-editor script for your OS (CQ-editor.cmd for Windows, CQ-editor.sh for Linux and MacOS). On Windows you should be able to simply double-click on CQ-editor.cmd. On Linux and MacOS you may need to make the script executable with `chmod +x CQ-editor.sh` and run the script from the command line. The script contains an environment variable export that may be required to get CQ-editor to launch correctly on MacOS Big Sur, so it is better to use the script than to launch CQ-editor directly.~~\n\n### Development Packages\n\nDevelopment builds are also available, but can be unstable and should be used at your own risk. You can download the newest build [here](https://github.com/CadQuery/CQ-editor/releases/tag/nightly). Install and run the `run.sh` (Linux/MacOS) or `run.bat` (Windows) script in the root CQ-editor directory. The CQ-editor window should launch.\n\n### MacOS workarounds\n\nOn later MacOS versions you may also need `xattr -r -d com.apple.quarantine path/to/CQ-editor-MacOS`.\n\n## Installation (conda/mamba)\n\nUse conda or mamba to install:\n```\nmamba install -c cadquery -c conda-forge cq-editor=master\n```\nand then simply type `cq-editor` to run it. This installs the latest version built directly from the HEAD of this repository.\n\nAlternatively clone this git repository and set up the following conda environment:\n```\nmamba env create -f cqgui_env.yml -n cqgui\nmamba activate cqgui\npython run.py\n```\n\nIf you are concerned about mamba/conda modifying your shell settings, you can use [micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html):\n```\nmicromamba install -n base -c cadquery cq-editor\nmicromamba run -n base cq-editor\n```\n\nOn some linux distributions (e.g. `Ubuntu 18.04`) it might be necessary to install additonal packages:\n```\nsudo apt install libglu1-mesa libgl1-mesa-dri mesa-common-dev libglu1-mesa-dev\n```\nOn Fedora 29 the packages can be installed as follows:\n```\ndnf install -y mesa-libGLU mesa-libGL mesa-libGLU-devel\n```\n\n## Usage\n\n### Showing Objects\n\nBy default, CQ-editor will display a 3D representation of all `Workplane` objects in a script with a default color and alpha (transparency). To have more control over what is shown, and what the color and alpha settings are, the `show_object` method can be used. `show_object` tells CQ-editor to explicity display an object, and accepts the `options` parameter. The `options` parameter is a dictionary of rendering options named `alpha` and `color`. `alpha` is scaled between 0.0 and 1.0, with 0.0 being completely opaque and 1.0 being completely transparent. The color is set using R (red), G (green) and B (blue) values, and each one is scaled from 0 to 255. Either option or both can be omitted. The `name` parameter can assign a custom name which will appear in the objects pane of CQ-editor.\n\n```python\nshow_object(result, name=\"somename\", options={\"alpha\":0.5, \"color\": (64, 164, 223)})\n```\n\nNote that `show_object` works for `Shape` and `TopoDS_Shape` objects too. In order to display objects from the embedded Python console use `show`.\n\n### Rotate, Pan and Zoom the 3D View\n\nThe following mouse controls can be used to alter the view of the 3D object, and should be familiar to CAD users, even if the mouse buttons used may differ.\n\n* _Left Mouse Button_ + _Drag_ = Rotate\n* _Middle Mouse Button_ + _Drag_ = Pan\n* _Right Mouse Button_ + _Drag_ = Zoom\n* _Mouse Wheel_ = Zoom\n\n### Debugging Objects\n\nThere are multiple menu options to help in debugging a CadQuery script. They are included in the `Run` menu, with corresponding buttons in the toolbar. Below is a listing of what each menu item does.\n\n* `Debug` (Ctrl + F5) - Instead of running the script completely through as with the `Render` item, it begins executing the script but stops at the first non-empty line, waiting for the user to continue execution manually.\n* `Step` (Ctrl + F10) - Will move execution of the script to the next  non-empty line.\n* `Step in` (Ctrl + F11) - Will follow the flow of execution to the inside of a user-created function defined within the script.\n* `Continue` (Ctrl + F12) - Completes execution of the script, starting from the current line that is being debugged.\n\nIt is also possible to do visual debugging of objects. This is possible by using the `debug()` function to display an object instead of `show_object()`. An alternative method for the following code snippet is shown below for highlighting a specific face, but it demonstrates one use of `debug()`.\n```python\nimport cadquery as cq\n\nresult = cq.Workplane().box(10, 10, 10)\n\nhighlight = result.faces('\u003eZ')\n\nshow_object(result, name='box')\ndebug(highlight)\n```\nObjects displayed with `debug()` are colored in red and have their alpha set so they are semi-transparent. This can be useful for checking for interference, clearance, or whether the expected face is being selected, as in the code above.\n\n### Console Logging\n\nPython's standard `print()` function will not output to the CQ-editor GUI, and `log()` should be used instead. `log()` will output the provided text to the _Log viewer_ panel, providing another way to debug CadQuery scripts. If you started CQ-editor from the command line, the `print()` function will output text back to it.\n\n### Using an External Code Editor\n\nSome users prefer to use an external code editor instead of the built-in Spyder-based editor that comes stock with CQ-editor. The steps below should allow CQ-editor to work alongside most text editors.\n\n1. Open the Preferences dialog by clicking `Edit-\u003ePreferences`.\n2. Make sure that `Code Editor` is selected in the left pane.\n3. Check `Autoreload` in the right pane.\n4.  If CQ-editor is not catching the saves from your external editor, increasing `Autoreload delay` in the right pane may help. This issue has been reported when using vim or emacs.\n\n### Exporting an Object\n\nAny object can be exported to either STEP or STL format. The steps for doing so are listed below.\n\n1. Highlight the object to be exported in the _Objects_ panel.\n2. Click either `Export as STL` or `Export as STEP` from the `Tools` menu, depending on which file format you want to export. Both of these options will be disabled if an object is not selected in the _Objects_ panel.\n\nClicking either _Export_ item will present a file dialog that allows the file name and location of the export file to be set.\n\n### Displaying All Wires for Debugging\n\n**NOTE:** This is intended for debugging purposes, and if not removed, could interfere with the execution of your model in some cases.\n\nUsing `consolidateWires()` is a quick way to combine all wires so that they will display together in CQ-editor's viewer. In the following code, it is used to make sure that both rects are displayed. This technique can make it easier to debug in-progress 2D sketches.\n\n```python\nimport cadquery as cq\nres = cq.Workplane().rect(1,1).rect(3,3).consolidateWires()\nshow_object(res)\n```\n\n### Highlighting a Specific Face\n\nHighlighting a specific face in a different color can be useful when debugging, or when trying to learn CadQuery selectors. The following code creates a separate, highlighted object to show the selected face in red. This is an alternative to using a `debug()` object, and in most cases `debug()` will provide the same result with less code. However, this method will allow the color and alpha of the highlight object to be customized.\n\n```python\nimport cadquery as cq\n\nresult = cq.Workplane().box(10, 10, 10)\n\nhighlight = result.faces('\u003eZ')\n\nshow_object(result)\nshow_object(highlight,'highlight',options=dict(alpha=0.1,color=(1.,0,0)))\n```\n\n### Naming an Object\n\nBy default, objects have a randomly generated ID in the object inspector. However, it can be useful to name objects so that it is easier to identify them. The `name` parameter of `show_object()` can be used to do this.\n\n```python\nimport cadquery as cq\n\nresult = cq.Workplane().box(10, 10, 10)\n\nshow_object(result, name='box')\n```\n","funding_links":[],"categories":["Python","Editors and IDEs","3d","Table of Contents"],"sub_categories":["CAD"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCadQuery%2FCQ-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCadQuery%2FCQ-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCadQuery%2FCQ-editor/lists"}