Skip to content

Instantly share code, notes, and snippets.

View jmwright's full-sized avatar

Jeremy Wright jmwright

View GitHub Profile
$ pytest
============================================================================================================ test session starts =============================================================================================================
platform linux -- Python 3.11.10, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/jwright/repos/cadquery
collected 628 items
tests/test_assembly.py ............................................................................................ [ 14%]
tests/test_cad_objects.py .......................................
@jmwright
jmwright / png_export_from_cadquery_using_vtk.py
Last active April 22, 2024 15:37
Exports a CadQuery Model or Assembly to a PNG Image
from math import degrees
from vtkmodules.vtkRenderingCore import vtkGraphicsFactory
from vtkmodules.vtkCommonColor import vtkNamedColors
from vtkmodules.vtkRenderingCore import (
vtkActor,
vtkPolyDataMapper as vtkMapper,
vtkRenderer
)
from vtkmodules.vtkRenderingCore import vtkRenderWindow, vtkRenderWindowInteractor, vtkWindowToImageFilter
from vtkmodules.vtkFiltersExtraction import vtkExtractCellsByType
@jmwright
jmwright / exsource_def.yml
Created December 4, 2023 15:49
CadScript ExSource Integration
exports:
rack_leg:
name: rack_leg
description: >
Rack Leg
output-files:
- ./rack_leg.stl
source-files:
- ./nimble_rack_leg.py
parameters:
@jmwright
jmwright / freecad_import_in_cadquery.py
Last active December 12, 2023 15:03
FreeCAD Import in CadQuery
import os, sys
import glob
import zipfile
import tempfile
import cadquery as cq
def _fc_path():
"""
Pulled from cadquery-freecad-module
@jmwright
jmwright / cadquery_hylang_example.hy
Last active December 5, 2023 20:53
Example of Creating a CadQuery Object With the Hylang Lisp Dialect
#!/usr/bin/env hy
; A port of the CadQuery example here: https://github.com/CadQuery/cadquery/blob/master/examples/Ex100_Lego_Brick.py
; Information about the Hylang Lisp dialect: http://hylang.org/
(import cadquery :as cq)
(import cadquery.vis [show])
; User parameters
(setv lbumps 2) ; number of bumps long
from OCP.Quantity import Quantity_Color, Quantity_TOC_RGB
from OCP.TopoDS import TopoDS_Compound
from OCP.STEPControl import STEPControl_Writer, STEPControl_AsIs
from OCP.BRep import BRep_Tool, BRep_Builder
from OCP.TCollection import TCollection_ExtendedString
from OCP.TDocStd import TDocStd_Application, TDocStd_Document
from OCP.XCAFDoc import XCAFDoc_DocumentTool, XCAFDoc_ColorType, XCAFDoc_ColorGen
from OCP.STEPCAFControl import STEPCAFControl_Writer
from OCP.XSControl import XSControl_WorkSession
from OCP.TDataStd import TDataStd_Name
package main
import "core:log"
import "core:runtime"
import gl "vendor:OpenGL"
// import glfw "shared:odin-glfw"
import "vendor:glfw"
DESIRED_GL_MAJOR_VERSION :: 4;
DESIRED_GL_MINOR_VERSION :: 5;
@jmwright
jmwright / cadquery_tips_and_tricks.md
Last active June 6, 2024 15:23
CadQuery Tips and Tricks

1. Conda Installation

If you use conda you might try creating a new environment and install using conda directly:

  conda create -n cadquery-master
  conda install -c cadquery -c conda-forge cadquery=master

Or if you want both cq-editor and cadquery:

  conda create -n cqgui-master
  conda install -c cadquery -c conda-forge cq-editor=master
@jmwright
jmwright / rockpro64_setup.md
Last active July 22, 2020 21:19
Getting a RockPro64 ARM Board Up and Running

This information is now outdated. I was not able to get any images running 5.4 kernels to work, but images with the 4.4 kernel work just fine.

Installation

I was only able to get one Ubuntu/Debian image out of all of them from the Rock64 wiki to work, and it was a minimal Debian image with a kernel tailored for media uses. According to what I saw on the forums, I'm not the only person with this issue. Big thanks to @mrfixit2001 for making that one working image available.

This is the process I went through to get things to work.

  • Download the RockPro64 image from here.
  • Use Etcher or the xz command to write that to an (>=4 GB) SD card. Note that the Rock64 boards are known to be finicky about SD cards.

WIP Installation Instructions for pywrap on Raspberry Pi

Pre-requisites

  • pip3 install logzero toml pandas joblib path tqdm toposort clang pybind11 cymbal schema

Script alterations

  • Change run.sh script python references to python3

Run the generation script

CONDA_PREFIX="." ./run.sh