Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Creates a arc from 3 selected points
# -*- coding: utf-8 -*-
from FreeCAD import Base
__title__ = "Macro_Make_Arc_3_points"
__author__ = "Mario52"
__url__ = ""
__version__ = "00.01"
__date__ = "14/07/2016"
global selected; selected = []
App = FreeCAD
class SelObserver:
print "Create Arc to 3 points ..."
def addSelection(self,doc,obj,sub,pnt): # Selection
global selected
if len(selected) == 1:
print "Point 1 : ",FreeCAD.Vector(selected[0])
elif len(selected) == 2:
print "Point 2 : ",FreeCAD.Vector(selected[1])
elif len(selected) == 3:
print "Point 3 : ",FreeCAD.Vector(selected[2])
C1 = Part.Arc(FreeCAD.Vector(selected[0]),FreeCAD.Vector(selected[1]),FreeCAD.Vector(selected[2]))
S1 = Part.Shape([C1])
W = Part.Wire(S1.Edges)
App.ActiveDocument.ActiveObject.Label = "Arc_3_Points"
print "Length : ",W.Length
except Exception:
print "Three points are collinear or bad selection"
del selected[:]
print "End Make_Arc_3_Points"
print "_____________________"

This comment has been minimized.

Copy link
Owner Author

@mario52a mario52a commented Jun 29, 2016

This macro utility is intended for the use of the program FreeCAD
The icon for your toolbar, it is to place in your macros directory (in the same location of the macro)

macro_make_arc_3_points rename the image in Macro_Make_Arc_3_Points.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment