loft thickness
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: loft thickness
i used the dialogue box to create and past the text and execute it
Re: loft thickness
Did you use the latest version? That would be Version 2.1. What is the message in the Report view?
Mark
Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
Re: loft thickness
this is a copy of the macro as it appears in freecad
# # # #
#
# AIRFOIL IMPORT & SCALE v1.5
#
# Imports and scales an Airfoil in the form of a Draft Wire (DWire)
#
# # # #
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QLineEdit
import FreeCAD, FreeCADGui, Draft
import importAirfoilDAT
# Select .dat airfoil data file to be imported
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open An Airfoil File','*.dat')
class p():
def proceed(self):
try:
# This produces a scaled Airfoil with a DWire
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
def close(self):
self.dialog.hide()
def __init__(self):
self.dialog = None
self.s1 = None
# Make dialog box and get the scale size
self.dialog = QtGui.QDialog()
self.dialog.resize(350,100)
self.dialog.setWindowTitle("Airfoil Import & Scale")
la = QtGui.QVBoxLayout(self.dialog)
t1 = QtGui.QLabel("Chord Length")
la.addWidget(t1)
self.s1 = QtGui.QLineEdit()
la.addWidget(self.s1)
# Add OK / Cancel buttons
okbox = QtGui.QDialogButtonBox(self.dialog)
okbox.setOrientation(QtCore.Qt.Horizontal)
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
la.addWidget(okbox)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.proceed)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
QtCore.QMetaObject.connectSlotsByName(self.dialog)
self.dialog.show()
self.dialog.exec_()
p()
Version 2
Warning - Using this Macro with versions of FreeCAD lesser than 0.14, revision 3077 will not produce the expected results when using the BSpline option and can result in FreeCAD crashing and loss of unsaved data!
# # # #
#
# AIRFOIL IMPORT & SCALE v2.
#
# Imports and scales an Airfoil in the form of a Draft Wire (DWire) or Basic Spline (BSpline)
#
# For FreeCAD Versions = or > 0.14 Revision 3077
#
# Works best with OCC/OCE = or > 6.7
#
# # # #
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QLineEdit, QRadioButton
import FreeCAD, FreeCADGui, Draft
import importAirfoilDAT
# Select .dat airfoil data file to be imported
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open An Airfoil File','*.dat')
class p():
def proceed(self):
if self.radio1.isChecked():
try:
# This produces a scaled Airfoil with a DWire
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
if self.radio2.isChecked():
try:
# This produces a scaled Airfoil with a BSpline
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
points = FreeCAD.ActiveDocument.ActiveObject.Points
Draft.makeBSpline(points, closed=True)
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
App.getDocument("Unnamed").removeObject("DWire")
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
def close(self):
self.dialog.hide()
def __init__(self):
self.dialog = None
self.s1 = None
# Make dialog box and get the scale size
self.dialog = QtGui.QDialog()
self.dialog.resize(350,100)
self.dialog.setWindowTitle("Airfoil Import & Scale")
la = QtGui.QVBoxLayout(self.dialog)
t1 = QtGui.QLabel("Chord Length")
la.addWidget(t1)
self.s1 = QtGui.QLineEdit()
la.addWidget(self.s1)
# Add radio buttons to select between DWire and BSpline
self.radio1 = QRadioButton("Make DWire")
self.radio2 = QRadioButton("Make BSpline")
# set default to DWire & make radio buttons - Change self.radio1.setChecked(True) to
# self.radio2.setChecked(True) to set BSpline as default
self.radio1.setChecked(True)
la.addWidget(self.radio1)
la.addWidget(self.radio2)
# Add OK / Cancel buttons
okbox = QtGui.QDialogButtonBox(self.dialog)
okbox.setOrientation(QtCore.Qt.Horizontal)
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
la.addWidget(okbox)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.proceed)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
QtCore.QMetaObject.connectSlotsByName(self.dialog)
self.dialog.show()
self.dialog.exec_()
p()
OS: Windows XP
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.5018 (Git)
Build type: Release
Branch: master
Hash: 5676c632f63b75955d3376f2fda09f4e892d490c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
# # # #
#
# AIRFOIL IMPORT & SCALE v1.5
#
# Imports and scales an Airfoil in the form of a Draft Wire (DWire)
#
# # # #
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QLineEdit
import FreeCAD, FreeCADGui, Draft
import importAirfoilDAT
# Select .dat airfoil data file to be imported
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open An Airfoil File','*.dat')
class p():
def proceed(self):
try:
# This produces a scaled Airfoil with a DWire
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
def close(self):
self.dialog.hide()
def __init__(self):
self.dialog = None
self.s1 = None
# Make dialog box and get the scale size
self.dialog = QtGui.QDialog()
self.dialog.resize(350,100)
self.dialog.setWindowTitle("Airfoil Import & Scale")
la = QtGui.QVBoxLayout(self.dialog)
t1 = QtGui.QLabel("Chord Length")
la.addWidget(t1)
self.s1 = QtGui.QLineEdit()
la.addWidget(self.s1)
# Add OK / Cancel buttons
okbox = QtGui.QDialogButtonBox(self.dialog)
okbox.setOrientation(QtCore.Qt.Horizontal)
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
la.addWidget(okbox)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.proceed)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
QtCore.QMetaObject.connectSlotsByName(self.dialog)
self.dialog.show()
self.dialog.exec_()
p()
Version 2
Warning - Using this Macro with versions of FreeCAD lesser than 0.14, revision 3077 will not produce the expected results when using the BSpline option and can result in FreeCAD crashing and loss of unsaved data!
# # # #
#
# AIRFOIL IMPORT & SCALE v2.
#
# Imports and scales an Airfoil in the form of a Draft Wire (DWire) or Basic Spline (BSpline)
#
# For FreeCAD Versions = or > 0.14 Revision 3077
#
# Works best with OCC/OCE = or > 6.7
#
# # # #
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QLineEdit, QRadioButton
import FreeCAD, FreeCADGui, Draft
import importAirfoilDAT
# Select .dat airfoil data file to be imported
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open An Airfoil File','*.dat')
class p():
def proceed(self):
if self.radio1.isChecked():
try:
# This produces a scaled Airfoil with a DWire
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
if self.radio2.isChecked():
try:
# This produces a scaled Airfoil with a BSpline
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
points = FreeCAD.ActiveDocument.ActiveObject.Points
Draft.makeBSpline(points, closed=True)
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
App.getDocument("Unnamed").removeObject("DWire")
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
def close(self):
self.dialog.hide()
def __init__(self):
self.dialog = None
self.s1 = None
# Make dialog box and get the scale size
self.dialog = QtGui.QDialog()
self.dialog.resize(350,100)
self.dialog.setWindowTitle("Airfoil Import & Scale")
la = QtGui.QVBoxLayout(self.dialog)
t1 = QtGui.QLabel("Chord Length")
la.addWidget(t1)
self.s1 = QtGui.QLineEdit()
la.addWidget(self.s1)
# Add radio buttons to select between DWire and BSpline
self.radio1 = QRadioButton("Make DWire")
self.radio2 = QRadioButton("Make BSpline")
# set default to DWire & make radio buttons - Change self.radio1.setChecked(True) to
# self.radio2.setChecked(True) to set BSpline as default
self.radio1.setChecked(True)
la.addWidget(self.radio1)
la.addWidget(self.radio2)
# Add OK / Cancel buttons
okbox = QtGui.QDialogButtonBox(self.dialog)
okbox.setOrientation(QtCore.Qt.Horizontal)
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
la.addWidget(okbox)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.proceed)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
QtCore.QMetaObject.connectSlotsByName(self.dialog)
self.dialog.show()
self.dialog.exec_()
p()
OS: Windows XP
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.5018 (Git)
Build type: Release
Branch: master
Hash: 5676c632f63b75955d3376f2fda09f4e892d490c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Re: loft thickness
a quick thanks to everyone, i'm making progress
Re: loft thickness
Wrong version for your version of FreeCAD, replace it with the one I linked to, version 2.1.duk wrote:this is a copy of the macro as it appears in freecad
And when pasting macros and the like use the Code brackets like this -
Code: Select all
# # # #
#
# AIRFOIL IMPORT & SCALE v1.5
#
# Imports and scales an Airfoil in the form of a Draft Wire (DWire)
#
# # # #
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QLineEdit
import FreeCAD, FreeCADGui, Draft
import importAirfoilDAT
# Select .dat airfoil data file to be imported
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open An Airfoil File','*.dat')
class p():
def proceed(self):
try:
# This produces a scaled Airfoil with a DWire
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
def close(self):
self.dialog.hide()
def __init__(self):
self.dialog = None
self.s1 = None
# Make dialog box and get the scale size
self.dialog = QtGui.QDialog()
self.dialog.resize(350,100)
self.dialog.setWindowTitle("Airfoil Import & Scale")
la = QtGui.QVBoxLayout(self.dialog)
t1 = QtGui.QLabel("Chord Length")
la.addWidget(t1)
self.s1 = QtGui.QLineEdit()
la.addWidget(self.s1)
# Add OK / Cancel buttons
okbox = QtGui.QDialogButtonBox(self.dialog)
okbox.setOrientation(QtCore.Qt.Horizontal)
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
la.addWidget(okbox)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.proceed)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
QtCore.QMetaObject.connectSlotsByName(self.dialog)
self.dialog.show()
self.dialog.exec_()
p()
Version 2
Warning - Using this Macro with versions of FreeCAD lesser than 0.14, revision 3077 will not produce the expected results when using the BSpline option and can result in FreeCAD crashing and loss of unsaved data!
# # # #
#
# AIRFOIL IMPORT & SCALE v2.
#
# Imports and scales an Airfoil in the form of a Draft Wire (DWire) or Basic Spline (BSpline)
#
# For FreeCAD Versions = or > 0.14 Revision 3077
#
# Works best with OCC/OCE = or > 6.7
#
# # # #
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QLineEdit, QRadioButton
import FreeCAD, FreeCADGui, Draft
import importAirfoilDAT
# Select .dat airfoil data file to be imported
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open An Airfoil File','*.dat')
class p():
def proceed(self):
if self.radio1.isChecked():
try:
# This produces a scaled Airfoil with a DWire
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
if self.radio2.isChecked():
try:
# This produces a scaled Airfoil with a BSpline
scalefactor=float(self.s1.text())
f1=str(filename)
importAirfoilDAT.insert(f1,"Unnamed")
points = FreeCAD.ActiveDocument.ActiveObject.Points
Draft.makeBSpline(points, closed=True)
Draft.scale(App.ActiveDocument.ActiveObject,delta=App.Vector(scalefactor,scalefactor,scalefactor),center=App.Vector(0,0,0),legacy=True)
App.getDocument("Unnamed").removeObject("DWire")
except:
FreeCAD.Console.PrintError("Error, not a valid .dat file\n")
self.close()
def close(self):
self.dialog.hide()
def __init__(self):
self.dialog = None
self.s1 = None
# Make dialog box and get the scale size
self.dialog = QtGui.QDialog()
self.dialog.resize(350,100)
self.dialog.setWindowTitle("Airfoil Import & Scale")
la = QtGui.QVBoxLayout(self.dialog)
t1 = QtGui.QLabel("Chord Length")
la.addWidget(t1)
self.s1 = QtGui.QLineEdit()
la.addWidget(self.s1)
# Add radio buttons to select between DWire and BSpline
self.radio1 = QRadioButton("Make DWire")
self.radio2 = QRadioButton("Make BSpline")
# set default to DWire & make radio buttons - Change self.radio1.setChecked(True) to
# self.radio2.setChecked(True) to set BSpline as default
self.radio1.setChecked(True)
la.addWidget(self.radio1)
la.addWidget(self.radio2)
# Add OK / Cancel buttons
okbox = QtGui.QDialogButtonBox(self.dialog)
okbox.setOrientation(QtCore.Qt.Horizontal)
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
la.addWidget(okbox)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.proceed)
QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
QtCore.QMetaObject.connectSlotsByName(self.dialog)
self.dialog.show()
self.dialog.exec_()
p()
OS: Windows XP
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.5018 (Git)
Build type: Release
Branch: master
Hash: 5676c632f63b75955d3376f2fda09f4e892d490c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
Re: loft thickness
i changed to 2.1, that's the one that works