Skip to content

Instantly share code, notes, and snippets.

Avatar

Yorik van Havre yorikvanhavre

View GitHub Profile
@yorikvanhavre
yorikvanhavre / io_import_fcstd.py
Last active Oct 13, 2020
Blender FreeCAD importer stub
View io_import_fcstd.py
bl_info = {
"name": "FreeCAD Importer",
"category": "Import-Export",
"author": "Yorik van Havre",
"version": (1, 0, 0),
"blender": (2, 79, 0),
"location": "File > Import > FreeCAD",
"description": "Imports a .FCStd file from FreeCAD",
"warning": "You need a version of FreeCAD compiled with the same Python version as Blender. Only Part- and Mesh-based objects are supported at the moment",
}
@yorikvanhavre
yorikvanhavre / parametric_column.ifc
Created Aug 3, 2017
An IFC file that contains parametric definitions for FreeCAD
View parametric_column.ifc
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('p5.ifc','2017-08-03T15:25:29',('Yorik van Havre','yorik@uncreated.net'),('uncreated.net'),'IfcOpenShell 0.5.0-dev','IfcOpenShell 0.5.0-dev','');
FILE_SCHEMA(('IFC2X3'));
ENDSEC;
DATA;
#1=IFCPERSON($,$,'Yorik van Havre',$,$,$,$,$);
#2=IFCORGANIZATION($,'uncreated.net',$,$,$);
#3=IFCPERSONANDORGANIZATION(#1,#2,$);
@yorikvanhavre
yorikvanhavre / nester.py
Last active Jul 1, 2017
Nesting algo for FreeCAD
View nester.py
# -*- 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 / Sketchfab-exporter.FCMacro
Last active Mar 21, 2017
A sketchfab exporter for FreeCAD
View Sketchfab-exporter.FCMacro
#!/usr/bin/python
#***************************************************************************
#* *
#* 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 / acis-sat-lib.py
Created Jun 20, 2016
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...
View acis-sat-lib.py
# 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
View plugin-manager-goal.py
import pluginmanager
plugins = pluginmanager.getPlugins()
for plugin in plugins:
print plugin.Name
print plugin.Author
print plugin.Url
print plugin.Description
print plugin.type # if this is a workbench or a macro
# for later...
print plugin.isInstalled()
@yorikvanhavre
yorikvanhavre / fetch.py
Created Jun 2, 2016
sample fetch script for freecad
View fetch.py
class plugin:
author = "xyz"
type = "macro"
description = "this plugin does this"
baseurl = "http://github.com/mymacro"
infourl = "http://github.com/mymacro/README.md"
class Fetch:
def __init__():
@yorikvanhavre
yorikvanhavre / mdview.php
Created Mar 3, 2016
This script generates a nice HTML rendering of a Markdown file that is hosted and shared on an owncloud server, using strapdownjs.com.
View mdview.php
<?php
// mdview.php by Yorik van Havre, GPL license
// This script generates a nice HTML rendering of a Markdown file that is hosted and
// shared on an owncloud server, using strapdownjs.com.
// To use it, simply place this file somewhere on your web space, and call it with the
// following arguments: http://path/to/mdview.php?file=XXXXXXXX&theme=spacelab
// the XXXXXXX is the share code from the link you obtain when sharing a file in owncloud.
// theme is optional, and can be one of the themes described on strapdownjs.com. If not
// provided, the spacelab theme is used (with a bit of changes I did in the <style> tag below)
@yorikvanhavre
yorikvanhavre / openfoam_obj_exporter.py
Created Jan 24, 2016
An openFOAM-tailored OBJ exporter for FreeCAD
View openfoam_obj_exporter.py
#***************************************************************************
#* *
#* Copyright (c) 2015 *
#* 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. *
#* for detail see the LICENCE text file. *
@yorikvanhavre
yorikvanhavre / getrecentfiles.py
Last active Aug 2, 2018
get list of recent documents in linux
View getrecentfiles.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import re,os,gtk,gio,magic
def geticon(filename):
m = magic.open(magic.MAGIC_MIME)
m.load()
mime = m.file(filename).split(";")[0]
mime = gio.content_type_get_icon(mime).get_names()
You can’t perform that action at this time.