Macro Geodesic Dome: Difference between revisions

From FreeCAD Documentation
m ("{{Codeextralink|" PS: if the path of the RAW code is modified (case upgrade) not forgoten modify the link in the Codeextralink template)
m (icon and upgrade)
Line 4: Line 4:
{{Macro
{{Macro
|Name=Macro Geodesic Dome
|Name=Macro Geodesic Dome
|Icon=Macro_Geodesic_Dome.svg
|Description=This macro creates a parametric geodesic dome
|Description=This macro creates a parametric geodesic dome shell. The dome radius and the frequency parameter will be set at creation time.
|Author=Ulrich Brammer, DeepSOIC, galou
|Author=Ulrich Brammer, DeepSOIC, galou
|Version=01.00
|Version=02.00
|Date=2019-03-24
|Date=2019-03-24
|FCVersion=All
|Download=[https://www.freecadweb.org/wiki/File:Macro_Geodesic_Dome.svg ToolBar Icon]
}}
}}


Line 50: Line 53:
# by: pyside-uic 0.2.15 running on PySide 1.2.2
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
#
# Upgrade 2019/06/16 for use with FreeCAD 0.19 version
#
#OS: Windows 10 (10.0)
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.19.16993 (Git)
#Build type: Release
#Branch: master
#Hash: 5ea062f6699666b2f284f6a52105acf20828b481
#Python version: 3.6.8
#Qt version: 5.12.1
#Coin version: 4.0.0a
#OCC version: 7.3.0

'''
'''
************************************************************************
************************************************************************
* Copyright (c)2015 Ulrich Brammer <ulrich1a[at]users.sourceforge.net> *
* Copyright (c)2015 2019 Ulrich Brammer <ulrich1a[at]users.sourceforge.net> *
* *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* This file is a supplement to the FreeCAD CAx development system. *
Line 113: Line 128:
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons \
self.buttonBox.setStandardButtons \
(QtGui.QDialogButtonBox.Cancel{{!}}QtGui.QDialogButtonBox.Ok)
(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 2, 1, 1, 1)
self.gridLayout.addWidget(self.buttonBox, 2, 1, 1, 1)
Line 125: Line 140:


def retranslateUi(self, Dialog):
def retranslateUi(self, Dialog):
# original code commented 2019/06/16
Dialog.setWindowTitle(QtGui.QApplication.translate \
# Dialog.setWindowTitle(QtGui.QApplication.translate \
("Dialog", "Geodesic Dome Creator", \
# ("Dialog", "Geodesic Dome Creator", \
None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate \
# None, QtGui.QApplication.UnicodeUTF8))
("Dialog", "Dome Radius", None, QtGui.QApplication.UnicodeUTF8))
# self.label.setText(QtGui.QApplication.translate \
self.label_2.setText(QtGui.QApplication.translate \
# ("Dialog", "Dome Radius", None, QtGui.QApplication.UnicodeUTF8))
# self.label_2.setText(QtGui.QApplication.translate \
("Dialog", "Frequency Parameter\n(Integer between 1 to 10)", \
# ("Dialog", "Frequency Parameter\n(Integer between 1 to 10)", \
None,QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate \
# None,QtGui.QApplication.UnicodeUTF8))
# self.label_3.setText(QtGui.QApplication.translate \
("Dialog", "This Macro creates \na full geodesic dome shell.\nX-Y-symmetry plane \nfor even frequencies", \
# ("Dialog", "This Macro creates \na full geodesic dome shell.\nX-Y-symmetry plane \nfor even frequencies", \
None, QtGui.QApplication.UnicodeUTF8))
# None, QtGui.QApplication.UnicodeUTF8))
####
# replacement code 2019/06/16
Dialog.setWindowTitle("Geodesic Dome Creator")
self.label.setText("Dome Radius")
self.label_2.setText("Frequency Parameter\n(Integer between 1 to 10)")
self.label_3.setText("This Macro creates \na full geodesic dome shell.\nX-Y-symmetry plane \nfor even frequencies")
####


def makeSomething(self):
def makeSomething(self):
print "accepted! Dome radius: ", self.lineEdit.property("text"), \
print( "accepted! Dome radius: ", self.lineEdit.property("text"), \
" with Frequency: ", int(self.lineEdit_2.text())
" with Frequency: ", int(self.lineEdit_2.text()))


doc=App.activeDocument()
doc=App.activeDocument()
Line 154: Line 177:
def makeNothing(self):
def makeNothing(self):
print "rejected!!"
print( "rejected!!")
self.dia.close()
self.dia.close()
Line 193: Line 216:
# Part.show(thirdEdge)
# Part.show(thirdEdge)
if l > 0:
if l > 0:
print "in l: ", l, " mod 2: ", l%2
print( "in l: ", l, " mod 2: ", l%2)
# What to do here?
# What to do here?
#secEdge = Part.makeLine(oThirdPt,thirdPt)
#secEdge = Part.makeLine(oThirdPt,thirdPt)
Line 327: Line 350:
d.show()
d.show()
}}
}}
<translate>


==Link==

Forum [https://forum.freecadweb.org/viewtopic.php?t=9174 Designing geodesic dome]

</translate>
{{clear}}
{{clear}}

Revision as of 19:03, 16 June 2019

Other languages:

Macro Geodesic Dome

Description
This macro creates a parametric geodesic dome shell. The dome radius and the frequency parameter will be set at creation time.

Macro version: 02.00
Last modified: 2019-03-24
FreeCAD version: All
Download: ToolBar Icon
Author: Ulrich Brammer, DeepSOIC, galou
Author
Ulrich Brammer, DeepSOIC, galou
Download
ToolBar Icon
Links
Macro Version
02.00
Date last modified
2019-03-24
FreeCAD Version(s)
All
Default shortcut
None
See also
None

Description

This macro creates a parametric geodesic dome shell. The dome radius and the frequency parameter will be set at creation time.

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://raw.githubusercontent.com/FreeCAD/FreeCAD-macros/master/ParametricObjectCreation/geodesic_dome/geodesic_dome.py" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://raw.githubusercontent.com/FreeCAD/FreeCAD-macros/master/ParametricObjectCreation/geodesic_dome/geodesic_dome.py")


How to use

1. Install the macro using Addon Manager (menu Tools → Addon Manager). On tab "Macros", pick "GeodesicDome", click "Install". Then close addon manager.

2. Run GeodesicDome.FCMacro. A dialog should appear

3. Specify the parameters, click OK.

a dome shape should appear. You can then edit dome parameters by altering properties of GeoDome object.

Script

(this is an old, non-parametric version of the script. Up-to-date version is in FreeCAD-macros repository, here! )

Macro_Geodesic_Dome.FCMacro

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'geodesic_dialog.ui'
# And changed manually to use FreeCAD "Gui::InputField"
# Created: Sun Jan  4 22:20:58 2015
#      by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# Upgrade 2019/06/16 for use with FreeCAD 0.19 version
#OS: Windows 10 (10.0)
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.19.16993 (Git)
#Build type: Release
#Branch: master
#Hash: 5ea062f6699666b2f284f6a52105acf20828b481
#Python version: 3.6.8
#Qt version: 5.12.1
#Coin version: 4.0.0a
#OCC version: 7.3.0

'''
************************************************************************
* Copyright (c)2015 2019 Ulrich Brammer <ulrich1a[at]users.sourceforge.net> *
*                                                                      *
* This file is a supplement to the FreeCAD CAx development system.     *
*                                                                      *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL)   *
* as published by the Free Software Foundation; either version 2 of    *
* the License, or (at your option) any later version.                  *
* for detail see the LICENCE text file.                                *
*                                                                      *
* This software is distributed in the hope that it will be useful,     *
* but WITHOUT ANY WARRANTY; without even the implied warranty of       *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
* GNU Library General Public License for more details.                 *
*                                                                      *
* You should have received a copy of the GNU Library General Public    *
* License along with this macro; if not, write to the Free Software    *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 *
* USA                                                                  *
*                                                                      *
************************************************************************
'''


from PySide import QtCore, QtGui
import FreeCAD, FreeCADGui, math, Part
from FreeCAD import Base

class Ui_Dialog(object):
  def setupUi(self, Dialog):
    Dialog.setObjectName("Dialog")
    Dialog.resize(477, 188)
    self.dia = Dialog
    self.gridLayoutWidget = QtGui.QWidget(Dialog)
    self.gridLayoutWidget.setGeometry(QtCore.QRect(19, 19, 440, 141))
    self.gridLayoutWidget.setObjectName("gridLayoutWidget")
    self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget)
    self.gridLayout.setContentsMargins(0, 0, 0, 0)
    self.gridLayout.setObjectName("gridLayout")
    self.label = QtGui.QLabel(self.gridLayoutWidget)
    self.label.setObjectName("label")
    self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
    #self.lineEdit = QtGui.QLineEdit(self.gridLayoutWidget)
    fui = FreeCADGui.UiLoader()
    self.lineEdit = fui.createWidget("Gui::InputField")
    
    self.lineEdit.setObjectName("lineEdit")
    self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1)
    self.label_2 = QtGui.QLabel(self.gridLayoutWidget)
    self.label_2.setObjectName("label_2")
    self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
    self.lineEdit_2 = QtGui.QLineEdit(self.gridLayoutWidget)
    self.lineEdit_2.setObjectName("lineEdit_2")
    self.gridLayout.addWidget(self.lineEdit_2, 1, 1, 1, 1)
    self.label_3 = QtGui.QLabel(self.gridLayoutWidget)
    self.label_3.setObjectName("label_3")
    self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1)
    self.buttonBox = QtGui.QDialogButtonBox(self.gridLayoutWidget)
    self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
    self.buttonBox.setStandardButtons \
      (QtGui.QDialogButtonBox.Cancel

Link

Forum Designing geodesic dome