Skip to content

Instantly share code, notes, and snippets.

View yorikvanhavre's full-sized avatar

Yorik van Havre yorikvanhavre

View GitHub Profile
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 / io_import_fcstd.py
Last active July 17, 2023 20:43
Blender FreeCAD importer stub
# ##### 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
@yorikvanhavre
yorikvanhavre / io_export_fcstd.py
Last active July 24, 2022 12:45
A FreeCAD exporter for Blender 2.80+
# ##### 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
@yorikvanhavre
yorikvanhavre / acis-sat-lib.py
Created June 20, 2016 22:15
A read/write library for ACIS/SAT file format. However, it's too ancient and doesn't respect the current file format specs, which cannot be found on the net, so I stopped there...
# adapted from http://userpages.uni-koblenz.de/~ros/acis.htm
import os
class tawriter:
def __init__(self,asat):
self.l = []
self.sat = []
self.asat = asat
@yorikvanhavre
yorikvanhavre / nester.py
Last active February 1, 2022 19:54
Nesting algo for FreeCAD
# -*- coding: utf-8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2017 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
@yorikvanhavre
yorikvanhavre / FreeCAD-como-instalar.md
Created April 27, 2021 11:41
Hello World com o FreeCAD

O que é e como instalar o FreeCAD

O FreeCAD é um aplicativo de modelagem 3D paramétrico. Diferentemente de aplicativos de modelagem mais "livre" como o Blender, o FreeCAD oferece uma modelagem mais lenta, mas mais precisa e baseada em sólidos e curvas NURBS. O sistema paramétrico permite também criar vários tipos de relações entre objetos. Assim como o Blender, o FreeCAD é altamente extensível e fácil de programar em Python.

Como instalar

O FreeCAD é bem fácil de instalar, basta baixar o pacote de instalação correspondente a sua plataforma a partir da página oficial.

Linux

@yorikvanhavre
yorikvanhavre / freecad-ladybug.ipynb
Last active July 25, 2020 11:16
FreeCAD ladybug integration notes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/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 / offline_rendering.py
Last active June 5, 2020 12:56
FreeCAD offline rendering example
#!/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 / fcstd2png.py
Last active June 5, 2020 12:09
Renders a FreeCAD file to png
#!/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: