FreeCAD

Форк
0
/
testPathArray.py 
54 строки · 2.8 Кб
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
# ***************************************************************************
4
# *   Copyright (c) 2013 WandererFan <wandererfan@gmail.com>                *
5
# *                                                                         *
6
# *   This file is part of the FreeCAD CAx development system.              *
7
# *                                                                         *
8
# *   This program is free software; you can redistribute it and/or modify  *
9
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
10
# *   as published by the Free Software Foundation; either version 2 of     *
11
# *   the License, or (at your option) any later version.                   *
12
# *   for detail see the LICENCE text file.                                 *
13
# *                                                                         *
14
# *   FreeCAD is distributed in the hope that it will be useful,            *
15
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
16
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
17
# *   GNU Library General Public License for more details.                  *
18
# *                                                                         *
19
# *   You should have received a copy of the GNU Library General Public     *
20
# *   License along with FreeCAD; if not, write to the Free Software        *
21
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
22
# *   USA                                                                   *
23
# *                                                                         *
24
# ***************************************************************************/
25

26
# Tester for Draft makePathArray - shapes on a path - without subelements (see testPathArraySel.py)
27
# Usage: in FC gui, select a "shape" document object (sphere, box, etc) (!!select in
28
# tree, not document view!!), then a "wire" document object (Wire, Circle, Rectangle,
29
# DWire, etc) then run this macro.
30

31
import FreeCAD
32
import FreeCADGui
33
import Part
34
import Draft
35

36
print("testPathArray started")
37
items = 4  # count
38
centretrans = FreeCAD.Vector(0, 0, 0)  # no translation
39
# centretrans = FreeCAD.Vector(-5,-5,0)                     # translation
40
orient = True  # align to curve
41
# orient = False                                            # don't align to curve
42

43
s = FreeCADGui.Selection.getSelection()
44
print("testPathArray: Objects in selection: ", len(s))
45
print("First object in selection is a: ", s[0].Shape.ShapeType)
46
print("Second object in selection is a: ", s[1].Shape.ShapeType)
47
base = s[0]
48
path = s[1]
49
pathsubs = []
50

51
# o = Draft.makePathArray(base,path,items)                            # test with defaults
52
o = Draft.makePathArray(base, path, items, centretrans, orient, pathsubs)  # test with non-defaults
53

54
print("testPathArray ended")
55

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

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

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

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