Macro Make Arc 3 Points: Difference between revisions
m ({{Code|code=) |
m (date) |
||
Line 1: | Line 1: | ||
<translate> |
<translate> |
||
<!--T:1--> |
<!--T:1--> |
||
{{Macro|Icon=Macro_Make_Arc_3_Points|Name=Macro Make Arc 3 Points|Description=Creates a arc from 3 selected points.|Author=Mario52}} |
{{Macro|Icon=Macro_Make_Arc_3_Points|Name=Macro Make Arc 3 Points|Description=Creates a arc from 3 selected points.|Author=Mario52|Version=01.00|Date=14/07/2016}} |
||
</translate> |
</translate> |
||
<translate> |
<translate> |
Revision as of 17:22, 25 September 2017
File:Macro Make Arc 3 Points Macro Make Arc 3 Points |
Description |
---|
Creates a arc from 3 selected points. Macro version: 01.00 Last modified: 14/07/2016 Author: Mario52 |
Author |
Mario52 |
Download |
None |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
01.00 |
Date last modified |
14/07/2016 |
FreeCAD Version(s) |
None |
Default shortcut |
None |
See also |
None |
Description
This macro creates a arc on 3 selected points.
Use
Launch the macro, select 3 points, the arc is created and the coordinates and the length of the arc are displayed in the report view.
(PS: It is not required to hold down the Ctrl key)
Script
Macro_Make_Arc_3_Points.FCMacro
# -*- coding: utf-8 -*-
from FreeCAD import Base
__title__ = "Macro_Make_Arc_3_points"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__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
selected.append(pnt)
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])
try:
C1 = Part.Arc(FreeCAD.Vector(selected[0]),FreeCAD.Vector(selected[1]),FreeCAD.Vector(selected[2]))
S1 = Part.Shape([C1])
W = Part.Wire(S1.Edges)
Part.show(W)
App.ActiveDocument.ActiveObject.Label = "Arc_3_Points"
print "Length : ",W.Length
except Exception:
print "Three points are collinear or bad selection"
del selected[:]
FreeCADGui.Selection.removeObserver(s)
print "End Make_Arc_3_Points"
print "_____________________"
s=SelObserver()
FreeCADGui.Selection.addObserver(s)