Skip to content

Instantly share code, notes, and snippets.

View mwganson's full-sized avatar

Mark Ganson <TheMarkster> mwganson

View GitHub Profile
@mwganson
mwganson / ConstraintToAlias.FCMacro
Last active December 11, 2023 04:01
Create spreadsheet aliases from within the sketch editor in FreeCAD
# ConstraintToAlias, 2023, by <TheMarkster> LGPL 2.1 or later
# Usage: Create a constraint, give it a name, then run the macro
# to put a new alias into a spreadsheet and link the constraint
# to it via Expressions. If no constraint is selected, then the
# macro will open the dialog with some default values of "Label"
# for the label and alias, and 0.0 default value for Value.
__version__ = "0.2023.12.10"
__icon__ = "https://wiki.freecad.org/images/3/31/ConstraintToAlias.svg"
@mwganson
mwganson / MacroToolbarManager.FCMacro
Last active October 27, 2023 22:01
Easily manage custom macro toolbars in FreeCAD
#CustomToolbarManager.FCMacro
#2023, by <TheMarkster>, LGPL 2.1 or later
#based on some of the code found in AddonManager
#
#Goal is to make it simpler and easier to manage custom
#macros on custom toolbars
__version__ = "0.2023.10.27"
LOAD_STRING = True #load UI from a string defined in this file if True,
#else from a separate ui file during development
@mwganson
mwganson / EasyReflector.FCMacro
Last active December 9, 2023 22:09
Easy texture reflections for FreeCAD
# -*- coding: utf-8 -*-
__version__ = "0.2023.12.09"
__icon__ = "https://github.com/mwganson/EasyReflector/raw/main/EasyReflectorIcon.svg"
#__version__ = "0.2023.12.09"
##EasyReflector macro by TheMarkster
##based on work by Athanaze at https://github.com/Athanaze/Freecad-easy-reflections
##
##do not run this file directly. Instead run the EasyReflector.FCMacro file.
##
#from pivy import coin
@mwganson
mwganson / Editor_Assistant.FCMacro
Last active September 28, 2023 16:05
FreeCAD macro to supplement the built-in script editor
# -*- coding: utf-8 -*-
##from __future__ import unicode_literals
#
#Editor Assistant
#Adds some capabilities to the python editor
#as a new task panel dialog
#https://forum.freecadweb.org/viewtopic.php?f=22&t=67242
#2022, <TheMarkster> LGPL2.1 or later
#
#
@mwganson
mwganson / Intersection.FCMacro
Last active September 10, 2023 03:46
Intersection macro -- finds intersections between edges and faces
# -*- coding: utf-8 -*-
__version__ = "2023.09.09"
#__version__ = "2023.09.09"
#__title__ = "Intersection"
#__author__ = "<TheMarkster> 2021"
#__license__ = "LGPL 2.1"
#__doc__ = "Find the intersection of 2 or 3 faces/edges"
#__usage__ = '''Select 2 faces or edges in the 3d view and run the macro'''
#from PySide import QtGui,QtCore
#import FreeCAD,FreeCADGui,Part
@mwganson
mwganson / Joint.FCMacro
Last active December 21, 2022 17:40
Macro Joint -- FreeCAD macro for making various types of joints
# -*- coding: utf-8 -*-
__version__ = "0.2022.12.21"
#__version__ = "0.2022.12.21"
#__title__ = "Joint Macro"
#__author__ = "<TheMarkster> 2021"
#__license__ = "LGPL 2.1"
#__doc__ = "Create a mortise/tenon joint, box joint, dovetail joint, ball joint, or split joint."
#__usage__ = '''Select the face and activate the tool, modify properties as desired'''
#import Part, FreeCADGui, FreeCAD
#from PySide import QtGui,QtCore
@mwganson
mwganson / Animator.FCMacro
Last active September 30, 2023 19:19
FreeCAD macro Animator
# -*- coding: utf-8 -*-
__version__ = "0.2023.09.30c"
#__version__ = "0.2023.09.30c"
##Animator, 2023, by <TheMarkster>, LGPL2.1 or later
##Credit to Dan Miel for some of the A2Plus-related stuff
#DEBUG = False
#import FreeCAD, FreeCADGui, Part
#import time
#import math
#import re
@mwganson
mwganson / Honeycomb.py
Last active October 26, 2023 23:33
FreeCAD macro, creates parametric honeycomb grid, compatible in and out of Part Design
# -*- coding: utf-8 -*-
__version__ = "0.2022.10.26b"
#Honeycomb macro -- creates a feature python parametric honeycomb object for Part Design workbench
#2021, by <TheMarkster> LGPL2.1 or later
import FreeCAD, FreeCADGui, Part
class Honeycomb:
def __init__(self,obj):
obj.addExtension("Part::AttachExtensionPython")
obj.addProperty("App::PropertyFloat","Radius","Honeycomb","Circumradius of the hexagons").Radius = 1
@mwganson
mwganson / wirefilter.FCMacro
Last active October 19, 2023 22:29
wirefilter macro, allows to use only some wires of a sketch, also offsets and scales and makes faces
# -*- coding: utf-8 -*-
__version__ = "0.2023.10.19"
#__version__ = "0.2023.10.19"
##WireFilter, 2021, by <TheMarkster> LGPL 2.1 or later
#import FreeCAD, FreeCADGui, Part, Draft
#from PySide import QtGui, QtCore, QtWidgets
#from PySide.QtGui import QColor
#import time
#COLORS = ["red","green","blue","cyan","magenta","yellow","orange","maroon","purple","white",\
#"chartreuse", "navy","teal","pink","black","silver"]
@mwganson
mwganson / Pdwrapper.FCMacro
Last active August 13, 2023 17:17
FreeCAD macro to encapsulate non-Part Design solids to be used in a Part Design Body
# -*- coding: utf-8 -*-
__version__ = "0.2023.08.13"
#__version__ = "0.2023.08.13"
## PDWrapper a class to encapsulate non-Part Design objects into a PartDesign::FeaturePython object
## 2021, by <TheMarkster>
#
#DEBUG = False
#
#import FreeCAD, FreeCADGui
#import Part