FreeCAD-macros

Форк
0
/
EllipseCenter2Points.FCMacro 
41 строка · 1.1 Кб
1
__Name__ = 'Ellipse Center + 2 Points'
2
__Comment__ = ''
3
__Author__ = 'Eriossoltero'
4
__Version__ = ''
5
__Date__ = ''
6
__License__ = 'LGPL-2.0-or-later'
7
__Web__ = 'http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html'
8
__Wiki__ = ''
9
__Icon__ = ''
10
__Help__ = ''
11
__Status__ = ''
12
__Requires__ = ''
13
__Communication__ = ''
14
__Files__ = ''
15

16
import FreeCAD as app
17
import FreeCADGui as gui
18
import Part, PartGui
19
from FreeCAD import Base
20

21
# get the selected objects, with first selection for the trajectory and second for the section
22
# Adapted from:
23
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
24
s = gui.Selection.getSelection()
25
try:
26
    sel1 = s[0].Shape
27
    sel2 = s[1].Shape
28
    sel3 = s[2].Shape
29
except:
30
    app.Console.PrintError('Wrong selection')
31

32
pt_center = sel1.Point
33
pt_radmay = sel2.Point
34
pt_radmen = sel3.Point
35

36
# create Part object in the current document
37
myObject = app.ActiveDocument.addObject('Part::Feature', 'Ellipse')
38

39
# create a shape and assign it to the current document
40
ellipse = Part.Ellipse(pt_radmay, pt_radmen, pt_center)
41
myObject.Shape = ellipse.toShape()
42

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.