This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = open("/path/to/myfile.ncc") | |
s1 = f.read() | |
from PathScripts import pre_example | |
s2 = pre_example.parse(s1) | |
import Path | |
p = Path.Path(s2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getTool(self,obj,number=0): | |
"retrieves a tool from a hosting object with a tooltable, if any" | |
for o in obj.InList: | |
if hasattr(o,"Tooltable"): | |
return o.Tooltable.getTool(number) | |
# not found? search one level up | |
for o in obj.InList: | |
return self.getTool(o,number) | |
return None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewProviderPath: | |
def __init__(self,vobj): #mandatory | |
obj.addProperty("App::PropertyFloat","SomePropertyName","PropertyGroup","Description of this property") | |
obj.Proxy = self | |
def __getstate__(self): #mandatory | |
return None | |
def __setstate__(self,state): #mandatory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def export(objectslist,filename): | |
gfile = open(filename,"wb") # open the file with write permission | |
for obj in objectslist: | |
if hasattr(obj,"Path"): # not all objects might be paths | |
gfile.write(obj.Path.toGCode()) # this simply dumps the path data as internal gcode | |
commands = obj.Path.Commands # but we could also do stuff with the commands list | |
gfile.close() | |
print "successfully exported " + filename |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from pivy import coin | |
>>> sg=Gui.ActiveDocument.ActiveView.getSceneGraph() | |
>>> clip = coin.SoClipPlane() | |
>>> clip.on.setValue(False) | |
>>> plane = coin.SbPlane(coin.SbVec3f(0,0,1),1000) | |
>>> plane | |
<pivy.coin.SbPlane; proxy of <Swig Object of type 'SbPlane *' at 0x7fd8424b62a0> > | |
>>> clip.plane.setValue(plane) | |
>>> sg.addChild(clip) | |
>>> clip.on.setValue(True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert zoomwindow.png -fill darkgrey -transparent white -fuzz 50% -fill white -opaque black test.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#*************************************************************************** | |
#* * | |
#* Copyright (c) 2015 * | |
#* Yorik van Havre <[email protected]> * | |
#* * | |
#* 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. * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__(): |