This file contains 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
function [maxtab, mintab]=peakdet(v, delta, x) | |
%PEAKDET Detect peaks in a vector | |
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local | |
% maxima and minima ("peaks") in the vector V. | |
% MAXTAB and MINTAB consists of two columns. Column 1 | |
% contains indices in V, and column 2 the found values. | |
% | |
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices | |
% in MAXTAB and MINTAB are replaced with the corresponding | |
% X-values. |
This file contains 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/env python | |
# Based on FreeBSD src/lib/libcrypt/crypt.c 1.2 | |
# http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/lib/libcrypt/crypt.c?rev=1.2&content-type=text/plain | |
# Original license: | |
# * "THE BEER-WARE LICENSE" (Revision 42): | |
# * <[email protected]> wrote this file. As long as you retain this notice you | |
# * can do whatever you want with this stuff. If we meet some day, and you think | |
# * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp |
This file contains 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/python2 | |
# Copyright (C) 2016 Sixten Bergman | |
# License WTFPL | |
# | |
# This program is free software. It comes without any warranty, to the extent | |
# permitted by applicable law. | |
# You can redistribute it and/or modify it under the terms of the Do What The | |
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See |
This file contains 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/env python | |
import urllib | |
import sys | |
import json | |
from mwlib import parser | |
from mwlib.refine import compat | |
if __name__ == "__main__": | |
params = urllib.urlencode({ | |
"format": "json", |
This file contains 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 __future__ import division # allows floating point division from integers | |
from FreeCAD import Base | |
import Part | |
import math | |
# Run this macro to create a generic project enclosure box | |
# You can change all the parameters by selecting the object in the tree view and tweaking values in the "Data" tab | |
# Possible additions/improvements | |
# counterbore bridging .4mm |
This file contains 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 math import sqrt | |
from FreeCAD import Base | |
#Main class for general extrusion related methods | |
class ExtrusionProfile(): | |
def __init__(self, profile): | |
self.profile = profile | |
def makeExtrusion(self, p1, p2, rotateAngle=0): | |
"""Generates an extrusion which connects between two points, |
This file contains 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 __future__ import division # allows floating point division from integers | |
from FreeCAD import Base | |
import sys | |
import math | |
try: | |
path = App.ConfigGet('UserHomePath') + '/FreeCad/Mod' | |
i = sys.path.index(path) | |
except: | |
sys.path.append(path) |
This file contains 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 FreeCAD import Base | |
class MeasureCircle: | |
"""This class will report the computed radius and center of a circle or arc given 3 vertices. | |
A line is drawn from the first vertex to the center of the circle, which may be used for future measurements. | |
Just select the vertices and the result will be shown in Report View | |
Edges may also be selected and count as two vertices. | |
If two edges are selected one of the vertices in the second edge is not used in the calculation""" | |
def __init__(self): | |
self.points = [] |
This file contains 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 FreeCAD import Base | |
import math | |
class Protractor: | |
"""Reports the angle between two edges. | |
Select the edges and the result will be shown in Report View""" | |
def __init__(self): | |
self.firstEdge = None | |
Gui.Selection.addObserver(self) | |
FreeCAD.Console.PrintMessage("Select any 2 edges\n") |
This file contains 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 matplotlib import cbook | |
class DataCursor(object): | |
"""A simple data cursor widget that displays the x,y location of a | |
matplotlib artist when it is selected.""" | |
def __init__(self, artists, tolerance=5, offsets=(-20, 20), | |
template='x: %0.2f\ny: %0.2f', display_all=False): | |
"""Create the data cursor and connect it to the relevant figure. | |
*artists* is the matplotlib artist or sequence of artists that will be | |
selected. |
OlderNewer