Skip to content

Instantly share code, notes, and snippets.

View jmwright's full-sized avatar

Jeremy Wright jmwright

View GitHub Profile
@hyOzd
hyOzd / export_x3d.py
Last active May 8, 2021 01:03
An experimental FreeCAD macro that will export visible objects as X3D
#
# This is an experimental FreeCAD macro that will export current scene
# as X3D file. Only the visible objects that can be converted to mesh
# will be exported with their color.
#
import FreeCAD
import FreeCADGui
import xml.etree.ElementTree as et
from PySide.QtGui import QFileDialog
@adam-james-v
adam-james-v / higher-order-geom.clj
Created August 21, 2023 19:54
Higher Order Functions can be used to capture geometric data and compile to other CAD contexts simultaneously.
(ns example.geom
(:require [clojure.string :as str]))
;; Utils
(defn normalize
"find the unit vector of the given vector `v`."
[v]
(when v
(let [m (Math/sqrt ^double (reduce + (mapv * v v)))]
(mapv / v (repeat m)))))