Skip to content

Instantly share code, notes, and snippets.

Avatar

Yorik van Havre yorikvanhavre

View GitHub Profile
View cad2png.py
#!/usr/bin/python3
"""
This script renders different kinds of CAD files as PNG files using
FreeCAD. If the given PNG image path already exists, and was created
from the same file (same MD5 hash), no new rendering is performed.
Usage: cad2png.py [OPTIONS] path/to/someFile.FCStd path/to/somefile.png
Options:
@yorikvanhavre
yorikvanhavre / fcstd2png.py
Last active Jun 5, 2020
Renders a FreeCAD file to png
View fcstd2png.py
#!/usr/bin/python3
"""
This renders a FreeCAD .FCStd file to a .png file in the same directory
Usage: fcstd2png.py path/to/someFile.FCStd
Instructions:
@yorikvanhavre
yorikvanhavre / offline_rendering.py
Last active Jun 5, 2020
FreeCAD offline rendering example
View offline_rendering.py
#!/usr/bin/python3
"""
This is a test file to test offline rendering functionality. It takes a FreeCAD file (colors.FCStd in
the examples below) and will produce colors.obj, colors.mtl, colors.dae, colors.ifc, colors.stp
and colors.png files in the same directory. It also saves a copy of the colors.FCStd file with
colors preserved.
Instructions:
@yorikvanhavre
yorikvanhavre / freecad-ladybug.ipynb
Last active Jul 25, 2020
FreeCAD ladybug integration notes
View freecad-ladybug.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yorikvanhavre
yorikvanhavre / make-thumbnailer.sh
Created Apr 6, 2020
Fix g3dviewer thumbnail make
View make-thumbnailer.sh
# The last step of the makefile fails. After running make (and get all the .o files built), run this below.
# Basically fixes by swapping the orger of the .o entries and the -l entries (-l go AFTER the .o) and adding missing -lm and -lX11
gcc -g -O2 -o g3d-thumbnailer g3d_thumbnailer-g3d-thumbnailer.o g3d_thumbnailer-trackball.o g3d_thumbnailer-gl.o g3d_thumbnailer-texture.o g3d_thumbnailer-screenshot.o -lGL -lGLU -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lg3d -lm -lX11
@yorikvanhavre
yorikvanhavre / io_export_fcstd.py
Last active Jul 25, 2020
A FreeCAD exporter for Blender <= 2.80
View io_export_fcstd.py
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
View FreeCAD .FCStd importer for Blender 2.80
bl_info = {
"name": "FreeCAD Importer",
"category": "Import-Export",
"author": "Yorik van Havre",
"version": (5, 0, 0),
"blender": (2, 80, 0),
"location": "File > Import > FreeCAD",
"description": "Imports a .FCStd file from FreeCAD",
"warning": "This addon needs FreeCAD installed on your system. Only Part- and Mesh-based objects supported at the moment.",
}
@yorikvanhavre
yorikvanhavre / check_revit_tiny_lines.py
Created Dec 4, 2018
A FreeCAD macro that checks all visible objects for lines too tiny for Revit
View check_revit_tiny_lines.py
import FreeCAD,FreeCADGui,Part
minl = 0.8 # 0.8 millimeters is the minimum line size that Revit is able to swallow. Pitiful, I know...
edges = []
if FreeCAD.ActiveDocument:
for o in FreeCAD.ActiveDocument.Objects:
if o.ViewObject.Visibility == True:
if o.isDerivedFrom("Part::Feature"):
if o.Shape:
@yorikvanhavre
yorikvanhavre / ideias_contra_fascismo.md
Last active Oct 10, 2018
Ideias para impedir o Brasil de se tornar um estado fascista após a vitória do Bolsonaro
View ideias_contra_fascismo.md

Ideias para impedir o Brasil de se tornar um estado fascista após a vitória do Bolsonaro

  • Aprender e divulgar sobre o nazismo / fascismo, aprender a reconhecer similaridades, e também diferenças e ter uma visão realista e constantemente atualizada sobre a situação
  • Registrar e divulgar crimes fascistas, separar e catalogar os cometidos oficialmente pelo governo, por apoiadores, e por outras instituições que não são parte do governo (legislativo, judiciário, estaduais, etc...)
  • Registrar e catalogar ocorrências de corrupção das instituições (legislativo, judiciário...) por parte do governo
  • Apoiar a imprensa independente
  • Apoiar, ampliar e reforçar movimentos tipicamente "alvos" do fascismo (e consequentemente partes fundamentais da resistência) como movimentos feministas, negros, LGBT
  • Desenvolver cultura alternativa, e meios de financiá-la e mantê-la viva culturalmente (resistir as calunias e campanhas contra)
  • Atentar e identificar novos "alvos" (designados como responsáveis por tudo que for rui
View keybase.md

Keybase proof

I hereby claim:

  • I am yorikvanhavre on github.
  • I am yorikvanhavre (https://keybase.io/yorikvanhavre) on keybase.
  • I have a public key ASDsJiThnDgQBTYV70-5IFhBhEMtnd4i6k5eoOc6oq5M7wo

To claim this, I am signing this object:

You can’t perform that action at this time.