Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad
This commit is contained in:
commit
5caf64e4c5
|
@ -284,6 +284,8 @@ Document* Application::newDocument(const char * Name, const char * UserName)
|
|||
_pActiveDoc->signalChangedObject.connect(boost::bind(&App::Application::slotChangedObject, this, _1, _2));
|
||||
_pActiveDoc->signalRenamedObject.connect(boost::bind(&App::Application::slotRenamedObject, this, _1));
|
||||
_pActiveDoc->signalActivatedObject.connect(boost::bind(&App::Application::slotActivatedObject, this, _1));
|
||||
_pActiveDoc->signalUndo.connect(boost::bind(&App::Application::slotUndoDocument, this, _1));
|
||||
_pActiveDoc->signalRedo.connect(boost::bind(&App::Application::slotRedoDocument, this, _1));
|
||||
|
||||
// make sure that the active document is set in case no GUI is up
|
||||
{
|
||||
|
@ -827,6 +829,15 @@ void Application::slotActivatedObject(const App::DocumentObject&O)
|
|||
this->signalActivatedObject(O);
|
||||
}
|
||||
|
||||
void Application::slotUndoDocument(const App::Document& d)
|
||||
{
|
||||
this->signalUndoDocument(d);
|
||||
}
|
||||
|
||||
void Application::slotRedoDocument(const App::Document& d)
|
||||
{
|
||||
this->signalRedoDocument(d);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// Init, Destruct and singleton
|
||||
|
|
|
@ -116,6 +116,10 @@ public:
|
|||
boost::signal<void (const Document&)> signalStartRestoreDocument;
|
||||
/// signal on restoring Document
|
||||
boost::signal<void (const Document&)> signalFinishRestoreDocument;
|
||||
/// signal on undo in document
|
||||
boost::signal<void (const Document&)> signalUndoDocument;
|
||||
/// signal on redo in document
|
||||
boost::signal<void (const Document&)> signalRedoDocument;
|
||||
//@}
|
||||
|
||||
|
||||
|
@ -240,6 +244,8 @@ protected:
|
|||
void slotChangedObject(const App::DocumentObject&, const App::Property& Prop);
|
||||
void slotRenamedObject(const App::DocumentObject&);
|
||||
void slotActivatedObject(const App::DocumentObject&);
|
||||
void slotUndoDocument(const App::Document&);
|
||||
void slotRedoDocument(const App::Document&);
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
|
|
@ -239,6 +239,9 @@ bool Document::undo(void)
|
|||
|
||||
delete mUndoTransactions.back();
|
||||
mUndoTransactions.pop_back();
|
||||
|
||||
signalUndo(*this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -263,6 +266,9 @@ bool Document::redo(void)
|
|||
|
||||
delete mRedoTransactions.back();
|
||||
mRedoTransactions.pop_back();
|
||||
|
||||
signalRedo(*this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -92,6 +92,10 @@ public:
|
|||
boost::signal<void (const App::DocumentObject&)> signalRenamedObject;
|
||||
/// signal on activated Object
|
||||
boost::signal<void (const App::DocumentObject&)> signalActivatedObject;
|
||||
/// signal on undo
|
||||
boost::signal<void (const App::Document&)> signalUndo;
|
||||
/// signal on redo
|
||||
boost::signal<void (const App::Document&)> signalRedo;
|
||||
/** signal on load/save document
|
||||
* this signal is given when the document gets streamed.
|
||||
* you can use this hook to write additional information in
|
||||
|
|
|
@ -204,6 +204,12 @@ TaskView::TaskView(QWidget *parent)
|
|||
connectApplicationDeleteDocument =
|
||||
App::GetApplication().signalDeletedDocument.connect
|
||||
(boost::bind(&Gui::TaskView::TaskView::slotDeletedDocument, this));
|
||||
connectApplicationUndoDocument =
|
||||
App::GetApplication().signalUndoDocument.connect
|
||||
(boost::bind(&Gui::TaskView::TaskView::slotUndoDocument, this, _1));
|
||||
connectApplicationRedoDocument =
|
||||
App::GetApplication().signalRedoDocument.connect
|
||||
(boost::bind(&Gui::TaskView::TaskView::slotRedoDocument, this, _1));
|
||||
}
|
||||
|
||||
TaskView::~TaskView()
|
||||
|
@ -259,6 +265,17 @@ void TaskView::slotDeletedDocument()
|
|||
updateWatcher();
|
||||
}
|
||||
|
||||
void TaskView::slotUndoDocument(const App::Document&)
|
||||
{
|
||||
if (!ActiveDialog)
|
||||
updateWatcher();
|
||||
}
|
||||
|
||||
void TaskView::slotRedoDocument(const App::Document&)
|
||||
{
|
||||
if (!ActiveDialog)
|
||||
updateWatcher();
|
||||
}
|
||||
|
||||
/// @cond DOXERR
|
||||
void TaskView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
||||
|
|
|
@ -127,6 +127,8 @@ protected:
|
|||
|
||||
void slotActiveDocument(const App::Document&);
|
||||
void slotDeletedDocument();
|
||||
void slotUndoDocument(const App::Document&);
|
||||
void slotRedoDocument(const App::Document&);
|
||||
|
||||
std::vector<TaskWatcher*> ActiveWatcher;
|
||||
|
||||
|
@ -136,6 +138,8 @@ protected:
|
|||
|
||||
Connection connectApplicationActiveDocument;
|
||||
Connection connectApplicationDeleteDocument;
|
||||
Connection connectApplicationUndoDocument;
|
||||
Connection connectApplicationRedoDocument;
|
||||
};
|
||||
|
||||
} //namespace TaskView
|
||||
|
|
|
@ -1444,8 +1444,9 @@ void PlacementEditor::showValue(const QVariant& d)
|
|||
double angle;
|
||||
Base::Vector3d dir, pos;
|
||||
p.getRotation().getValue(dir, angle);
|
||||
angle = Base::toDegrees<double>(angle);
|
||||
pos = p.getPosition();
|
||||
QString data = QString::fromAscii("[(%1 %2 %3);%4;(%5 %6 %7)]")
|
||||
QString data = QString::fromUtf8("[(%1 %2 %3);%4 \xc2\xb0;(%5 %6 %7)]")
|
||||
.arg(QLocale::system().toString(dir.x,'f',2))
|
||||
.arg(QLocale::system().toString(dir.y,'f',2))
|
||||
.arg(QLocale::system().toString(dir.z,'f',2))
|
||||
|
@ -1594,10 +1595,11 @@ QVariant PropertyPlacementItem::toolTip(const App::Property* prop) const
|
|||
double angle;
|
||||
Base::Vector3d dir, pos;
|
||||
p.getRotation().getValue(dir, angle);
|
||||
angle = Base::toDegrees<double>(angle);
|
||||
pos = p.getPosition();
|
||||
QString data = QString::fromAscii("Axis: (%1 %2 %3)\n"
|
||||
"Angle: %4\n"
|
||||
"Move: (%5 %6 %7)")
|
||||
QString data = QString::fromUtf8("Axis: (%1 %2 %3)\n"
|
||||
"Angle: %4 \xc2\xb0\n"
|
||||
"Position: (%5 %6 %7)")
|
||||
.arg(QLocale::system().toString(dir.x,'f',decimals()))
|
||||
.arg(QLocale::system().toString(dir.y,'f',decimals()))
|
||||
.arg(QLocale::system().toString(dir.z,'f',decimals()))
|
||||
|
@ -1614,8 +1616,9 @@ QVariant PropertyPlacementItem::toString(const QVariant& prop) const
|
|||
double angle;
|
||||
Base::Vector3d dir, pos;
|
||||
p.getRotation().getValue(dir, angle);
|
||||
angle = Base::toDegrees<double>(angle);
|
||||
pos = p.getPosition();
|
||||
QString data = QString::fromAscii("[(%1 %2 %3);%4;(%5 %6 %7)]")
|
||||
QString data = QString::fromUtf8("[(%1 %2 %3);%4 \xc2\xb0;(%5 %6 %7)]")
|
||||
.arg(QLocale::system().toString(dir.x,'f',2))
|
||||
.arg(QLocale::system().toString(dir.y,'f',2))
|
||||
.arg(QLocale::system().toString(dir.z,'f',2))
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -38,6 +38,7 @@ else: gui = True
|
|||
|
||||
#***************************************************************************
|
||||
# Tailor following to your requirements ( Should all be strings ) *
|
||||
global fafs
|
||||
#fafs = '$fa = 12, $fs = 2'
|
||||
#convexity = 'convexity = 10'
|
||||
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
|
||||
|
@ -106,7 +107,6 @@ def process_object(csg,ob):
|
|||
if ob.Type == "Part::Sphere" :
|
||||
print "Sphere Radius : "+str(ob.Radius)
|
||||
check_multmatrix(csg,ob,0,0,0)
|
||||
global fafs
|
||||
csg.write("sphere($fn = 0, "+fafs+", r = "+str(ob.Radius)+");\n")
|
||||
|
||||
elif ob.Type == "Part::Box" :
|
||||
|
@ -118,7 +118,6 @@ def process_object(csg,ob):
|
|||
elif ob.Type == "Part::Cylinder" :
|
||||
print "cylinder : Height "+str(ob.Height)+ " Radius "+str(ob.Radius)
|
||||
mm = check_multmatrix(csg,ob,0,0,-ob.Height/2)
|
||||
global fafs
|
||||
csg.write("cylinder($fn = 0, "+fafs+", h = "+str(ob.Height)+ ", r1 = "+str(ob.Radius)+\
|
||||
", r2 = " + str(ob.Radius) + ", center = "+center(mm)+");\n")
|
||||
if mm == 1 : csg.write("}\n")
|
||||
|
@ -126,7 +125,6 @@ def process_object(csg,ob):
|
|||
elif ob.Type == "Part::Cone" :
|
||||
print "cone : Height "+str(ob.Height)+ " Radius1 "+str(ob.Radius1)+" Radius2 "+str(ob.Radius2)
|
||||
mm = check_multmatrix(csg,ob,0,0,-ob.Height/2)
|
||||
global fafs
|
||||
csg.write("cylinder($fn = 0, "+fafs+", h = "+str(ob.Height)+ ", r1 = "+str(ob.Radius1)+\
|
||||
", r2 = "+str(ob.Radius2)+", center = "+center(mm)+");\n")
|
||||
if mm == 1 : csg.write("}\n")
|
||||
|
@ -137,7 +135,6 @@ def process_object(csg,ob):
|
|||
print ob.Radius2
|
||||
if ob.Angle3 == 360.00 :
|
||||
mm = check_multmatrix(csg,ob,0,0,0)
|
||||
global fafs
|
||||
csg.write("rotate_extrude("+convexity+", $fn = 0, "+fafs+")\n")
|
||||
csg.write("multmatrix([[1, 0, 0, "+str(ob.Radius1)+"], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])\n")
|
||||
csg.write("circle($fn = 0, "+fafs+", r = "+str(ob.Radius2)+");\n")
|
||||
|
@ -150,7 +147,7 @@ def process_object(csg,ob):
|
|||
print ob.Base
|
||||
print ob.Base.Name
|
||||
#if ( ob.Base == "Part::FeaturePython" and ob.Base.Name == "Polygon") :
|
||||
if ob.Base.Name == "Polygon" :
|
||||
if ob.Base.Name.startswith("Polygon") :
|
||||
f = str(ob.Base.FacesNumber)
|
||||
r = str(ob.Base.Radius)
|
||||
h = str(ob.Dir[2])
|
||||
|
@ -158,34 +155,30 @@ def process_object(csg,ob):
|
|||
print "Radius : " + r
|
||||
print "Height : " + h
|
||||
mm = check_multmatrix(csg,ob,0,0,-float(h)/2)
|
||||
global fafs
|
||||
csg.write("cylinder($fn = "+f+", "+fafs+", h = "+h+", r1 = "+r+\
|
||||
", r2 = "+r+", center = "+center(mm)+");\n")
|
||||
if mm == 1: csg.write("}\n")
|
||||
|
||||
elif ob.Base.Name == "circle" :
|
||||
elif ob.Base.Name.startswith("circle") :
|
||||
r = str(ob.Base.Radius)
|
||||
h = str(ob.Dir[2])
|
||||
print "Radius : " + r
|
||||
print "Height : " + h
|
||||
mm = check_multmatrix(csg,ob,0,0,-float(h)/2)
|
||||
global fafs
|
||||
csg.write("cylinder($fn = 0, "+fafs+", h = "+h+", r1 = "+r+\
|
||||
", r2 = "+r+", center = "+center(mm)+");\n")
|
||||
if mm == 1: csg.write("}\n")
|
||||
|
||||
elif ob.Base.Name == "Wire" :
|
||||
elif ob.Base.Name.startswith("Wire") :
|
||||
print "Wire extrusion"
|
||||
print ob.Base
|
||||
mm = check_multmatrix(csg,ob,0,0,0)
|
||||
global fafs
|
||||
csg.write("linear_extrude(height = "+str(ob.Dir[2])+", center = "+center(mm)+", "+convexity+", twist = 0, slices = 2, $fn = 0, "+fafs+")\n{\n")
|
||||
csg.write(vertexs2polygon(ob.Base.Shape.Vertexes))
|
||||
if mm == 1: csg.write("}\n")
|
||||
|
||||
elif ob.Base.Name == "square" :
|
||||
elif ob.Base.Name.startswith("square") :
|
||||
mm = check_multmatrix(csg,ob,0,0,0)
|
||||
global fafs
|
||||
csg.write("linear_extrude(height = "+str(ob.Dir[2])+", center = true, "+convexity+", twist = 0, slices = 2, $fn = 0, "+fafs+")\n{\n")
|
||||
csg.write("square (size = ["+str(ob.Base.Length)+", "+str(ob.Base.Width)+"],center = "+center(mm)+";\n}\n")
|
||||
if mm == 1: csg.write("}\n")
|
||||
|
|
|
@ -61,6 +61,7 @@ from tokrules import tokens
|
|||
dxfcache = {}
|
||||
def translate(context,text):
|
||||
"convenience function for Qt translator"
|
||||
from PyQt4 import QtGui
|
||||
return QtGui.QApplication.translate(context, text, None, \
|
||||
QtGui.QApplication.UnicodeUTF8)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user