Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad into sanguinariojoe-ship
This commit is contained in:
commit
8f6d16cc31
|
@ -1082,10 +1082,10 @@ AC_MSG_NOTICE([
|
|||
RTTI enabled (forced): true
|
||||
Compiler warnings enabled: $fc_set_warn
|
||||
installation prefix: $prefix
|
||||
eneble-assembly: $fc_set_assembly
|
||||
eneble-cam: $fc_set_cam
|
||||
enable-assembly: $fc_set_assembly
|
||||
enable-cam: $fc_set_cam
|
||||
enable-sandbox: $fc_set_sandbox
|
||||
eneble-template: $fc_set_template
|
||||
enable-template: $fc_set_template
|
||||
Now, run 'make' to build FreeCAD.
|
||||
|
||||
**************************************************************************
|
||||
|
|
|
@ -847,6 +847,31 @@ unsigned int Document::getMemSize (void) const
|
|||
return size;
|
||||
}
|
||||
|
||||
void Document::exportGraphviz(std::ostream& out)
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
names.reserve(d->objectMap.size());
|
||||
DependencyList DepList;
|
||||
std::map<DocumentObject*,Vertex> VertexObjectList;
|
||||
|
||||
// Filling up the adjacency List
|
||||
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
|
||||
// add the object as Vertex and remember the index
|
||||
VertexObjectList[It->second] = add_vertex(DepList);
|
||||
names.push_back(It->second->Label.getValue());
|
||||
}
|
||||
// add the edges
|
||||
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
|
||||
std::vector<DocumentObject*> OutList = It->second->getOutList();
|
||||
for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2) {
|
||||
if (*It2)
|
||||
add_edge(VertexObjectList[It->second],VertexObjectList[*It2],DepList);
|
||||
}
|
||||
}
|
||||
|
||||
boost::write_graphviz(out, DepList, boost::make_label_writer(&(names[0])));
|
||||
}
|
||||
|
||||
// Save the document under the name it has been opened
|
||||
bool Document::save (void)
|
||||
{
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
/// Restore the document from the file in Property Path
|
||||
void restore (void);
|
||||
void exportObjects(const std::vector<App::DocumentObject*>&, std::ostream&);
|
||||
void exportGraphviz(std::ostream&);
|
||||
std::vector<App::DocumentObject*> importObjects(std::istream&);
|
||||
/// Opens the document from its file name
|
||||
//void open (void);
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
<UserDocu>Restore the document from disc</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="exportGraphviz">
|
||||
<Documentation>
|
||||
<UserDocu>Export the dependencies of the objects as graph</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="openTransaction">
|
||||
<Documentation>
|
||||
<UserDocu>Open a new Undo/Redo transaction.</UserDocu>
|
||||
|
|
|
@ -92,6 +92,25 @@ PyObject* DocumentPy::restore(PyObject * args)
|
|||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::exportGraphviz(PyObject * args)
|
||||
{
|
||||
char* fn=0;
|
||||
if (!PyArg_ParseTuple(args, "|s",&fn)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
if (fn) {
|
||||
Base::FileInfo fi(fn);
|
||||
Base::ofstream str(fi);
|
||||
getDocumentPtr()->exportGraphviz(str);
|
||||
str.close();
|
||||
Py_Return;
|
||||
}
|
||||
else {
|
||||
std::stringstream str;
|
||||
getDocumentPtr()->exportGraphviz(str);
|
||||
return PyString_FromString(str.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* DocumentPy::addObject(PyObject *args)
|
||||
{
|
||||
char *sType,*sName=0;
|
||||
|
|
|
@ -185,6 +185,9 @@ public:
|
|||
/** This method returns a string representation of the property
|
||||
*/
|
||||
const Base::Matrix4D &getValue(void) const;
|
||||
const char* getEditorName(void) const {
|
||||
return "Gui::PropertyEditor::PropertyMatrixItem";
|
||||
}
|
||||
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual void setPyObject(PyObject *);
|
||||
|
|
|
@ -192,7 +192,6 @@ PyObject* BoundBoxPy::getIntersectionPoint(PyObject *args)
|
|||
*(static_cast<Base::VectorPy*>(object2)->getVectorPtr()),
|
||||
point, epsilon);
|
||||
// IsInBox() doesn't handle border points correctly
|
||||
BoundBoxPy::PointerType bb = getBoundBoxPtr();
|
||||
if (ok) {
|
||||
return new VectorPy(point);
|
||||
}
|
||||
|
@ -209,6 +208,7 @@ PyObject* BoundBoxPy::move(PyObject *args)
|
|||
{
|
||||
double x,y,z;
|
||||
PyObject *object;
|
||||
|
||||
Base::Vector3d vec;
|
||||
|
||||
if (PyArg_ParseTuple(args, "ddd", &x,&y,&z)) {
|
||||
|
|
|
@ -691,3 +691,98 @@ void Matrix4D::fromString(const std::string &str)
|
|||
input >> dMtrx4D[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
// Analyse the a transformation Matrix and describe the transformation
|
||||
std::string Matrix4D::analyse(void) const
|
||||
{
|
||||
const double eps=1.0e-06;
|
||||
bool hastranslation = (dMtrx4D[0][3] != 0.0 ||
|
||||
dMtrx4D[1][3] != 0.0 || dMtrx4D[2][3] != 0.0);
|
||||
const Base::Matrix4D unityMatrix = Base::Matrix4D();
|
||||
std::string text;
|
||||
if (*this == unityMatrix)
|
||||
{
|
||||
text = "Unity Matrix";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dMtrx4D[3][0] != 0.0 || dMtrx4D[3][1] != 0.0 ||
|
||||
dMtrx4D[3][2] != 0.0 || dMtrx4D[3][3] != 1.0)
|
||||
{
|
||||
text = "Projection";
|
||||
}
|
||||
else //translation and affine
|
||||
{
|
||||
if (dMtrx4D[0][1] == 0.0 && dMtrx4D[0][2] == 0.0 &&
|
||||
dMtrx4D[1][0] == 0.0 && dMtrx4D[1][2] == 0.0 &&
|
||||
dMtrx4D[2][0] == 0.0 && dMtrx4D[2][1] == 0.0) //scaling
|
||||
{
|
||||
std::ostringstream stringStream;
|
||||
stringStream << "Scale [" << dMtrx4D[0][0] << ", " <<
|
||||
dMtrx4D[1][1] << ", " << dMtrx4D[2][2] << "]";
|
||||
text = stringStream.str();
|
||||
}
|
||||
else
|
||||
{
|
||||
Base::Matrix4D sub;
|
||||
sub[0][0] = dMtrx4D[0][0]; sub[0][1] = dMtrx4D[0][1];
|
||||
sub[0][2] = dMtrx4D[0][2]; sub[1][0] = dMtrx4D[1][0];
|
||||
sub[1][1] = dMtrx4D[1][1]; sub[1][2] = dMtrx4D[1][2];
|
||||
sub[2][0] = dMtrx4D[2][0]; sub[2][1] = dMtrx4D[2][1];
|
||||
sub[2][2] = dMtrx4D[2][2];
|
||||
|
||||
Base::Matrix4D trp = sub;
|
||||
trp.transpose();
|
||||
trp = trp * sub;
|
||||
bool ortho = true;
|
||||
for (int i=0; i<4 && ortho; i++) {
|
||||
for (int j=0; j<4 && ortho; j++) {
|
||||
if (i != j) {
|
||||
if (fabs(trp[i][j]) > eps) {
|
||||
ortho = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double determinant = sub.determinant();
|
||||
if (ortho)
|
||||
{
|
||||
if (fabs(determinant-1.0)<eps ) //rotation
|
||||
{
|
||||
text = "Rotation Matrix";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fabs(determinant+1.0)<eps ) //rotation
|
||||
{
|
||||
text = "Rotinversion Matrix";
|
||||
}
|
||||
else //scaling with rotation
|
||||
{
|
||||
std::ostringstream stringStream;
|
||||
stringStream << "Scale and Rotate ";
|
||||
if (determinant<0.0 )
|
||||
stringStream << "and Invert ";
|
||||
stringStream << "[ " <<
|
||||
sqrt(trp[0][0]) << ", " << sqrt(trp[1][1]) << ", " <<
|
||||
sqrt(trp[2][2]) << "]";
|
||||
text = stringStream.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream stringStream;
|
||||
stringStream << "Affine with det= " <<
|
||||
determinant;
|
||||
text = stringStream.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hastranslation)
|
||||
text += " with Translation";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -88,6 +88,8 @@ public:
|
|||
inline const double* operator[] (unsigned short usNdx) const;
|
||||
/// Compute the determinant of the matrix
|
||||
double determinant() const;
|
||||
/// Analyse the transformation
|
||||
std::string analyse(void) const;
|
||||
//@}
|
||||
|
||||
void getMatrix (double dMtrx[16]) const;
|
||||
|
|
|
@ -125,6 +125,14 @@ Get the sub-matrix. The parameter must be in the range [1,4].
|
|||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="analyze">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
analyze() -> string
|
||||
Analyzes the type of transformation.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="A11" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
|
|
|
@ -474,6 +474,18 @@ PyObject* MatrixPy::transpose(PyObject * args)
|
|||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::analyze(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
|
||||
PY_TRY {
|
||||
std::string type = getMatrixPtr()->analyse();
|
||||
return PyString_FromString(type.c_str());
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA11(void) const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[0][0];
|
||||
|
|
|
@ -24,12 +24,20 @@
|
|||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QClipboard>
|
||||
# include <QEventLoop>
|
||||
# include <QFileDialog>
|
||||
# include <QGraphicsScene>
|
||||
# include <QGraphicsView>
|
||||
# include <QLabel>
|
||||
# include <QStatusBar>
|
||||
# include <QPointer>
|
||||
# include <QProcess>
|
||||
# include <sstream>
|
||||
#endif
|
||||
#include <algorithm>
|
||||
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Sequencer.h>
|
||||
#include <App/Document.h>
|
||||
|
@ -311,6 +319,120 @@ bool StdCmdMergeProjects::isActive(void)
|
|||
return this->hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_ExportGraphviz
|
||||
//===========================================================================
|
||||
|
||||
namespace Gui {
|
||||
class ImageView : public MDIView
|
||||
{
|
||||
public:
|
||||
ImageView(const QPixmap& p, QWidget* parent=0) : MDIView(0, parent)
|
||||
{
|
||||
scene = new QGraphicsScene();
|
||||
scene->addPixmap(p);
|
||||
view = new QGraphicsView(scene, this);
|
||||
view->show();
|
||||
setCentralWidget(view);
|
||||
}
|
||||
~ImageView()
|
||||
{
|
||||
delete scene;
|
||||
delete view;
|
||||
}
|
||||
QGraphicsScene* scene;
|
||||
QGraphicsView* view;
|
||||
};
|
||||
}
|
||||
|
||||
DEF_STD_CMD_A(StdCmdExportGraphviz);
|
||||
|
||||
StdCmdExportGraphviz::StdCmdExportGraphviz()
|
||||
: Command("Std_ExportGraphviz")
|
||||
{
|
||||
// seting the
|
||||
sGroup = QT_TR_NOOP("Tools");
|
||||
sMenuText = QT_TR_NOOP("Dependency graph...");
|
||||
sToolTipText = QT_TR_NOOP("Show the dependency graph of the objects in the active document");
|
||||
sStatusTip = QT_TR_NOOP("Show the dependency graph of the objects in the active document");
|
||||
sWhatsThis = "Std_ExportGraphviz";
|
||||
eType = 0;
|
||||
}
|
||||
|
||||
void StdCmdExportGraphviz::activated(int iMsg)
|
||||
{
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
std::stringstream str;
|
||||
doc->exportGraphviz(str);
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Paths");
|
||||
QProcess proc;
|
||||
QStringList args;
|
||||
args << QLatin1String("-Tpng");
|
||||
#ifdef FC_OS_LINUX
|
||||
QString path = QString::fromUtf8(hGrp->GetASCII("Graphviz", "/usr/bin").c_str());
|
||||
#else
|
||||
QString path = QString::fromUtf8(hGrp->GetASCII("Graphviz").c_str());
|
||||
#endif
|
||||
bool pathChanged = false;
|
||||
#ifdef FC_OS_WIN32
|
||||
QString exe = QString::fromAscii("\"%1/dot\"").arg(path);
|
||||
#else
|
||||
QString exe = QString::fromAscii("%1/dot").arg(path);
|
||||
#endif
|
||||
proc.setEnvironment(QProcess::systemEnvironment());
|
||||
do {
|
||||
proc.start(exe, args);
|
||||
if (!proc.waitForStarted()) {
|
||||
int ret = QMessageBox::warning(getMainWindow(),
|
||||
qApp->translate("Std_ExportGraphviz","Graphviz not found"),
|
||||
qApp->translate("Std_ExportGraphviz","Graphviz couldn't be found on your system.\n"
|
||||
"Do you want to specify its installation path if it's already installed?"),
|
||||
QMessageBox::Yes, QMessageBox::No);
|
||||
if (ret == QMessageBox::No)
|
||||
return;
|
||||
path = QFileDialog::getExistingDirectory(Gui::getMainWindow(),
|
||||
qApp->translate("Std_ExportGraphviz","Graphviz installation path"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
pathChanged = true;
|
||||
#ifdef FC_OS_WIN32
|
||||
exe = QString::fromAscii("\"%1/dot\"").arg(path);
|
||||
#else
|
||||
exe = QString::fromAscii("%1/dot").arg(path);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (pathChanged)
|
||||
hGrp->SetASCII("Graphviz", (const char*)path.toUtf8());
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(true);
|
||||
|
||||
proc.write(str.str().c_str(), str.str().size());
|
||||
proc.closeWriteChannel();
|
||||
if (!proc.waitForFinished())
|
||||
return;
|
||||
|
||||
QPixmap px;
|
||||
if (px.loadFromData(proc.readAll(), "PNG")) {
|
||||
Gui::ImageView* view = new Gui::ImageView(px);
|
||||
view->setWindowTitle(qApp->translate("Std_ExportGraphviz","Dependency graph"));
|
||||
getMainWindow()->addWindow(view);
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(getMainWindow(),
|
||||
qApp->translate("Std_ExportGraphviz","Graphviz failed"),
|
||||
qApp->translate("Std_ExportGraphviz","Graphviz failed to create an image file"));
|
||||
}
|
||||
}
|
||||
|
||||
bool StdCmdExportGraphviz::isActive(void)
|
||||
{
|
||||
return (getActiveGuiDocument() ? true : false);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_New
|
||||
//===========================================================================
|
||||
|
@ -1126,6 +1248,7 @@ void CreateDocCommands(void)
|
|||
rcCmdMgr.addCommand(new StdCmdImport());
|
||||
rcCmdMgr.addCommand(new StdCmdExport());
|
||||
rcCmdMgr.addCommand(new StdCmdMergeProjects());
|
||||
rcCmdMgr.addCommand(new StdCmdExportGraphviz());
|
||||
|
||||
rcCmdMgr.addCommand(new StdCmdSave());
|
||||
rcCmdMgr.addCommand(new StdCmdSaveAs());
|
||||
|
|
|
@ -452,6 +452,7 @@ void StdCmdFreezeViews::languageChange()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Std_ToggleClipPlane
|
||||
//===========================================================================
|
||||
|
@ -522,8 +523,8 @@ Gui::Action * StdCmdDrawStyle::createAction(void)
|
|||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(pcAction);
|
||||
|
||||
QAction* a0 = pcAction->addAction(QString());
|
||||
QAction* a1 = pcAction->addAction(QString());
|
||||
pcAction->addAction(QString());
|
||||
pcAction->addAction(QString());
|
||||
_pcAction = pcAction;
|
||||
languageChange();
|
||||
return pcAction;
|
||||
|
|
|
@ -56,6 +56,7 @@ EXTRA_DIST = \
|
|||
edit-copy.svg \
|
||||
edit-cut.svg \
|
||||
edit-delete.svg \
|
||||
edit-edit.svg \
|
||||
edit-paste.svg \
|
||||
edit-select-all.svg \
|
||||
edit-select-box.svg \
|
||||
|
|
|
@ -111,6 +111,7 @@ void Gui::SoFCDB::init()
|
|||
PropertyBoolItem ::init();
|
||||
PropertyVectorItem ::init();
|
||||
PropertyDoubleVectorItem ::init();
|
||||
PropertyMatrixItem ::init();
|
||||
PropertyPlacementItem ::init();
|
||||
PropertyEnumItem ::init();
|
||||
PropertyStringListItem ::init();
|
||||
|
|
|
@ -26,9 +26,13 @@
|
|||
# include <QApplication>
|
||||
# include <QClipboard>
|
||||
# include <QMutex>
|
||||
# include <QProcess>
|
||||
# include <QSysInfo>
|
||||
# include <QTextStream>
|
||||
# include <QWaitCondition>
|
||||
# include <Python.h>
|
||||
# include <Inventor/C/basic.h>
|
||||
# include <Inventor/Qt/SoQtBasic.h>
|
||||
#endif
|
||||
|
||||
#include "Splashscreen.h"
|
||||
|
@ -241,6 +245,18 @@ static QString getPlatform()
|
|||
#elif defined (Q_OS_MAC)
|
||||
return QString::fromAscii("Mac OS X");
|
||||
#elif defined (Q_OS_LINUX)
|
||||
QString exe(QLatin1String("lsb_release"));
|
||||
QStringList args;
|
||||
args << QLatin1String("-ds");
|
||||
QProcess proc;
|
||||
proc.setEnvironment(QProcess::systemEnvironment());
|
||||
proc.start(exe, args);
|
||||
if (proc.waitForStarted() && proc.waitForFinished()) {
|
||||
QByteArray info = proc.readAll();
|
||||
info.replace('\n',"");
|
||||
return QString::fromAscii((const char*)info);
|
||||
}
|
||||
|
||||
return QString::fromAscii("Linux");
|
||||
#elif defined (Q_OS_UNIX)
|
||||
return QString::fromAscii("UNIX");
|
||||
|
@ -326,6 +342,7 @@ void AboutDialog::on_copyButton_clicked()
|
|||
QString major = QString::fromAscii(config["BuildVersionMajor"].c_str());
|
||||
QString minor = QString::fromAscii(config["BuildVersionMinor"].c_str());
|
||||
QString build = QString::fromAscii(config["BuildRevision"].c_str());
|
||||
str << "Platform: " << getPlatform() << " (" << QSysInfo::WordSize << "-bit)" << endl;
|
||||
str << "Version: " << major << "." << minor << "." << build << endl;
|
||||
it = config.find("BuildRevisionBranch");
|
||||
if (it != config.end())
|
||||
|
@ -333,6 +350,14 @@ void AboutDialog::on_copyButton_clicked()
|
|||
it = config.find("BuildRevisionHash");
|
||||
if (it != config.end())
|
||||
str << "Hash: " << it->second.c_str() << endl;
|
||||
// report also the version numbers of the most important libraries in FreeCAD
|
||||
str << "Python version: " << PY_VERSION << endl;
|
||||
str << "Qt version: " << QT_VERSION_STR << endl;
|
||||
str << "Coin version: " << COIN_VERSION << endl;
|
||||
str << "SoQt version: " << SOQT_VERSION << endl;
|
||||
it = config.find("OCC_VERSION");
|
||||
if (it != config.end())
|
||||
str << "OCC version: " << it->second.c_str() << endl;
|
||||
|
||||
QClipboard* cb = QApplication::clipboard();
|
||||
cb->setText(data);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
# include <QDropEvent>
|
||||
# include <QDragEnterEvent>
|
||||
# include <QFileDialog>
|
||||
# include <QGLFormat>
|
||||
# include <QGLWidget>
|
||||
# include <QPainter>
|
||||
# include <QPrinter>
|
||||
# include <QPrintDialog>
|
||||
|
@ -299,6 +301,29 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
|
|||
else if (strcmp(Reason,"UseAntialiasing") == 0) {
|
||||
_viewer->getGLRenderAction()->setSmoothing(rGrp.GetBool("UseAntialiasing",false));
|
||||
}
|
||||
else if (strcmp(Reason,"SampleBuffers") == 0) {
|
||||
#if SOQT_MAJOR_VERSION > 1 || (SOQT_MAJOR_VERSION == 1 && SOQT_MINOR_VERSION >= 5)
|
||||
_viewer->setSampleBuffers(rGrp.GetInt("SampleBuffers",4));
|
||||
#else
|
||||
// http://stackoverflow.com/questions/4207506/where-is-gl-multisample-defined
|
||||
//int sb = rGrp.GetInt("SampleBuffers",4);
|
||||
//QGLWidget* gl = static_cast<QGLWidget*>(_viewer->getGLWidget());
|
||||
//QGLFormat fmt = gl->format();
|
||||
//if (sb > 0) {
|
||||
// fmt.setSampleBuffers(true);
|
||||
// fmt.setSamples(sb);
|
||||
// gl->setFormat(fmt);
|
||||
// gl->makeCurrent();
|
||||
// //glEnable(GL_MULTISAMPLE);
|
||||
//}
|
||||
//else {
|
||||
// fmt.setSampleBuffers(false);
|
||||
// gl->setFormat(fmt);
|
||||
// gl->makeCurrent();
|
||||
// //glDisable(GL_MULTISAMPLE);
|
||||
//}
|
||||
#endif
|
||||
}
|
||||
else if (strcmp(Reason,"ShowFPS") == 0) {
|
||||
_viewer->setEnabledFPSCounter(rGrp.GetBool("ShowFPS",false));
|
||||
}
|
||||
|
|
|
@ -490,8 +490,9 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
|||
MenuItem* tool = new MenuItem( menuBar );
|
||||
tool->setCommand("&Tools");
|
||||
*tool << "Std_DlgParameter" << "Separator"
|
||||
<< "Std_ViewScreenShot" << "Std_SceneInspector" << "Std_DemoMode"
|
||||
<< "Separator" << "Std_DlgCustomize";
|
||||
<< "Std_ViewScreenShot" << "Std_SceneInspector"
|
||||
<< "Std_ExportGraphviz" << "Std_ProjectUtil"
|
||||
<< "Std_DemoMode" << "Separator" << "Std_DlgCustomize";
|
||||
|
||||
// Macro
|
||||
MenuItem* macro = new MenuItem( menuBar );
|
||||
|
|
|
@ -544,7 +544,7 @@ PropertyFloatItem::PropertyFloatItem()
|
|||
QVariant PropertyFloatItem::toString(const QVariant& prop) const
|
||||
{
|
||||
double value = prop.toDouble();
|
||||
QString data = QLocale::system().toString(value, 'f', 2);
|
||||
QString data = QLocale::system().toString(value, 'f', decimals());
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
if (!props.empty()) {
|
||||
if (props.front()->getTypeId().isDerivedFrom(App::PropertyDistance::getClassTypeId())) {
|
||||
|
@ -698,7 +698,7 @@ PropertyFloatConstraintItem::PropertyFloatConstraintItem()
|
|||
QVariant PropertyFloatConstraintItem::toString(const QVariant& prop) const
|
||||
{
|
||||
double value = prop.toDouble();
|
||||
QString data = QLocale::system().toString(value, 'f', 2);
|
||||
QString data = QLocale::system().toString(value, 'f', decimals());
|
||||
return QVariant(data);
|
||||
}
|
||||
|
||||
|
@ -791,7 +791,7 @@ QVariant PropertyAngleItem::toString(const QVariant& prop) const
|
|||
{
|
||||
double value = prop.toDouble();
|
||||
QString data = QString::fromUtf8("%1 \xc2\xb0")
|
||||
.arg(QLocale::system().toString(value, 'f', 2));
|
||||
.arg(QLocale::system().toString(value, 'f', decimals()));
|
||||
return QVariant(data);
|
||||
}
|
||||
|
||||
|
@ -1050,6 +1050,358 @@ void PropertyDoubleVectorItem::setZ(double z)
|
|||
setData(QVariant::fromValue(Base::Vector3d(x(), y(), z)));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyMatrixItem, Gui::PropertyEditor::PropertyItem);
|
||||
|
||||
PropertyMatrixItem::PropertyMatrixItem()
|
||||
{
|
||||
const int decimals=16;
|
||||
m_a11 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a11->setParent(this);
|
||||
m_a11->setPropertyName(QLatin1String("A11"));
|
||||
m_a11->setDecimals(decimals);
|
||||
this->appendChild(m_a11);
|
||||
m_a12 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a12->setParent(this);
|
||||
m_a12->setPropertyName(QLatin1String("A12"));
|
||||
m_a12->setDecimals(decimals);
|
||||
this->appendChild(m_a12);
|
||||
m_a13 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a13->setParent(this);
|
||||
m_a13->setPropertyName(QLatin1String("A13"));
|
||||
m_a13->setDecimals(decimals);
|
||||
this->appendChild(m_a13);
|
||||
m_a14 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a14->setParent(this);
|
||||
m_a14->setPropertyName(QLatin1String("A14"));
|
||||
m_a14->setDecimals(decimals);
|
||||
this->appendChild(m_a14);
|
||||
m_a21 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a21->setParent(this);
|
||||
m_a21->setPropertyName(QLatin1String("A21"));
|
||||
m_a21->setDecimals(decimals);
|
||||
this->appendChild(m_a21);
|
||||
m_a22 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a22->setParent(this);
|
||||
m_a22->setPropertyName(QLatin1String("A22"));
|
||||
m_a22->setDecimals(decimals);
|
||||
this->appendChild(m_a22);
|
||||
m_a23 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a23->setParent(this);
|
||||
m_a23->setPropertyName(QLatin1String("A23"));
|
||||
m_a23->setDecimals(decimals);
|
||||
this->appendChild(m_a23);
|
||||
m_a24 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a24->setParent(this);
|
||||
m_a24->setPropertyName(QLatin1String("A24"));
|
||||
m_a24->setDecimals(decimals);
|
||||
this->appendChild(m_a24);
|
||||
m_a31 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a31->setParent(this);
|
||||
m_a31->setPropertyName(QLatin1String("A31"));
|
||||
m_a31->setDecimals(decimals);
|
||||
this->appendChild(m_a31);
|
||||
m_a32 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a32->setParent(this);
|
||||
m_a32->setPropertyName(QLatin1String("A32"));
|
||||
m_a32->setDecimals(decimals);
|
||||
this->appendChild(m_a32);
|
||||
m_a33 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a33->setParent(this);
|
||||
m_a33->setPropertyName(QLatin1String("A33"));
|
||||
m_a33->setDecimals(decimals);
|
||||
this->appendChild(m_a33);
|
||||
m_a34 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a34->setParent(this);
|
||||
m_a34->setPropertyName(QLatin1String("A34"));
|
||||
m_a34->setDecimals(decimals);
|
||||
this->appendChild(m_a34);
|
||||
m_a41 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a41->setParent(this);
|
||||
m_a41->setPropertyName(QLatin1String("A41"));
|
||||
m_a41->setDecimals(decimals);
|
||||
this->appendChild(m_a41);
|
||||
m_a42 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a42->setParent(this);
|
||||
m_a42->setPropertyName(QLatin1String("A42"));
|
||||
m_a42->setDecimals(decimals);
|
||||
this->appendChild(m_a42);
|
||||
m_a43 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a43->setParent(this);
|
||||
m_a43->setPropertyName(QLatin1String("A43"));
|
||||
m_a43->setDecimals(decimals);
|
||||
this->appendChild(m_a43);
|
||||
m_a44 = static_cast<PropertyFloatItem*>(PropertyFloatItem::create());
|
||||
m_a44->setParent(this);
|
||||
m_a44->setPropertyName(QLatin1String("A44"));
|
||||
m_a44->setDecimals(decimals);
|
||||
this->appendChild(m_a44);
|
||||
}
|
||||
|
||||
QVariant PropertyMatrixItem::toString(const QVariant& prop) const
|
||||
{
|
||||
const Base::Matrix4D& value = prop.value<Base::Matrix4D>();
|
||||
QString text = QString::fromAscii("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
|
||||
.arg(QLocale::system().toString(value[0][0], 'f', 2)) //(unsigned short usNdx)
|
||||
.arg(QLocale::system().toString(value[0][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[0][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[0][3], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][3], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][3], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][3], 'f', 2));
|
||||
return QVariant(text);
|
||||
}
|
||||
|
||||
QVariant PropertyMatrixItem::value(const App::Property* prop) const
|
||||
{
|
||||
assert(prop && prop->getTypeId().isDerivedFrom(App::PropertyMatrix::getClassTypeId()));
|
||||
|
||||
const Base::Matrix4D& value = static_cast<const App::PropertyMatrix*>(prop)->getValue();
|
||||
return QVariant::fromValue<Base::Matrix4D>(value);
|
||||
}
|
||||
|
||||
QVariant PropertyMatrixItem::toolTip(const App::Property* prop) const
|
||||
{
|
||||
assert(prop && prop->getTypeId().isDerivedFrom(App::PropertyMatrix::getClassTypeId()));
|
||||
|
||||
const Base::Matrix4D& value = static_cast<const App::PropertyMatrix*>(prop)->getValue();
|
||||
return QVariant(QString::fromStdString(value.analyse()));
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setValue(const QVariant& value)
|
||||
{
|
||||
if (!value.canConvert<Base::Matrix4D>())
|
||||
return;
|
||||
const Base::Matrix4D& val = value.value<Base::Matrix4D>();
|
||||
const int decimals=16;
|
||||
QString data = QString::fromAscii("FreeCAD.Matrix(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16)")
|
||||
.arg(val[0][0],0, 'f', decimals)
|
||||
.arg(val[0][1],0, 'f', decimals)
|
||||
.arg(val[0][2],0, 'f', decimals)
|
||||
.arg(val[0][3],0, 'f', decimals)
|
||||
.arg(val[1][0],0, 'f', decimals)
|
||||
.arg(val[1][1],0, 'f', decimals)
|
||||
.arg(val[1][2],0, 'f', decimals)
|
||||
.arg(val[1][3],0, 'f', decimals)
|
||||
.arg(val[2][0],0, 'f', decimals)
|
||||
.arg(val[2][1],0, 'f', decimals)
|
||||
.arg(val[2][2],0, 'f', decimals)
|
||||
.arg(val[2][3],0, 'f', decimals)
|
||||
.arg(val[3][0],0, 'f', decimals)
|
||||
.arg(val[3][1],0, 'f', decimals)
|
||||
.arg(val[3][2],0, 'f', decimals)
|
||||
.arg(val[3][3],0, 'f', decimals);
|
||||
setPropertyValue(data);
|
||||
}
|
||||
|
||||
QWidget* PropertyMatrixItem::createEditor(QWidget* parent, const QObject* /*receiver*/, const char* /*method*/) const
|
||||
{
|
||||
QLineEdit *le = new QLineEdit(parent);
|
||||
le->setFrame(false);
|
||||
le->setReadOnly(true);
|
||||
return le;
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setEditorData(QWidget *editor, const QVariant& data) const
|
||||
{
|
||||
QLineEdit* le = qobject_cast<QLineEdit*>(editor);
|
||||
const Base::Matrix4D& value = data.value<Base::Matrix4D>();
|
||||
QString text = QString::fromAscii("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
|
||||
.arg(QLocale::system().toString(value[0][0], 'f', 2)) //(unsigned short usNdx)
|
||||
.arg(QLocale::system().toString(value[0][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[0][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[0][3], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[1][3], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][3], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][1], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][2], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[3][3], 'f', 2));
|
||||
le->setText(text);
|
||||
}
|
||||
|
||||
QVariant PropertyMatrixItem::editorData(QWidget *editor) const
|
||||
{
|
||||
QLineEdit *le = qobject_cast<QLineEdit*>(editor);
|
||||
return QVariant(le->text());
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA11() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[0][0];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA11(double A11)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(A11,getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA12() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[0][1];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA12(double A12)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),A12,getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA13() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[0][2];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA13(double A13)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),A13,getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA14() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[0][3];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA14(double A14)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),A14,getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA21() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[1][0];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA21(double A21)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),A21,getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA22() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[1][1];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA22(double A22)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),A22,getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA23() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[1][2];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA23(double A23)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),A23,getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA24() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[1][3];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA24(double A24)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),A24,getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA31() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[2][0];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA31(double A31)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),A31,getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA32() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[2][1];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA32(double A32)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),A32,getA33(),getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA33() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[2][2];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA33(double A33)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),A33,getA34(),getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA34() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[2][3];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA34(double A34)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),A34,getA41(),getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA41() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[3][0];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA41(double A41)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),A41,getA42(),getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA42() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[3][1];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA42(double A42)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),A42,getA43(),getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA43() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[3][2];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA43(double A43)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),A43,getA44() )));
|
||||
}
|
||||
|
||||
double PropertyMatrixItem::getA44() const
|
||||
{
|
||||
return data(1,Qt::EditRole).value<Base::Matrix4D>()[3][3];
|
||||
}
|
||||
|
||||
void PropertyMatrixItem::setA44(double A44)
|
||||
{
|
||||
setData(QVariant::fromValue(Base::Matrix4D(getA11(),getA12(),getA13(),getA14(),getA21(),getA22(),getA23(),getA24(),getA31(),getA32(),getA33(),getA34(),getA41(),getA42(),getA43(),A44 )));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
PlacementEditor::PlacementEditor(const QString& name, QWidget * parent)
|
||||
|
@ -1246,13 +1598,13 @@ QVariant PropertyPlacementItem::toolTip(const App::Property* prop) const
|
|||
QString data = QString::fromAscii("Axis: (%1 %2 %3)\n"
|
||||
"Angle: %4\n"
|
||||
"Move: (%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))
|
||||
.arg(QLocale::system().toString(angle,'f',2))
|
||||
.arg(QLocale::system().toString(pos.x,'f',2))
|
||||
.arg(QLocale::system().toString(pos.y,'f',2))
|
||||
.arg(QLocale::system().toString(pos.z,'f',2));
|
||||
.arg(QLocale::system().toString(dir.x,'f',decimals()))
|
||||
.arg(QLocale::system().toString(dir.y,'f',decimals()))
|
||||
.arg(QLocale::system().toString(dir.z,'f',decimals()))
|
||||
.arg(QLocale::system().toString(angle,'f',decimals()))
|
||||
.arg(QLocale::system().toString(pos.x,'f',decimals()))
|
||||
.arg(QLocale::system().toString(pos.y,'f',decimals()))
|
||||
.arg(QLocale::system().toString(pos.z,'f',decimals()));
|
||||
return QVariant(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <Base/Type.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Base/Matrix.h>
|
||||
#include <Base/Placement.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
|
@ -38,6 +39,7 @@
|
|||
|
||||
Q_DECLARE_METATYPE(Base::Vector3f)
|
||||
Q_DECLARE_METATYPE(Base::Vector3d)
|
||||
Q_DECLARE_METATYPE(Base::Matrix4D)
|
||||
Q_DECLARE_METATYPE(Base::Placement)
|
||||
|
||||
namespace Gui {
|
||||
|
@ -366,6 +368,92 @@ private:
|
|||
PropertyFloatItem* m_z;
|
||||
};
|
||||
|
||||
class GuiExport PropertyMatrixItem: public PropertyItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(double A11 READ getA11 WRITE setA11 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A12 READ getA12 WRITE setA12 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A13 READ getA13 WRITE setA13 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A14 READ getA14 WRITE setA14 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A21 READ getA21 WRITE setA21 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A22 READ getA22 WRITE setA22 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A23 READ getA23 WRITE setA23 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A24 READ getA24 WRITE setA24 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A31 READ getA31 WRITE setA31 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A32 READ getA32 WRITE setA32 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A33 READ getA33 WRITE setA33 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A34 READ getA34 WRITE setA34 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A41 READ getA41 WRITE setA41 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A42 READ getA42 WRITE setA42 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A43 READ getA43 WRITE setA43 DESIGNABLE true USER true)
|
||||
Q_PROPERTY(double A44 READ getA44 WRITE setA44 DESIGNABLE true USER true)
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
virtual QWidget* createEditor(QWidget* parent, const QObject* receiver, const char* method) const;
|
||||
virtual void setEditorData(QWidget *editor, const QVariant& data) const;
|
||||
virtual QVariant editorData(QWidget *editor) const;
|
||||
|
||||
double getA11() const;
|
||||
void setA11(double A11);
|
||||
double getA12() const;
|
||||
void setA12(double A12);
|
||||
double getA13() const;
|
||||
void setA13(double A13);
|
||||
double getA14() const;
|
||||
void setA14(double A14);
|
||||
double getA21() const;
|
||||
void setA21(double A21);
|
||||
double getA22() const;
|
||||
void setA22(double A22);
|
||||
double getA23() const;
|
||||
void setA23(double A23);
|
||||
double getA24() const;
|
||||
void setA24(double A24);
|
||||
double getA31() const;
|
||||
void setA31(double A31);
|
||||
double getA32() const;
|
||||
void setA32(double A32);
|
||||
double getA33() const;
|
||||
void setA33(double A33);
|
||||
double getA34() const;
|
||||
void setA34(double A34);
|
||||
double getA41() const;
|
||||
void setA41(double A41);
|
||||
double getA42() const;
|
||||
void setA42(double A42);
|
||||
double getA43() const;
|
||||
void setA43(double A43);
|
||||
double getA44() const;
|
||||
void setA44(double A44);
|
||||
|
||||
protected:
|
||||
virtual QVariant toString(const QVariant&) const;
|
||||
virtual QVariant value(const App::Property*) const;
|
||||
virtual void setValue(const QVariant&);
|
||||
|
||||
protected:
|
||||
PropertyMatrixItem();
|
||||
virtual QVariant toolTip(const App::Property*) const;
|
||||
|
||||
private:
|
||||
PropertyFloatItem* m_a11;
|
||||
PropertyFloatItem* m_a12;
|
||||
PropertyFloatItem* m_a13;
|
||||
PropertyFloatItem* m_a14;
|
||||
PropertyFloatItem* m_a21;
|
||||
PropertyFloatItem* m_a22;
|
||||
PropertyFloatItem* m_a23;
|
||||
PropertyFloatItem* m_a24;
|
||||
PropertyFloatItem* m_a31;
|
||||
PropertyFloatItem* m_a32;
|
||||
PropertyFloatItem* m_a33;
|
||||
PropertyFloatItem* m_a34;
|
||||
PropertyFloatItem* m_a41;
|
||||
PropertyFloatItem* m_a42;
|
||||
PropertyFloatItem* m_a43;
|
||||
PropertyFloatItem* m_a44;
|
||||
};
|
||||
|
||||
class PlacementEditor : public Gui::LabelButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -70,20 +70,15 @@ class _CommandRoof:
|
|||
FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+","+str(idx)+")")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
elif obj.isDerivedFrom("Part::Feature"):
|
||||
if len(obj.Shape.Faces) == 1:
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Roof")))
|
||||
FreeCADGui.doCommand("import Arch")
|
||||
FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+",1)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
elif obj.isDerivedFrom("Part::Feature"):
|
||||
if len(obj.Shape.Faces) == 1:
|
||||
return
|
||||
if obj.isDerivedFrom("Part::Feature"):
|
||||
if obj.Shape.Wires:
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Roof")))
|
||||
FreeCADGui.doCommand("import Arch")
|
||||
FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+",1)")
|
||||
FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+")")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(str(translate("Arch","Unable to create a roof")))
|
||||
else:
|
||||
|
@ -110,37 +105,42 @@ class _Roof(ArchComponent.Component):
|
|||
import Part, math, DraftGeomUtils
|
||||
pl = obj.Placement
|
||||
|
||||
if obj.Base and obj.Face and obj.Angle:
|
||||
if len(obj.Base.Shape.Faces) >= obj.Face:
|
||||
f = obj.Base.Shape.Faces[obj.Face-1]
|
||||
if len(f.Wires) == 1:
|
||||
if f.Wires[0].isClosed():
|
||||
c = round(math.tan(math.radians(obj.Angle)),Draft.precision())
|
||||
norm = f.normalAt(0,0)
|
||||
d = f.BoundBox.DiagonalLength
|
||||
edges = DraftGeomUtils.sortEdges(f.Edges)
|
||||
l = len(edges)
|
||||
edges.append(edges[0])
|
||||
shps = []
|
||||
for i in range(l):
|
||||
v = DraftGeomUtils.vec(DraftGeomUtils.angleBisection(edges[i],edges[i+1]))
|
||||
v.normalize()
|
||||
bis = v.getAngle(DraftGeomUtils.vec(edges[i]))
|
||||
delta = 1/math.cos(bis)
|
||||
v.multiply(delta)
|
||||
n = (FreeCAD.Vector(norm)).multiply(c)
|
||||
dv = v.add(n)
|
||||
dv.normalize()
|
||||
dv.scale(d,d,d)
|
||||
shps.append(f.extrude(dv))
|
||||
c = shps.pop()
|
||||
for s in shps:
|
||||
c = c.common(s)
|
||||
c = c.removeSplitter()
|
||||
if not c.isNull():
|
||||
obj.Shape = c
|
||||
if not DraftGeomUtils.isNull(pl):
|
||||
obj.Placement = pl
|
||||
if obj.Base and obj.Angle:
|
||||
w = None
|
||||
if obj.Base.isDerivedFrom("Part::Feature"):
|
||||
if (obj.Base.Shape.Faces and obj.Face):
|
||||
w = obj.Base.Shape.Faces[obj.Face-1].Wires[0]
|
||||
elif obj.Base.Shape.Wires:
|
||||
w = obj.Base.Shape.Wires[0]
|
||||
if w:
|
||||
if w.isClosed():
|
||||
f = Part.Face(w)
|
||||
norm = f.normalAt(0,0)
|
||||
c = round(math.tan(math.radians(obj.Angle)),Draft.precision())
|
||||
d = f.BoundBox.DiagonalLength
|
||||
edges = DraftGeomUtils.sortEdges(f.Edges)
|
||||
l = len(edges)
|
||||
edges.append(edges[0])
|
||||
shps = []
|
||||
for i in range(l):
|
||||
v = DraftGeomUtils.vec(DraftGeomUtils.angleBisection(edges[i],edges[i+1]))
|
||||
v.normalize()
|
||||
bis = v.getAngle(DraftGeomUtils.vec(edges[i]))
|
||||
delta = 1/math.cos(bis)
|
||||
v.multiply(delta)
|
||||
n = (FreeCAD.Vector(norm)).multiply(c)
|
||||
dv = v.add(n)
|
||||
dv.normalize()
|
||||
dv.scale(d,d,d)
|
||||
shps.append(f.extrude(dv))
|
||||
c = shps.pop()
|
||||
for s in shps:
|
||||
c = c.common(s)
|
||||
c = c.removeSplitter()
|
||||
if not c.isNull():
|
||||
obj.Shape = c
|
||||
if not DraftGeomUtils.isNull(pl):
|
||||
obj.Placement = pl
|
||||
|
||||
class _ViewProviderRoof(ArchComponent.ViewProviderComponent):
|
||||
"A View Provider for the Roof object"
|
||||
|
|
|
@ -30,7 +30,7 @@ __title__="FreeCAD Structure"
|
|||
__author__ = "Yorik van Havre"
|
||||
__url__ = "http://free-cad.sourceforge.net"
|
||||
|
||||
def makeStructure(baseobj=None,length=None,width=None,height=None,name=str(translate("Arch","Structure"))):
|
||||
def makeStructure(baseobj=None,length=1,width=1,height=1,name=str(translate("Arch","Structure"))):
|
||||
'''makeStructure([obj],[length],[width],[heigth],[swap]): creates a
|
||||
structure element based on the given profile object and the given
|
||||
extrusion height. If no base object is given, you can also specify
|
||||
|
@ -38,16 +38,12 @@ def makeStructure(baseobj=None,length=None,width=None,height=None,name=str(trans
|
|||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
_Structure(obj)
|
||||
_ViewProviderStructure(obj.ViewObject)
|
||||
if baseobj: obj.Base = baseobj
|
||||
if length: obj.Length = length
|
||||
if width: obj.Width = width
|
||||
if height: obj.Height = height
|
||||
if obj.Base:
|
||||
if baseobj:
|
||||
obj.Base = baseobj
|
||||
obj.Base.ViewObject.hide()
|
||||
else:
|
||||
if (not obj.Width) and (not obj.Length):
|
||||
obj.Width = 1
|
||||
obj.Height = 1
|
||||
obj.Width = width
|
||||
obj.Height = height
|
||||
obj.Length = length
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
c = p.GetUnsigned("StructureColor")
|
||||
r = float((c>>24)&0xFF)/255.0
|
||||
|
@ -116,43 +112,45 @@ class _Structure(ArchComponent.Component):
|
|||
|
||||
def createGeometry(self,obj):
|
||||
import Part, DraftGeomUtils
|
||||
|
||||
# getting default values
|
||||
height = normal = None
|
||||
if obj.Length:
|
||||
length = obj.Length
|
||||
else:
|
||||
length = 1
|
||||
width = 1
|
||||
height = width = length = 1
|
||||
if hasattr(obj,"Length"):
|
||||
if obj.Length:
|
||||
length = obj.Length
|
||||
if hasattr(obj,"Width"):
|
||||
if obj.Width:
|
||||
width = obj.Width
|
||||
if obj.Height:
|
||||
height = obj.Height
|
||||
else:
|
||||
for p in obj.InList:
|
||||
if Draft.getType(p) == "Floor":
|
||||
height = p.Height
|
||||
if not height: height = 1
|
||||
if obj.Normal == Vector(0,0,0):
|
||||
normal = Vector(0,0,1)
|
||||
else:
|
||||
normal = Vector(obj.Normal)
|
||||
if hasattr(obj,"Height"):
|
||||
if obj.Height:
|
||||
height = obj.Height
|
||||
|
||||
# creating shape
|
||||
# creating base shape
|
||||
pl = obj.Placement
|
||||
norm = normal.multiply(height)
|
||||
base = None
|
||||
if obj.Base:
|
||||
if obj.Base.isDerivedFrom("Part::Feature"):
|
||||
if obj.Normal == Vector(0,0,0):
|
||||
p = FreeCAD.Placement(obj.Base.Placement)
|
||||
normal = p.Rotation.multVec(Vector(0,0,1))
|
||||
else:
|
||||
normal = Vector(obj.Normal)
|
||||
normal = normal.multiply(height)
|
||||
base = obj.Base.Shape.copy()
|
||||
if base.Solids:
|
||||
pass
|
||||
elif base.Faces:
|
||||
base = base.extrude(normal)
|
||||
elif (len(base.Wires) == 1) and base.Wires[0].isClosed():
|
||||
base = Part.Face(base.Wires[0])
|
||||
base = base.extrude(normal)
|
||||
elif (len(base.Wires) == 1):
|
||||
if base.Wires[0].isClosed():
|
||||
base = Part.Face(base.Wires[0])
|
||||
base = base.extrude(normal)
|
||||
else:
|
||||
if obj.Normal == Vector(0,0,0):
|
||||
normal = Vector(0,0,1)
|
||||
else:
|
||||
normal = Vector(obj.Normal)
|
||||
normal = normal.multiply(height)
|
||||
l2 = length/2 or 0.5
|
||||
w2 = width/2 or 0.5
|
||||
v1 = Vector(-l2,-w2,0)
|
||||
|
@ -162,17 +160,20 @@ class _Structure(ArchComponent.Component):
|
|||
base = Part.makePolygon([v1,v2,v3,v4,v1])
|
||||
base = Part.Face(base)
|
||||
base = base.extrude(normal)
|
||||
for app in obj.Additions:
|
||||
if hasattr(app,"Shape"):
|
||||
if not app.Shape.isNull():
|
||||
base = base.fuse(app.Shape)
|
||||
app.ViewObject.hide() # to be removed
|
||||
for hole in obj.Subtractions:
|
||||
if hasattr(hole,"Shape"):
|
||||
if not hole.Shape.isNull():
|
||||
base = base.cut(hole.Shape)
|
||||
hole.ViewObject.hide() # to be removed
|
||||
|
||||
if base:
|
||||
# applying adds and subs
|
||||
if not base.isNull():
|
||||
for app in obj.Additions:
|
||||
if hasattr(app,"Shape"):
|
||||
if not app.Shape.isNull():
|
||||
base = base.fuse(app.Shape)
|
||||
app.ViewObject.hide() # to be removed
|
||||
for hole in obj.Subtractions:
|
||||
if hasattr(hole,"Shape"):
|
||||
if not hole.Shape.isNull():
|
||||
base = base.cut(hole.Shape)
|
||||
hole.ViewObject.hide() # to be removed
|
||||
pts = self.getAxisPoints(obj)
|
||||
if pts:
|
||||
fsh = []
|
||||
|
@ -182,10 +183,12 @@ class _Structure(ArchComponent.Component):
|
|||
fsh.append(sh)
|
||||
obj.Shape = Part.makeCompound(fsh)
|
||||
else:
|
||||
if not base.isNull():
|
||||
base = base.removeSplitter()
|
||||
obj.Shape = base
|
||||
if not DraftGeomUtils.isNull(pl): obj.Placement = pl
|
||||
if base:
|
||||
if not base.isNull():
|
||||
base = base.removeSplitter()
|
||||
obj.Shape = base
|
||||
if not DraftGeomUtils.isNull(pl):
|
||||
obj.Placement = pl
|
||||
|
||||
class _ViewProviderStructure(ArchComponent.ViewProviderComponent):
|
||||
"A View Provider for the Structure object"
|
||||
|
|
|
@ -271,7 +271,7 @@ class _Wall(ArchComponent.Component):
|
|||
if prop in ["Base","Height","Width","Align","Additions","Subtractions"]:
|
||||
self.createGeometry(obj)
|
||||
|
||||
def getSubVolume(self,base,width,delta=None):
|
||||
def getSubVolume(self,base,width,plac=None):
|
||||
"returns a subvolume from a base object"
|
||||
import Part
|
||||
max_length = 0
|
||||
|
@ -288,8 +288,8 @@ class _Wall(ArchComponent.Component):
|
|||
v2 = DraftVecUtils.neg(v1)
|
||||
v2 = DraftVecUtils.scale(v1,-2)
|
||||
f = f.extrude(v2)
|
||||
if delta:
|
||||
f.translate(delta)
|
||||
if plac:
|
||||
f.Placement = plac
|
||||
return f
|
||||
return None
|
||||
|
||||
|
@ -384,12 +384,22 @@ class _Wall(ArchComponent.Component):
|
|||
|
||||
if base:
|
||||
for app in obj.Additions:
|
||||
if hasattr(app,"Shape"):
|
||||
if Draft.getType(app) == "Window":
|
||||
# window
|
||||
if app.Base and obj.Width:
|
||||
f = self.getSubVolume(app.Base,width)
|
||||
if f:
|
||||
base = base.cut(f)
|
||||
elif Draft.isClone(app,"Window"):
|
||||
if app.Objects[0].Base and width:
|
||||
f = self.getSubVolume(app.Objects[0].Base,width,app.Placement)
|
||||
if f:
|
||||
base = base.cut(f)
|
||||
elif app.isDerivedFrom("Part::Feature"):
|
||||
if app.Shape:
|
||||
if not app.Shape.isNull():
|
||||
base = base.fuse(app.Shape)
|
||||
app.ViewObject.hide() #to be removed
|
||||
|
||||
for hole in obj.Subtractions:
|
||||
if Draft.getType(hole) == "Window":
|
||||
# window
|
||||
|
@ -399,10 +409,10 @@ class _Wall(ArchComponent.Component):
|
|||
base = base.cut(f)
|
||||
elif Draft.isClone(hole,"Window"):
|
||||
if hole.Objects[0].Base and width:
|
||||
f = self.getSubVolume(hole.Objects[0].Base,width,hole.Placement.Base)
|
||||
f = self.getSubVolume(hole.Objects[0].Base,width,hole.Placement)
|
||||
if f:
|
||||
base = base.cut(f)
|
||||
elif hasattr(hole,"Shape"):
|
||||
elif hole.isDerivedFrom("Part::Feature"):
|
||||
if hole.Shape:
|
||||
if not hole.Shape.isNull():
|
||||
base = base.cut(hole.Shape)
|
||||
|
|
|
@ -107,9 +107,9 @@ class _CommandWindow:
|
|||
s = obj.Support
|
||||
w = FreeCAD.ActiveDocument.Objects[-1] # last created object
|
||||
FreeCADGui.doCommand("Arch.removeComponents(FreeCAD.ActiveDocument."+w.Name+",host=FreeCAD.ActiveDocument."+s.Name+")")
|
||||
elif Draft.isClone(w,"Window"):
|
||||
if w.Objects[0].Inlist:
|
||||
FreeCADGui.doCommand("Arch.removeComponents(FreeCAD.ActiveDocument."+w.Name+",host=FreeCAD.ActiveDocument."+w.Objects[0].Inlist[0].Name+")")
|
||||
elif Draft.isClone(obj,"Window"):
|
||||
if obj.Objects[0].Inlist:
|
||||
FreeCADGui.doCommand("Arch.removeComponents(FreeCAD.ActiveDocument."+obj.Name+",host=FreeCAD.ActiveDocument."+obj.Objects[0].Inlist[0].Name+")")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
class _Window(ArchComponent.Component):
|
||||
|
|
|
@ -183,7 +183,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "Std_DlgMacroRecord" << "Std_MacroStopRecord"
|
||||
<< "Std_DlgMacroExecute" << "Std_DlgMacroExecuteDirect"
|
||||
<< "Separator" << "Std_ViewScreenShot" << "Std_SceneInspector"
|
||||
<< "Std_ProjectUtil" << "Std_DemoMode" << "Separator" << "Std_DlgCustomize";
|
||||
<< "Std_ExportGraphviz" << "Std_ProjectUtil"
|
||||
<< "Std_DemoMode" << "Separator" << "Std_DlgCustomize";
|
||||
|
||||
// Mesh ****************************************************************************************************
|
||||
Gui::MenuItem* mesh = new Gui::MenuItem( menuBar );
|
||||
|
|
|
@ -137,7 +137,7 @@ class DraftLineEdit(QtGui.QLineEdit):
|
|||
self.emit(QtCore.SIGNAL("up()"))
|
||||
elif event.key() == QtCore.Qt.Key_Down:
|
||||
self.emit(QtCore.SIGNAL("down()"))
|
||||
elif (event.key() == QtCore.Qt.Key_Z) and QtCore.Qt.ControlModifier:
|
||||
elif (event.key() == QtCore.Qt.Key_Z) and (int(event.modifiers()) == QtCore.Qt.ControlModifier):
|
||||
self.emit(QtCore.SIGNAL("undo()"))
|
||||
else:
|
||||
QtGui.QLineEdit.keyPressEvent(self, event)
|
||||
|
@ -184,6 +184,7 @@ class DraftToolBar:
|
|||
self.crossedViews = []
|
||||
self.isTaskOn = False
|
||||
self.fillmode = Draft.getParam("fillmode")
|
||||
self.mask = None
|
||||
|
||||
if self.taskmode:
|
||||
# add only a dummy widget, since widgets are created on demand
|
||||
|
@ -593,6 +594,7 @@ class DraftToolBar:
|
|||
self.cancel = None
|
||||
self.sourceCmd = None
|
||||
self.pointcallback = None
|
||||
self.mask = None
|
||||
if self.taskmode:
|
||||
self.isTaskOn = False
|
||||
self.baseWidget = QtGui.QWidget()
|
||||
|
@ -695,7 +697,7 @@ class DraftToolBar:
|
|||
if not self.taskmode:
|
||||
self.labelx.setText(translate("draft", "Pick Object"))
|
||||
self.labelx.show()
|
||||
self.makeDumbTask()
|
||||
self.makeDumbTask()
|
||||
|
||||
def editUi(self):
|
||||
self.taskUi(translate("draft", "Edit"))
|
||||
|
@ -767,7 +769,7 @@ class DraftToolBar:
|
|||
def __init__(self):
|
||||
pass
|
||||
def getStandardButtons(self):
|
||||
return 0
|
||||
return int(QtGui.QDialogButtonBox.Cancel)
|
||||
panel = TaskPanel()
|
||||
FreeCADGui.Control.showDialog(panel)
|
||||
|
||||
|
@ -882,15 +884,16 @@ class DraftToolBar:
|
|||
last = self.sourceCmd.node[0]
|
||||
else:
|
||||
last = self.sourceCmd.node[-1]
|
||||
numx = last.x + numx
|
||||
numy = last.y + numy
|
||||
numz = last.z + numz
|
||||
print "last:",last
|
||||
v = FreeCAD.Vector(numx,numy,numz)
|
||||
print "orig:",v
|
||||
if FreeCAD.DraftWorkingPlane:
|
||||
v = FreeCAD.Vector(numx,numy,numz)
|
||||
v = FreeCAD.DraftWorkingPlane.getGlobalCoords(v)
|
||||
numx = v.x
|
||||
numy = v.y
|
||||
numz = v.z
|
||||
v = FreeCAD.DraftWorkingPlane.getGlobalRot(v)
|
||||
print "rotated:",v
|
||||
numx = last.x + v.x
|
||||
numy = last.y + v.y
|
||||
numz = last.z + v.z
|
||||
self.sourceCmd.numericInput(numx,numy,numz)
|
||||
|
||||
def finish(self):
|
||||
|
@ -963,6 +966,12 @@ class DraftToolBar:
|
|||
self.toggleradius(1)
|
||||
elif txt.endsWith("]"):
|
||||
self.toggleradius(-1)
|
||||
elif txt.endsWith("x"):
|
||||
self.constrain("x")
|
||||
elif txt.endsWith("y"):
|
||||
self.constrain("y")
|
||||
elif txt.endsWith("z"):
|
||||
self.constrain("z")
|
||||
elif txt.endsWith("c"):
|
||||
if self.closeButton.isVisible():
|
||||
self.closeLine()
|
||||
|
@ -1025,29 +1034,38 @@ class DraftToolBar:
|
|||
dp = point
|
||||
if self.relativeMode and (last != None):
|
||||
if plane:
|
||||
dp = plane.getLocalCoords(FreeCAD.Vector(point.x-last.x, point.y-last.y, point.z-last.z))
|
||||
dp = plane.getLocalRot(FreeCAD.Vector(point.x-last.x, point.y-last.y, point.z-last.z))
|
||||
else:
|
||||
dp = FreeCAD.Vector(point.x-last.x, point.y-last.y, point.z-last.z)
|
||||
|
||||
# set widgets
|
||||
self.xValue.setText("%.2f" % dp.x)
|
||||
self.yValue.setText("%.2f" % dp.y)
|
||||
self.zValue.setText("%.2f" % dp.z)
|
||||
if self.mask in ['y','z']:
|
||||
self.xValue.setText("0.00")
|
||||
else:
|
||||
self.xValue.setText("%.2f" % dp.x)
|
||||
if self.mask in ['x','z']:
|
||||
self.yValue.setText("0.00")
|
||||
else:
|
||||
self.yValue.setText("%.2f" % dp.y)
|
||||
if self.mask in ['x','y']:
|
||||
self.zValue.setText("0.00")
|
||||
else:
|
||||
self.zValue.setText("%.2f" % dp.z)
|
||||
|
||||
# set masks
|
||||
if mask == "x":
|
||||
if (mask == "x") or (self.mask == "x"):
|
||||
self.xValue.setEnabled(True)
|
||||
self.yValue.setEnabled(False)
|
||||
self.zValue.setEnabled(False)
|
||||
self.xValue.setFocus()
|
||||
self.xValue.selectAll()
|
||||
elif mask == "y":
|
||||
elif (mask == "y") or (self.mask == "y"):
|
||||
self.xValue.setEnabled(False)
|
||||
self.yValue.setEnabled(True)
|
||||
self.zValue.setEnabled(False)
|
||||
self.yValue.setFocus()
|
||||
self.yValue.selectAll()
|
||||
elif mask == "z":
|
||||
elif (mask == "z") or (self.mask == "z"):
|
||||
self.xValue.setEnabled(False)
|
||||
self.yValue.setEnabled(False)
|
||||
self.zValue.setEnabled(True)
|
||||
|
@ -1168,6 +1186,16 @@ class DraftToolBar:
|
|||
Draft.setParam("snapRange",par+val)
|
||||
FreeCADGui.Snapper.showradius()
|
||||
|
||||
def constrain(self,val):
|
||||
if self.mask == val:
|
||||
self.mask = None
|
||||
if hasattr(FreeCADGui,"Snapper"):
|
||||
FreeCADGui.Snapper.mask = None
|
||||
else:
|
||||
self.mask = val
|
||||
if hasattr(FreeCADGui,"Snapper"):
|
||||
FreeCADGui.Snapper.mask = val
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# TaskView operations
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
|
@ -60,6 +60,7 @@ class Snapper:
|
|||
self.constraintAxis = None
|
||||
self.basepoint = None
|
||||
self.affinity = None
|
||||
self.mask = None
|
||||
self.cursorMode = None
|
||||
if Draft.getParam("maxSnap"):
|
||||
self.maxEdges = Draft.getParam("maxSnapEdges")
|
||||
|
@ -126,7 +127,7 @@ class Snapper:
|
|||
|
||||
def cstr(point):
|
||||
"constrains if needed"
|
||||
if constrain:
|
||||
if constrain or self.mask:
|
||||
fpt = self.constrain(point,lastpoint)
|
||||
else:
|
||||
self.unconstrain()
|
||||
|
@ -211,7 +212,9 @@ class Snapper:
|
|||
else:
|
||||
|
||||
# first stick to the snapped object
|
||||
point = self.snapToVertex(self.snapInfo)[0]
|
||||
s = self.snapToVertex(self.snapInfo)
|
||||
if s:
|
||||
point = s[0]
|
||||
|
||||
# active snapping
|
||||
comp = self.snapInfo['Component']
|
||||
|
@ -278,7 +281,7 @@ class Snapper:
|
|||
self.lastObj[1] = obj.Name
|
||||
|
||||
if not snaps:
|
||||
return point
|
||||
return cstr(point)
|
||||
|
||||
# calculating the nearest snap point
|
||||
shortest = 1000000000000000000
|
||||
|
@ -395,7 +398,7 @@ class Snapper:
|
|||
|
||||
def snapToPolar(self,point,last):
|
||||
"snaps to polar lines from the given point"
|
||||
if self.isEnabled('ortho'):
|
||||
if self.isEnabled('ortho') and (not self.mask):
|
||||
if last:
|
||||
vecs = []
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
|
@ -535,9 +538,11 @@ class Snapper:
|
|||
"returns a perpendicular X extension snap location"
|
||||
if self.isEnabled("extension") and self.isEnabled("perpendicular"):
|
||||
if last and self.extLine:
|
||||
tmpEdge = Part.Line(self.extLine.p1(),self.extLine.p2()).toShape()
|
||||
np = self.getPerpendicular(tmpEdge,last)
|
||||
return [np,'perpendicular',np]
|
||||
if self.extLine.p1() != self.extLine.p2():
|
||||
tmpEdge = Part.Line(self.extLine.p1(),self.extLine.p2()).toShape()
|
||||
np = self.getPerpendicular(tmpEdge,last)
|
||||
return [np,'perpendicular',np]
|
||||
return None
|
||||
|
||||
def snapToElines(self,e1,e2):
|
||||
"returns a snap location at the infinite intersection of the given edges"
|
||||
|
@ -668,6 +673,7 @@ class Snapper:
|
|||
self.setCursor()
|
||||
if Draft.getParam("hideSnapBar"):
|
||||
self.toolbar.hide()
|
||||
self.mask = None
|
||||
|
||||
def constrain(self,point,basepoint=None,axis=None):
|
||||
'''constrain(point,basepoint=None,axis=None: Returns a
|
||||
|
@ -696,6 +702,8 @@ class Snapper:
|
|||
delta = point.sub(self.basepoint)
|
||||
|
||||
# setting constraint axis
|
||||
if self.mask:
|
||||
self.affinity = self.mask
|
||||
if not self.affinity:
|
||||
self.affinity = FreeCAD.DraftWorkingPlane.getClosestAxis(delta)
|
||||
if isinstance(axis,FreeCAD.Vector):
|
||||
|
@ -920,6 +928,13 @@ class Snapper:
|
|||
if FreeCADGui.ActiveDocument:
|
||||
self.setTrackers()
|
||||
|
||||
def setGrid(self):
|
||||
"sets the grid, if visible"
|
||||
if self.grid and (not self.forceGridOff):
|
||||
if self.grid.Visible:
|
||||
self.grid.set()
|
||||
self.setTrackers()
|
||||
|
||||
def setTrackers(self):
|
||||
v = Draft.get3DView()
|
||||
if v in self.trackers[0]:
|
||||
|
@ -941,7 +956,7 @@ class Snapper:
|
|||
self.trackers[2].append(self.tracker)
|
||||
self.trackers[3].append(self.extLine)
|
||||
self.trackers[4].append(self.radiusTracker)
|
||||
if not self.forceGridOff:
|
||||
if self.grid and (not self.forceGridOff):
|
||||
self.grid.set()
|
||||
|
||||
if not hasattr(FreeCADGui,"Snapper"):
|
||||
|
|
|
@ -111,15 +111,15 @@ def selectObject(arg):
|
|||
if (arg["Key"] == "ESCAPE"):
|
||||
FreeCAD.activeDraftCommand.finish()
|
||||
# TODO : this part raises a coin3D warning about scene traversal, to be fixed.
|
||||
if (arg["Type"] == "SoMouseButtonEvent"):
|
||||
if (arg["State"] == "DOWN") and (arg["Button"] == "BUTTON1"):
|
||||
cursor = arg["Position"]
|
||||
snapped = Draft.get3DView().getObjectInfo((cursor[0],cursor[1]))
|
||||
if snapped:
|
||||
obj = FreeCAD.ActiveDocument.getObject(snapped['Object'])
|
||||
FreeCADGui.Selection.addSelection(obj)
|
||||
FreeCAD.activeDraftCommand.component=snapped['Component']
|
||||
FreeCAD.activeDraftCommand.proceed()
|
||||
elif (arg["Type"] == "SoMouseButtonEvent"):
|
||||
if (arg["State"] == "DOWN") and (arg["Button"] == "BUTTON1"):
|
||||
cursor = arg["Position"]
|
||||
snapped = Draft.get3DView().getObjectInfo((cursor[0],cursor[1]))
|
||||
if snapped:
|
||||
obj = FreeCAD.ActiveDocument.getObject(snapped['Object'])
|
||||
FreeCADGui.Selection.addSelection(obj)
|
||||
FreeCAD.activeDraftCommand.component=snapped['Component']
|
||||
FreeCAD.activeDraftCommand.proceed()
|
||||
|
||||
def getPoint(target,args,mobile=False,sym=False,workingplane=True):
|
||||
'''
|
||||
|
@ -1726,12 +1726,6 @@ class Modifier(DraftTool):
|
|||
def __init__(self):
|
||||
DraftTool.__init__(self)
|
||||
|
||||
def IsActive(self):
|
||||
if Draft.getSelection():
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
class Move(Modifier):
|
||||
"The Draft_Move FreeCAD command definition"
|
||||
|
||||
|
@ -1771,9 +1765,11 @@ class Move(Modifier):
|
|||
self.ui.cross(True)
|
||||
|
||||
def finish(self,closed=False,cont=False):
|
||||
if self.ui:
|
||||
if self.ghost:
|
||||
self.ghost.finalize()
|
||||
if self.linetrack:
|
||||
self.linetrack.finalize()
|
||||
if self.constraintrack:
|
||||
self.constraintrack.finalize()
|
||||
Modifier.finish(self)
|
||||
if cont and self.ui:
|
||||
|
@ -1941,11 +1937,15 @@ class Rotate(Modifier):
|
|||
def finish(self,closed=False,cont=False):
|
||||
"finishes the arc"
|
||||
Modifier.finish(self)
|
||||
if self.ui:
|
||||
if self.linetrack:
|
||||
self.linetrack.finalize()
|
||||
if self.constraintrack:
|
||||
self.constraintrack.finalize()
|
||||
if self.arctrack:
|
||||
self.arctrack.finalize()
|
||||
if self.ghost:
|
||||
self.ghost.finalize()
|
||||
if self.doc:
|
||||
self.doc.recompute()
|
||||
if cont and self.ui:
|
||||
if self.ui.continueMode:
|
||||
|
@ -2248,10 +2248,13 @@ class Offset(Modifier):
|
|||
self.finish()
|
||||
|
||||
def finish(self,closed=False):
|
||||
if self.ui and self.running:
|
||||
self.linetrack.finalize()
|
||||
self.constraintrack.finalize()
|
||||
self.ghost.finalize()
|
||||
if self.running:
|
||||
if self.linetrack:
|
||||
self.linetrack.finalize()
|
||||
if self.constraintrack:
|
||||
self.constraintrack.finalize()
|
||||
if self.ghost:
|
||||
self.ghost.finalize()
|
||||
Modifier.finish(self)
|
||||
|
||||
def numericRadius(self,rad):
|
||||
|
@ -2924,8 +2927,10 @@ class Trimex(Modifier):
|
|||
Modifier.finish(self)
|
||||
self.force = None
|
||||
if self.ui:
|
||||
self.linetrack.finalize()
|
||||
self.constraintrack.finalize()
|
||||
if self.linetrack:
|
||||
self.linetrack.finalize()
|
||||
if self.constraintrack:
|
||||
self.constraintrack.finalize()
|
||||
if self.ghost:
|
||||
for g in self.ghost:
|
||||
g.finalize()
|
||||
|
@ -2980,9 +2985,11 @@ class Scale(Modifier):
|
|||
|
||||
def finish(self,closed=False,cont=False):
|
||||
Modifier.finish(self)
|
||||
if self.ui:
|
||||
if self.ghost:
|
||||
self.ghost.finalize()
|
||||
if self.linetrack:
|
||||
self.linetrack.finalize()
|
||||
if self.constraintrack:
|
||||
self.constraintrack.finalize()
|
||||
if cont and self.ui:
|
||||
if self.ui.continueMode:
|
||||
|
|
|
@ -468,6 +468,8 @@ class PlaneTracker(Tracker):
|
|||
p1 = Draft.get3DView().getPoint((100,100))
|
||||
p2 = Draft.get3DView().getPoint((110,100))
|
||||
bl = (p2.sub(p1)).Length * (Draft.getParam("snapRange")/2)
|
||||
pick = coin.SoPickStyle()
|
||||
pick.style.setValue(coin.SoPickStyle.UNPICKABLE)
|
||||
self.trans = coin.SoTransform()
|
||||
self.trans.translation.setValue([0,0,0])
|
||||
m1 = coin.SoMaterial()
|
||||
|
@ -486,6 +488,7 @@ class PlaneTracker(Tracker):
|
|||
l = coin.SoLineSet()
|
||||
l.numVertices.setValues([3,3,3])
|
||||
s = coin.SoSeparator()
|
||||
s.addChild(pick)
|
||||
s.addChild(self.trans)
|
||||
s.addChild(m1)
|
||||
s.addChild(c1)
|
||||
|
@ -542,6 +545,9 @@ class gridTracker(Tracker):
|
|||
self.mainlines = Draft.getParam("gridEvery")
|
||||
self.numlines = 100
|
||||
col = [0.2,0.2,0.3]
|
||||
|
||||
pick = coin.SoPickStyle()
|
||||
pick.style.setValue(coin.SoPickStyle.UNPICKABLE)
|
||||
|
||||
self.trans = coin.SoTransform()
|
||||
self.trans.translation.setValue([0,0,0])
|
||||
|
@ -595,6 +601,7 @@ class gridTracker(Tracker):
|
|||
lines3 = coin.SoLineSet()
|
||||
lines3.numVertices.setValues(aidx)
|
||||
s = coin.SoSeparator()
|
||||
s.addChild(pick)
|
||||
s.addChild(self.trans)
|
||||
s.addChild(mat1)
|
||||
s.addChild(self.coords1)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <App/Application.h>
|
||||
#include <boost/regex.hpp>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
#include "FeaturePage.h"
|
||||
#include "FeatureView.h"
|
||||
|
@ -86,10 +87,11 @@ void FeaturePage::onChanged(const App::Property* prop)
|
|||
|
||||
App::DocumentObjectExecReturn *FeaturePage::execute(void)
|
||||
{
|
||||
if(Template.getValue() == "")
|
||||
std::string temp = Template.getValue();
|
||||
if (temp.empty())
|
||||
return App::DocumentObject::StdReturn;
|
||||
|
||||
Base::FileInfo fi(Template.getValue());
|
||||
Base::FileInfo fi(temp);
|
||||
if (!fi.isReadable()) {
|
||||
// if there is a old absolute template file set use a redirect
|
||||
fi.setFile(App::Application::getResourceDir() + "Mod/Drawing/Templates/" + fi.fileName());
|
||||
|
@ -186,8 +188,9 @@ std::vector<std::string> FeaturePage::getEditableTextsFromTemplate(void) const {
|
|||
|
||||
std::vector<string> eds;
|
||||
|
||||
if (Template.getValue() != "") {
|
||||
Base::FileInfo tfi(Template.getValue());
|
||||
std::string temp = Template.getValue();
|
||||
if (!temp.empty()) {
|
||||
Base::FileInfo tfi(temp);
|
||||
if (!tfi.isReadable()) {
|
||||
// if there is a old absolute template file set use a redirect
|
||||
tfi.setFile(App::Application::getResourceDir() + "Mod/Drawing/Templates/" + tfi.fileName());
|
||||
|
|
|
@ -82,7 +82,7 @@ FeatureViewPart::FeatureViewPart(void)
|
|||
ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"Shape to view");
|
||||
ADD_PROPERTY_TYPE(ShowHiddenLines ,(false),group,App::Prop_None,"Control the appearance of the dashed hidden lines");
|
||||
ADD_PROPERTY_TYPE(ShowSmoothLines ,(false),group,App::Prop_None,"Control the appearance of the smooth lines");
|
||||
ADD_PROPERTY_TYPE(LineWidth,(0.35),vgroup,App::Prop_None,"The thickness of the resulting lines");
|
||||
ADD_PROPERTY_TYPE(LineWidth,(0.35f),vgroup,App::Prop_None,"The thickness of the resulting lines");
|
||||
}
|
||||
|
||||
FeatureViewPart::~FeatureViewPart()
|
||||
|
|
|
@ -104,7 +104,6 @@
|
|||
#include <Standard_Real.hxx>
|
||||
#include <Standard_ShortReal.hxx>
|
||||
#include <Standard_SStream.hxx>
|
||||
#include <Standard_Static.hxx>
|
||||
#include <Standard_Storable.hxx>
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <Standard_String.hxx>
|
||||
|
|
|
@ -263,7 +263,7 @@ std::string ProjectionAlgos::getDXF(SvgExtractionType type, float scale)
|
|||
<< "ENTITIES" << endl;
|
||||
|
||||
if (!H.IsNull() && (type & WithHidden)) {
|
||||
float width = 0.15f/scale;
|
||||
//float width = 0.15f/scale;
|
||||
BRepMesh::Mesh(H,0.1);
|
||||
result //<< "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -278,7 +278,7 @@ std::string ProjectionAlgos::getDXF(SvgExtractionType type, float scale)
|
|||
//<< "</g>" << endl;
|
||||
}
|
||||
if (!HO.IsNull() && (type & WithHidden)) {
|
||||
float width = 0.15f/scale;
|
||||
//float width = 0.15f/scale;
|
||||
BRepMesh::Mesh(HO,0.1);
|
||||
result //<< "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -293,7 +293,7 @@ std::string ProjectionAlgos::getDXF(SvgExtractionType type, float scale)
|
|||
//<< "</g>" << endl;
|
||||
}
|
||||
if (!VO.IsNull()) {
|
||||
float width = 0.35f/scale;
|
||||
//float width = 0.35f/scale;
|
||||
BRepMesh::Mesh(VO,0.1);
|
||||
result //<< "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -309,8 +309,7 @@ std::string ProjectionAlgos::getDXF(SvgExtractionType type, float scale)
|
|||
//<< "</g>" << endl;
|
||||
}
|
||||
if (!V.IsNull()) {
|
||||
float width = 0.35f/scale;
|
||||
|
||||
//float width = 0.35f/scale;
|
||||
BRepMesh::Mesh(V,0.1);
|
||||
result //<< "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -326,7 +325,7 @@ std::string ProjectionAlgos::getDXF(SvgExtractionType type, float scale)
|
|||
|
||||
}
|
||||
if (!V1.IsNull() && (type & WithSmooth)) {
|
||||
float width = 0.35f/scale;
|
||||
//float width = 0.35f/scale;
|
||||
BRepMesh::Mesh(V1,0.1);
|
||||
result //<< "<g"
|
||||
|
||||
|
@ -342,8 +341,7 @@ std::string ProjectionAlgos::getDXF(SvgExtractionType type, float scale)
|
|||
//<< "</g>" << endl;
|
||||
}
|
||||
if (!H1.IsNull() && (type & WithSmooth) && (type & WithHidden)) {
|
||||
|
||||
float width = 0.15f/scale;
|
||||
//float width = 0.15f/scale;
|
||||
BRepMesh::Mesh(H1,0.1);
|
||||
result //<< "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
|
|
@ -91,5 +91,6 @@ libdir = $(prefix)/Mod/Drawing
|
|||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(libDrawingGui_la_UI) \
|
||||
CMakeLists.txt
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Base/BoundBoxPy.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Drawing/App/FeaturePage.h>
|
||||
#include <Mod/Drawing/App/FeaturePage.h>
|
||||
|
||||
#include <Base/FileInfo.h>
|
||||
#include <iostream>
|
||||
|
@ -301,7 +301,7 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent)
|
|||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
|
||||
std::vector<App::DocumentObject*> pages = doc->getObjectsOfType(Drawing::FeaturePage::getClassTypeId());
|
||||
std::string PageName = pages.front()->getNameInDocument();
|
||||
std::string PageName = pages.front()->getNameInDocument();
|
||||
const char * page = PageName.c_str();
|
||||
|
||||
App::DocumentObject * this_page = doc->getObject(page);
|
||||
|
@ -409,7 +409,7 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent)
|
|||
data[1] = &x_pos;
|
||||
data[2] = &y_pos;
|
||||
data[3] = &horiz;
|
||||
data[4] = |
|
||||
data[4] = |
|
||||
|
||||
|
||||
// Command::doCommand(Command::Doc,"#%d", map1[2][2][1]);
|
||||
|
@ -636,24 +636,24 @@ void TaskOrthoViews::compute()
|
|||
|
||||
void TaskOrthoViews::validate_cbs()
|
||||
{
|
||||
for (int i=0; i < 5; i++)
|
||||
for (int j=0; j < 5; j++)
|
||||
if ((abs(i-2) + abs(j-2)) < 3) //if i,j combination corresponds to valid check box, then proceed with:
|
||||
for (int i=0; i < 5; i++) {
|
||||
for (int j=0; j < 5; j++) {
|
||||
if ((abs(i-2) + abs(j-2)) < 3) { //if i,j combination corresponds to valid check box, then proceed with:
|
||||
|
||||
if (view_count == 0)
|
||||
{
|
||||
c_boxes[i][j]->setEnabled(false);
|
||||
c_boxes[i][j]->setChecked(false);
|
||||
}
|
||||
else if (!c_boxes[i][j]->isChecked()) //only questions boxes 'enableability' if it's not checked
|
||||
if (view_count == 4)
|
||||
else if (!c_boxes[i][j]->isChecked()) { //only questions boxes 'enableability' if it's not checked
|
||||
if (view_count == 4) {
|
||||
c_boxes[i][j]->setEnabled(false); //if there are four checked boxes then all others are disabled
|
||||
else
|
||||
{
|
||||
if ((abs(i-2) + abs(j-2)) == 1) //only true for boxes immediately up/down/left/right of centre
|
||||
}
|
||||
else {
|
||||
if ((abs(i-2) + abs(j-2)) == 1) { //only true for boxes immediately up/down/left/right of centre
|
||||
c_boxes[i][j]->setEnabled(c_boxes[2][2]->isChecked()); //which are enabled if centre box is checked
|
||||
else
|
||||
{
|
||||
}
|
||||
else {
|
||||
int di = ((i-2) < 0) - ((i-2) > 0); //which direction is towards centre?
|
||||
int dj = ((j-2) < 0) - ((j-2) > 0);
|
||||
|
||||
|
@ -668,9 +668,12 @@ void TaskOrthoViews::validate_cbs()
|
|||
c_boxes[i][j]->setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TaskOrthoViews::cb_toggled(bool toggle)
|
||||
{
|
||||
QString name = sender()->objectName().right(2);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Base/PlacementPy.h>
|
||||
#include <App/Application.h>
|
||||
|
@ -498,12 +499,12 @@ static PyObject * minBoundingBox(PyObject *self, PyObject *args)
|
|||
|
||||
//Do a Monte Carlo approach and start from the Principal Axis System
|
||||
//and rotate +/- 60° around each axis in a first iteration
|
||||
double angle_range_min_x=-PI/3.0,angle_range_max_x=PI/3.0,
|
||||
angle_range_min_y=-PI/3.0,angle_range_max_y=PI/3.0,
|
||||
angle_range_min_z=-PI/3.0,angle_range_max_z=PI/3.0;
|
||||
double angle_range_min_x=-M_PI/3.0,angle_range_max_x=M_PI/3.0,
|
||||
angle_range_min_y=-M_PI/3.0,angle_range_max_y=M_PI/3.0,
|
||||
angle_range_min_z=-M_PI/3.0,angle_range_max_z=M_PI/3.0;
|
||||
|
||||
//We rotate until we are 0.1° sure to be in the right position
|
||||
for (step_size = (2.0*PI/it_steps);step_size>(2.0*PI/3600.0);step_size=(2.0*PI/it_steps))
|
||||
for (step_size = (2.0*M_PI/it_steps);step_size>(2.0*M_PI/3600.0);step_size=(2.0*M_PI/it_steps))
|
||||
{
|
||||
for(alpha_x=angle_range_min_x;alpha_x<angle_range_max_x;alpha_x=alpha_x+step_size)
|
||||
{
|
||||
|
@ -744,11 +745,11 @@ static PyObject * import_NASTRAN(PyObject *self, PyObject *args)
|
|||
|
||||
//Do a Monte Carlo approach and start from the Principal Axis System
|
||||
//and rotate +/- 60° around each axis in a first iteration
|
||||
double angle_range_min_x=-PI/3.0,angle_range_max_x=PI/3.0,
|
||||
angle_range_min_y=-PI/3.0,angle_range_max_y=PI/3.0,
|
||||
angle_range_min_z=-PI/3.0,angle_range_max_z=PI/3.0;
|
||||
double angle_range_min_x=-M_PI/3.0,angle_range_max_x=M_PI/3.0,
|
||||
angle_range_min_y=-M_PI/3.0,angle_range_max_y=M_PI/3.0,
|
||||
angle_range_min_z=-M_PI/3.0,angle_range_max_z=M_PI/3.0;
|
||||
|
||||
for (step_size = (2.0*PI/it_steps);step_size>(2.0*PI/360.0);step_size=(2.0*PI/it_steps))
|
||||
for (step_size = (2.0*M_PI/it_steps);step_size>(2.0*M_PI/360.0);step_size=(2.0*M_PI/it_steps))
|
||||
{
|
||||
for(alpha_x=angle_range_min_x;alpha_x<angle_range_max_x;alpha_x=alpha_x+step_size)
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ FemMesh &FemMesh::operator=(const FemMesh& mesh)
|
|||
|
||||
void FemMesh::copyMeshData(const FemMesh& mesh)
|
||||
{
|
||||
const SMDS_MeshInfo& info = mesh.myMesh->GetMeshDS()->GetMeshInfo();
|
||||
//const SMDS_MeshInfo& info = mesh.myMesh->GetMeshDS()->GetMeshInfo();
|
||||
//int numPoly = info.NbPolygons();
|
||||
//int numVolu = info.NbVolumes();
|
||||
//int numTetr = info.NbTetras();
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
# define WNT // avoid conflict with GUID
|
||||
#endif
|
||||
#ifndef _PreComp_
|
||||
# include <climits>
|
||||
# include <Python.h>
|
||||
# include <climits>
|
||||
# include <Standard_Version.hxx>
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <Handle_TDocStd_Document.hxx>
|
||||
|
|
|
@ -22,6 +22,7 @@ link_directories(${OCC_LIBRARY_DIR})
|
|||
set(ImportGui_LIBS
|
||||
FreeCADGui
|
||||
PartGui
|
||||
TKCAF
|
||||
TKXCAF
|
||||
TKLCAF
|
||||
TKXDESTEP
|
||||
|
|
|
@ -641,8 +641,8 @@ bool MeshAlgorithm::FillupHole(const std::vector<unsigned long>& boundary,
|
|||
bool ready = false;
|
||||
for (MeshFacetArray::_TConstIterator it = _rclMesh._aclFacetArray.begin(); it != _rclMesh._aclFacetArray.end(); ++it) {
|
||||
for (int i=0; i<3; i++) {
|
||||
if ((it->_aulPoints[i] == refPoint0) && (it->_aulPoints[(i+1)%3] == refPoint1) ||
|
||||
(it->_aulPoints[i] == refPoint1) && (it->_aulPoints[(i+1)%3] == refPoint0)) {
|
||||
if (((it->_aulPoints[i] == refPoint0) && (it->_aulPoints[(i+1)%3] == refPoint1)) ||
|
||||
((it->_aulPoints[i] == refPoint1) && (it->_aulPoints[(i+1)%3] == refPoint0))) {
|
||||
rFace = *it;
|
||||
rTriangle = _rclMesh.GetFacet(*it);
|
||||
ready = true;
|
||||
|
@ -1527,6 +1527,7 @@ bool MeshAlgorithm::ConnectLines (std::list<std::pair<Base::Vector3f, Base::Vect
|
|||
rclLines.erase(pFront);
|
||||
}
|
||||
|
||||
|
||||
if (pEnd != rclLines.end())
|
||||
{
|
||||
if (bEndFirst == true)
|
||||
|
@ -1913,17 +1914,17 @@ void MeshRefNormalToPoints::Rebuild (void)
|
|||
|
||||
const MeshFacetArray& rFacets = _rclMesh.GetFacets();
|
||||
for (MeshFacetArray::_TConstIterator pF = rFacets.begin(); pF != rFacets.end(); ++pF) {
|
||||
const MeshPoint &p0 = rPoints[pF->_aulPoints[0]];
|
||||
const MeshPoint &p1 = rPoints[pF->_aulPoints[1]];
|
||||
const MeshPoint &p2 = rPoints[pF->_aulPoints[2]];
|
||||
float l2p01 = Base::DistanceP2(p0,p1);
|
||||
float l2p12 = Base::DistanceP2(p1,p2);
|
||||
float l2p20 = Base::DistanceP2(p2,p0);
|
||||
|
||||
Base::Vector3f facenormal = _rclMesh.GetFacet(*pF).GetNormal();
|
||||
_norm[pF->_aulPoints[0]] += facenormal * (1.0f / (l2p01 * l2p20));
|
||||
_norm[pF->_aulPoints[1]] += facenormal * (1.0f / (l2p12 * l2p01));
|
||||
_norm[pF->_aulPoints[2]] += facenormal * (1.0f / (l2p20 * l2p12));
|
||||
const MeshPoint &p0 = rPoints[pF->_aulPoints[0]];
|
||||
const MeshPoint &p1 = rPoints[pF->_aulPoints[1]];
|
||||
const MeshPoint &p2 = rPoints[pF->_aulPoints[2]];
|
||||
float l2p01 = Base::DistanceP2(p0,p1);
|
||||
float l2p12 = Base::DistanceP2(p1,p2);
|
||||
float l2p20 = Base::DistanceP2(p2,p0);
|
||||
|
||||
Base::Vector3f facenormal = _rclMesh.GetFacet(*pF).GetNormal();
|
||||
_norm[pF->_aulPoints[0]] += facenormal * (1.0f / (l2p01 * l2p20));
|
||||
_norm[pF->_aulPoints[1]] += facenormal * (1.0f / (l2p12 * l2p01));
|
||||
_norm[pF->_aulPoints[2]] += facenormal * (1.0f / (l2p20 * l2p12));
|
||||
}
|
||||
for (std::vector<Base::Vector3f>::iterator it = _norm.begin(); it != _norm.end(); ++it)
|
||||
it->Normalize();
|
||||
|
|
|
@ -151,7 +151,7 @@ private:
|
|||
// --------------------------------------------------------
|
||||
|
||||
FacetCurvature::FacetCurvature(const MeshKernel& kernel, const MeshRefPointToFacets& search, float r, unsigned long pt)
|
||||
: myKernel(kernel), mySearch(search), myRadius(r), myMinPoints(pt)
|
||||
: myKernel(kernel), mySearch(search), myMinPoints(pt), myRadius(r)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -544,7 +544,6 @@ bool MeshInput::LoadOFF (std::istream &rstrIn)
|
|||
if (!buf)
|
||||
return false;
|
||||
|
||||
bool readvertices=false;
|
||||
std::getline(rstrIn, line);
|
||||
boost::algorithm::to_lower(line);
|
||||
if (line.find("off") == std::string::npos)
|
||||
|
@ -2315,6 +2314,7 @@ bool MeshVRML::Save (std::ostream &rstrOut, const std::vector<App::Color> &raclC
|
|||
MeshFacetIterator pFIter(_rclMesh);
|
||||
pFIter.Transform(this->_transform);
|
||||
i = 0, k = _rclMesh.CountFacets();
|
||||
|
||||
for (pFIter.Init(); pFIter.More(); pFIter.Next()) {
|
||||
MeshFacet clFacet = pFIter.GetIndices();
|
||||
rstrOut << " "
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace MeshCore;
|
|||
|
||||
MeshTrimming::MeshTrimming(MeshKernel &rclM, const Base::ViewProjMethod* pclProj,
|
||||
const Base::Polygon2D& rclPoly)
|
||||
: myMesh(rclM), myProj(pclProj), myPoly(rclPoly), myInner(true)
|
||||
: myMesh(rclM), myInner(true), myProj(pclProj), myPoly(rclPoly)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#ifndef _PreComp_
|
||||
# include <Python.h>
|
||||
# include <Interface_Static.hxx>
|
||||
# include <sstream>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
|
@ -86,6 +87,10 @@ PyDoc_STRVAR(module_part_doc,
|
|||
extern "C" {
|
||||
void PartExport initPart()
|
||||
{
|
||||
std::stringstream str;
|
||||
str << OCC_VERSION_MAJOR << "." << OCC_VERSION_MINOR << "." << OCC_VERSION_MAINTENANCE;
|
||||
App::Application::Config()["OCC_VERSION"] = str.str();
|
||||
|
||||
PyObject* partModule = Py_InitModule3("Part", Part_methods, module_part_doc); /* mod name, table ptr */
|
||||
Base::Console().Log("Loading Part module... done\n");
|
||||
|
||||
|
|
|
@ -785,6 +785,24 @@ static PyObject * makeHelix(PyObject *self, PyObject *args)
|
|||
}
|
||||
}
|
||||
|
||||
static PyObject * makeThread(PyObject *self, PyObject *args)
|
||||
{
|
||||
double pitch, height, depth, radius;
|
||||
if (!PyArg_ParseTuple(args, "dddd", &pitch, &height, &depth, &radius))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
TopoShape helix;
|
||||
TopoDS_Shape wire = helix.makeThread(pitch, height, depth, radius);
|
||||
return new TopoShapeWirePy(new TopoShape(wire));
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
PyErr_SetString(PyExc_Exception, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static PyObject * makeLine(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *obj1, *obj2;
|
||||
|
@ -1475,6 +1493,9 @@ struct PyMethodDef Part_methods[] = {
|
|||
"By default a cylindrical surface is used to create the helix. If the fourth parameter is set\n"
|
||||
"(the apex given in degree) a conical surface is used instead"},
|
||||
|
||||
{"makeThread" ,makeThread,METH_VARARGS,
|
||||
"makeThread(pitch,depth,height,radius) -- Make a thread with a given pitch, depth, height and radius"},
|
||||
|
||||
{"makeRevolution" ,makeRevolution,METH_VARARGS,
|
||||
"makeRevolution(Curve,[vmin,vmax,angle,pnt,dir]) -- Make a revolved shape\n"
|
||||
"by rotating the curve or a portion of it around an axis given by (pnt,dir).\n"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
|
||||
#include "FeatureRevolution.h"
|
||||
|
||||
#include <Base/Tools.h>
|
||||
|
||||
using namespace Part;
|
||||
|
||||
|
@ -72,7 +72,7 @@ App::DocumentObjectExecReturn *Revolution::execute(void)
|
|||
try {
|
||||
// Now, let's get the TopoDS_Shape
|
||||
TopoDS_Shape revolve = base->Shape.getShape().revolve(gp_Ax1(pnt, dir),
|
||||
Angle.getValue()/180.0f*Standard_PI);
|
||||
Angle.getValue()/180.0f*M_PI);
|
||||
if (revolve.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Resulting shape is null");
|
||||
this->Shape.setValue(revolve);
|
||||
|
|
|
@ -95,7 +95,7 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName)
|
|||
|
||||
// make model
|
||||
aReader.ClearShapes();
|
||||
Standard_Integer nbRootsForTransfer = aReader.NbRootsForTransfer();
|
||||
//Standard_Integer nbRootsForTransfer = aReader.NbRootsForTransfer();
|
||||
aReader.TransferRoots();
|
||||
pi->EndScope();
|
||||
|
||||
|
|
|
@ -71,21 +71,21 @@ public:
|
|||
virtual std::vector<PyObject *> getPySubObjects(const std::vector<std::string>&) const;
|
||||
|
||||
/**
|
||||
/* Find the origin of a reference, e.g. the vertex or edge in a sketch that
|
||||
/* produced a face
|
||||
*/
|
||||
* Find the origin of a reference, e.g. the vertex or edge in a sketch that
|
||||
* produced a face
|
||||
*/
|
||||
const TopoDS_Shape findOriginOf(const TopoDS_Shape& reference);
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
TopLoc_Location getLocation() const;
|
||||
/**
|
||||
/* Build a history of changes
|
||||
/* MakeShape: The operation that created the changes, e.g. BRepAlgoAPI_Common
|
||||
/* type: The type of object we are interested in, e.g. TopAbs_FACE
|
||||
/* newS: The new shape that was created by the operation
|
||||
/* oldS: The original shape prior to the operation
|
||||
*/
|
||||
* Build a history of changes
|
||||
* MakeShape: The operation that created the changes, e.g. BRepAlgoAPI_Common
|
||||
* type: The type of object we are interested in, e.g. TopAbs_FACE
|
||||
* newS: The new shape that was created by the operation
|
||||
* oldS: The original shape prior to the operation
|
||||
*/
|
||||
ShapeHistory buildHistory(BRepBuilderAPI_MakeShape&, TopAbs_ShapeEnum type,
|
||||
const TopoDS_Shape& newS, const TopoDS_Shape& oldS);
|
||||
ShapeHistory joinHistory(const ShapeHistory&, const ShapeHistory&);
|
||||
|
@ -121,9 +121,9 @@ public:
|
|||
|
||||
// Utility methods
|
||||
/**
|
||||
/* Find all faces cut by a line through the centre of gravity of a given face
|
||||
/* Useful for the "up to face" options to pocket or pad
|
||||
*/
|
||||
* Find all faces cut by a line through the centre of gravity of a given face
|
||||
* Useful for the "up to face" options to pocket or pad
|
||||
*/
|
||||
struct cutFaces {
|
||||
TopoDS_Face face;
|
||||
double distsq;
|
||||
|
@ -137,3 +137,4 @@ std::vector<cutFaces> findAllFacesCutBy(const TopoDS_Shape& shape,
|
|||
|
||||
|
||||
#endif // PART_FEATURE_H
|
||||
|
||||
|
|
|
@ -333,9 +333,9 @@ App::DocumentObjectExecReturn *Sphere::execute(void)
|
|||
return new App::DocumentObjectExecReturn("Radius of sphere too small");
|
||||
try {
|
||||
BRepPrimAPI_MakeSphere mkSphere(Radius.getValue(),
|
||||
Angle1.getValue()/180.0f*Standard_PI,
|
||||
Angle2.getValue()/180.0f*Standard_PI,
|
||||
Angle3.getValue()/180.0f*Standard_PI);
|
||||
Angle1.getValue()/180.0f*M_PI,
|
||||
Angle2.getValue()/180.0f*M_PI,
|
||||
Angle3.getValue()/180.0f*M_PI);
|
||||
TopoDS_Shape ResultShape = mkSphere.Shape();
|
||||
this->Shape.setValue(ResultShape);
|
||||
}
|
||||
|
@ -391,9 +391,9 @@ App::DocumentObjectExecReturn *Ellipsoid::execute(void)
|
|||
gp_Ax2 ax2(pnt,dir);
|
||||
BRepPrimAPI_MakeSphere mkSphere(ax2,
|
||||
Radius2.getValue(),
|
||||
Angle1.getValue()/180.0f*Standard_PI,
|
||||
Angle2.getValue()/180.0f*Standard_PI,
|
||||
Angle3.getValue()/180.0f*Standard_PI);
|
||||
Angle1.getValue()/180.0f*M_PI,
|
||||
Angle2.getValue()/180.0f*M_PI,
|
||||
Angle3.getValue()/180.0f*M_PI);
|
||||
Standard_Real scale = Radius1.getValue()/Radius2.getValue();
|
||||
gp_Dir xDir = ax2.XDirection();
|
||||
gp_Dir yDir = ax2.YDirection();
|
||||
|
@ -450,7 +450,7 @@ App::DocumentObjectExecReturn *Cylinder::execute(void)
|
|||
try {
|
||||
BRepPrimAPI_MakeCylinder mkCylr(Radius.getValue(),
|
||||
Height.getValue(),
|
||||
Angle.getValue()/180.0f*Standard_PI);
|
||||
Angle.getValue()/180.0f*M_PI);
|
||||
TopoDS_Shape ResultShape = mkCylr.Shape();
|
||||
this->Shape.setValue(ResultShape);
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ App::DocumentObjectExecReturn *Cone::execute(void)
|
|||
BRepPrimAPI_MakeCone mkCone(Radius1.getValue(),
|
||||
Radius2.getValue(),
|
||||
Height.getValue(),
|
||||
Angle.getValue()/180.0f*Standard_PI);
|
||||
Angle.getValue()/180.0f*M_PI);
|
||||
TopoDS_Shape ResultShape = mkCone.Shape();
|
||||
this->Shape.setValue(ResultShape);
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@
|
|||
# include <TopExp.hxx>
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
# include <Geom2d_Ellipse.hxx>
|
||||
# include <Geom_BezierCurve.hxx>
|
||||
# include <Geom_BezierSurface.hxx>
|
||||
# include <Geom_BSplineCurve.hxx>
|
||||
|
@ -1403,7 +1404,7 @@ TopoDS_Shape TopoShape::makeTube(double radius, double tol, int cont, int maxdeg
|
|||
{
|
||||
// http://opencascade.blogspot.com/2009/11/surface-modeling-part3.html
|
||||
Standard_Real theTol = tol;
|
||||
Standard_Boolean theIsPolynomial = Standard_True;
|
||||
//Standard_Boolean theIsPolynomial = Standard_True;
|
||||
Standard_Boolean myIsElem = Standard_True;
|
||||
GeomAbs_Shape theContinuity = GeomAbs_Shape(cont);
|
||||
Standard_Integer theMaxDegree = maxdegree;
|
||||
|
@ -1432,7 +1433,7 @@ TopoDS_Shape TopoShape::makeTube(double radius, double tol, int cont, int maxdeg
|
|||
|
||||
//circular profile
|
||||
Handle(Geom_Circle) aCirc = new Geom_Circle (gp::XOY(), radius);
|
||||
aCirc->Rotate (gp::OZ(), Standard_PI/2.);
|
||||
aCirc->Rotate (gp::OZ(), M_PI/2.);
|
||||
|
||||
//perpendicular section
|
||||
Handle(Law_Function) myEvol = ::CreateBsFunction (myPath->FirstParameter(), myPath->LastParameter(), radius);
|
||||
|
@ -1445,7 +1446,7 @@ TopoDS_Shape TopoShape::makeTube(double radius, double tol, int cont, int maxdeg
|
|||
mkSweep.Build (aSec, GeomFill_Location, theContinuity, theMaxDegree, theMaxSegment);
|
||||
if (mkSweep.IsDone()) {
|
||||
Handle_Geom_Surface mySurface = mkSweep.Surface();
|
||||
Standard_Real myError = mkSweep.ErrorOnSurface();
|
||||
//Standard_Real myError = mkSweep.ErrorOnSurface();
|
||||
|
||||
Standard_Real u1,u2,v1,v2;
|
||||
mySurface->Bounds(u1,u2,v1,v2);
|
||||
|
@ -1540,18 +1541,18 @@ TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
|
|||
}
|
||||
|
||||
gp_Pnt2d aPnt(0, 0);
|
||||
gp_Dir2d aDir(2. * PI, pitch);
|
||||
gp_Dir2d aDir(2. * M_PI, pitch);
|
||||
if (leftHanded) {
|
||||
//aPnt.SetCoord(0.0, height);
|
||||
//aDir.SetCoord(2.0 * PI, -pitch);
|
||||
aPnt.SetCoord(2. * PI, 0.0);
|
||||
aDir.SetCoord(-2. * PI, pitch);
|
||||
aPnt.SetCoord(2. * M_PI, 0.0);
|
||||
aDir.SetCoord(-2. * M_PI, pitch);
|
||||
}
|
||||
gp_Ax2d aAx2d(aPnt, aDir);
|
||||
|
||||
Handle(Geom2d_Line) line = new Geom2d_Line(aAx2d);
|
||||
gp_Pnt2d beg = line->Value(0);
|
||||
gp_Pnt2d end = line->Value(sqrt(4.0*PI*PI+pitch*pitch)*(height/pitch));
|
||||
gp_Pnt2d end = line->Value(sqrt(4.0*M_PI*M_PI+pitch*pitch)*(height/pitch));
|
||||
Handle(Geom2d_TrimmedCurve) segm = GCE2d_MakeSegment(beg , end);
|
||||
|
||||
TopoDS_Edge edgeOnSurf = BRepBuilderAPI_MakeEdge(segm , surf);
|
||||
|
@ -1560,6 +1561,68 @@ TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
|
|||
return wire;
|
||||
}
|
||||
|
||||
TopoDS_Shape TopoShape::makeThread(Standard_Real pitch,
|
||||
Standard_Real depth,
|
||||
Standard_Real height,
|
||||
Standard_Real radius) const
|
||||
{
|
||||
if (pitch < Precision::Confusion())
|
||||
Standard_Failure::Raise("Pitch of thread too small");
|
||||
|
||||
if (depth < Precision::Confusion())
|
||||
Standard_Failure::Raise("Depth of thread too small");
|
||||
|
||||
if (height < Precision::Confusion())
|
||||
Standard_Failure::Raise("Height of thread too small");
|
||||
|
||||
if (radius < Precision::Confusion())
|
||||
Standard_Failure::Raise("Radius of thread too small");
|
||||
|
||||
//Threading : Create Surfaces
|
||||
gp_Ax2 cylAx2(gp_Pnt(0.0,0.0,0.0) , gp::DZ());
|
||||
Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(cylAx2 , radius);
|
||||
Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(cylAx2 , radius+depth);
|
||||
|
||||
//Threading : Define 2D Curves
|
||||
gp_Pnt2d aPnt(2. * M_PI , height / 2.);
|
||||
gp_Dir2d aDir(2. * M_PI , height / 4.);
|
||||
gp_Ax2d aAx2d(aPnt , aDir);
|
||||
|
||||
Standard_Real aMajor = 2. * M_PI;
|
||||
Standard_Real aMinor = pitch;
|
||||
|
||||
Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(aAx2d , aMajor , aMinor);
|
||||
Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(aAx2d , aMajor , aMinor / 4);
|
||||
|
||||
Handle(Geom2d_TrimmedCurve) aArc1 = new Geom2d_TrimmedCurve(anEllipse1 , 0 , M_PI);
|
||||
Handle(Geom2d_TrimmedCurve) aArc2 = new Geom2d_TrimmedCurve(anEllipse2 , 0 , M_PI);
|
||||
|
||||
gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0);
|
||||
gp_Pnt2d anEllipsePnt2 = anEllipse1->Value(M_PI);
|
||||
|
||||
Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1 , anEllipsePnt2);
|
||||
|
||||
//Threading : Build Edges and Wires
|
||||
TopoDS_Edge aEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(aArc1 , aCyl1);
|
||||
TopoDS_Edge aEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment , aCyl1);
|
||||
TopoDS_Edge aEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(aArc2 , aCyl2);
|
||||
TopoDS_Edge aEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment , aCyl2);
|
||||
|
||||
TopoDS_Wire threadingWire1 = BRepBuilderAPI_MakeWire(aEdge1OnSurf1 , aEdge2OnSurf1);
|
||||
TopoDS_Wire threadingWire2 = BRepBuilderAPI_MakeWire(aEdge1OnSurf2 , aEdge2OnSurf2);
|
||||
|
||||
BRepLib::BuildCurves3d(threadingWire1);
|
||||
BRepLib::BuildCurves3d(threadingWire2);
|
||||
|
||||
BRepOffsetAPI_ThruSections aTool(Standard_True);
|
||||
|
||||
aTool.AddWire(threadingWire1);
|
||||
aTool.AddWire(threadingWire2);
|
||||
aTool.CheckCompatibility(Standard_False);
|
||||
|
||||
return aTool.Shape();
|
||||
}
|
||||
|
||||
TopoDS_Shape TopoShape::makeLoft(const TopTools_ListOfShape& profiles,
|
||||
Standard_Boolean isSolid,
|
||||
Standard_Boolean isRuled) const
|
||||
|
@ -1944,7 +2007,11 @@ void TopoShape::getFaces(std::vector<Base::Vector3d> &aPoints,
|
|||
Standard_Real x3, y3, z3;
|
||||
|
||||
Handle_StlMesh_Mesh aMesh = new StlMesh_Mesh();
|
||||
StlTransfer::BuildIncrementalMesh(this->_Shape, accuracy, aMesh);
|
||||
StlTransfer::BuildIncrementalMesh(this->_Shape, accuracy,
|
||||
#if OCC_VERSION_HEX >= 0x060503
|
||||
Standard_True,
|
||||
#endif
|
||||
aMesh);
|
||||
StlMesh_MeshExplorer xp(aMesh);
|
||||
for (Standard_Integer nbd=1;nbd<=aMesh->NbDomains();nbd++) {
|
||||
for (xp.InitTriangle (nbd); xp.MoreTriangle (); xp.NextTriangle ()) {
|
||||
|
|
|
@ -163,6 +163,8 @@ public:
|
|||
TopoDS_Shape makeTube(double radius, double tol, int cont, int maxdeg, int maxsegm) const;
|
||||
TopoDS_Shape makeHelix(Standard_Real pitch, Standard_Real height,
|
||||
Standard_Real radius, Standard_Real angle=0, Standard_Boolean left=Standard_False) const;
|
||||
TopoDS_Shape makeThread(Standard_Real pitch, Standard_Real depth,
|
||||
Standard_Real height, Standard_Real radius) const;
|
||||
TopoDS_Shape makeLoft(const TopTools_ListOfShape& profiles, Standard_Boolean isSolid,
|
||||
Standard_Boolean isRuled) const;
|
||||
TopoDS_Shape makeOffset(double offset, double tol,
|
||||
|
|
|
@ -664,6 +664,7 @@ DEF_STD_CMD_A(CmdPartReverseShape);
|
|||
CmdPartReverseShape::CmdPartReverseShape()
|
||||
:Command("Part_ReverseShape")
|
||||
{
|
||||
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Reverse shapes");
|
||||
|
@ -948,7 +949,7 @@ CmdPartLoft::CmdPartLoft()
|
|||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Loft...");
|
||||
sToolTipText = QT_TR_NOOP("Advanced utility to lofts");
|
||||
sToolTipText = QT_TR_NOOP("Utility to loft");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Loft";
|
||||
|
@ -974,7 +975,7 @@ CmdPartSweep::CmdPartSweep()
|
|||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Sweep...");
|
||||
sToolTipText = QT_TR_NOOP("Advanced utility to sweep");
|
||||
sToolTipText = QT_TR_NOOP("Utility to sweep");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Sweep";
|
||||
|
@ -1008,6 +1009,7 @@ CmdShapeInfo::CmdShapeInfo()
|
|||
|
||||
void CmdShapeInfo::activated(int iMsg)
|
||||
{
|
||||
#if 0
|
||||
static const char * const part_pipette[]={
|
||||
"32 32 17 1",
|
||||
"# c #000000",
|
||||
|
@ -1062,6 +1064,7 @@ void CmdShapeInfo::activated(int iMsg)
|
|||
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
#endif
|
||||
//if (view) {
|
||||
// Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
// viewer->setEditing(true);
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Gui/View3DInventor.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Mod/Part/App/Tools.h>
|
||||
|
||||
#include "DlgPrimitives.h"
|
||||
|
@ -55,43 +55,43 @@
|
|||
using namespace PartGui;
|
||||
|
||||
namespace PartGui {
|
||||
|
||||
const char* gce_ErrorStatusText(gce_ErrorType et)
|
||||
{
|
||||
switch (et)
|
||||
{
|
||||
case gce_Done:
|
||||
return "Construction was successful";
|
||||
case gce_ConfusedPoints:
|
||||
return "Two points are coincident";
|
||||
case gce_NegativeRadius:
|
||||
return "Radius value is negative";
|
||||
case gce_ColinearPoints:
|
||||
return "Three points are collinear";
|
||||
case gce_IntersectionError:
|
||||
return "Intersection cannot be computed";
|
||||
case gce_NullAxis:
|
||||
return "Axis is undefined";
|
||||
case gce_NullAngle:
|
||||
return "Angle value is invalid (usually null)";
|
||||
case gce_NullRadius:
|
||||
return "Radius is null";
|
||||
case gce_InvertAxis:
|
||||
return "Axis value is invalid";
|
||||
case gce_BadAngle:
|
||||
return "Angle value is invalid";
|
||||
case gce_InvertRadius:
|
||||
return "Radius value is incorrect (usually with respect to another radius)";
|
||||
case gce_NullFocusLength:
|
||||
return "Focal distance is null";
|
||||
case gce_NullVector:
|
||||
return "Vector is null";
|
||||
case gce_BadEquation:
|
||||
return "Coefficients are incorrect (applies to the equation of a geometric object)";
|
||||
default:
|
||||
return "Creation of geometry failed";
|
||||
}
|
||||
}
|
||||
|
||||
const char* gce_ErrorStatusText(gce_ErrorType et)
|
||||
{
|
||||
switch (et)
|
||||
{
|
||||
case gce_Done:
|
||||
return "Construction was successful";
|
||||
case gce_ConfusedPoints:
|
||||
return "Two points are coincident";
|
||||
case gce_NegativeRadius:
|
||||
return "Radius value is negative";
|
||||
case gce_ColinearPoints:
|
||||
return "Three points are collinear";
|
||||
case gce_IntersectionError:
|
||||
return "Intersection cannot be computed";
|
||||
case gce_NullAxis:
|
||||
return "Axis is undefined";
|
||||
case gce_NullAngle:
|
||||
return "Angle value is invalid (usually null)";
|
||||
case gce_NullRadius:
|
||||
return "Radius is null";
|
||||
case gce_InvertAxis:
|
||||
return "Axis value is invalid";
|
||||
case gce_BadAngle:
|
||||
return "Angle value is invalid";
|
||||
case gce_InvertRadius:
|
||||
return "Radius value is incorrect (usually with respect to another radius)";
|
||||
case gce_NullFocusLength:
|
||||
return "Focal distance is null";
|
||||
case gce_NullVector:
|
||||
return "Vector is null";
|
||||
case gce_BadEquation:
|
||||
return "Coefficients are incorrect (applies to the equation of a geometric object)";
|
||||
default:
|
||||
return "Creation of geometry failed";
|
||||
}
|
||||
}
|
||||
|
||||
void Picker::createPrimitive(QWidget* widget, const QString& descr, Gui::Document* doc)
|
||||
{
|
||||
|
@ -113,17 +113,17 @@ void Picker::createPrimitive(QWidget* widget, const QString& descr, Gui::Documen
|
|||
|
||||
QString Picker::toPlacement(const gp_Ax2& axis) const
|
||||
{
|
||||
gp_Dir dir = axis.Direction();
|
||||
gp_Pnt pnt = gp_Pnt(0.0,0.0,0.0);
|
||||
gp_Ax3 ax3(pnt, dir, axis.XDirection());
|
||||
|
||||
gp_Trsf Trf;
|
||||
Trf.SetTransformation(ax3);
|
||||
Trf.Invert();
|
||||
|
||||
gp_XYZ theAxis(0,0,1);
|
||||
Standard_Real theAngle = 0.0;
|
||||
Trf.GetRotation(theAxis,theAngle);
|
||||
gp_Dir dir = axis.Direction();
|
||||
gp_Pnt pnt = gp_Pnt(0.0,0.0,0.0);
|
||||
gp_Ax3 ax3(pnt, dir, axis.XDirection());
|
||||
|
||||
gp_Trsf Trf;
|
||||
Trf.SetTransformation(ax3);
|
||||
Trf.Invert();
|
||||
|
||||
gp_XYZ theAxis(0,0,1);
|
||||
Standard_Real theAngle = 0.0;
|
||||
Trf.GetRotation(theAxis,theAngle);
|
||||
|
||||
Base::Rotation rot(Base::convertTo<Base::Vector3d>(theAxis), theAngle);
|
||||
gp_Pnt loc = axis.Location();
|
||||
|
@ -153,10 +153,10 @@ public:
|
|||
QString command(App::Document* doc) const
|
||||
{
|
||||
GC_MakeArcOfCircle arc(points[0], points[1], points[2]);
|
||||
if (!arc.IsDone())
|
||||
throw Base::Exception(gce_ErrorStatusText(arc.Status()));
|
||||
Handle_Geom_TrimmedCurve trim = arc.Value();
|
||||
Handle_Geom_Circle circle = Handle_Geom_Circle::DownCast(trim->BasisCurve());
|
||||
if (!arc.IsDone())
|
||||
throw Base::Exception(gce_ErrorStatusText(arc.Status()));
|
||||
Handle_Geom_TrimmedCurve trim = arc.Value();
|
||||
Handle_Geom_Circle circle = Handle_Geom_Circle::DownCast(trim->BasisCurve());
|
||||
|
||||
QString name = QString::fromAscii(doc->getUniqueObjectName("Circle").c_str());
|
||||
return QString::fromAscii(
|
||||
|
@ -270,7 +270,6 @@ DlgPrimitives::~DlgPrimitives()
|
|||
void DlgPrimitives::pickCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->setHandled();
|
||||
|
@ -569,18 +568,18 @@ void DlgPrimitives::createPrimitive(const QString& placement)
|
|||
.arg(ui.comboBox1->currentText()), QString::fromLatin1(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
/* TRANSLATOR PartGui::Location */
|
||||
|
||||
Location::Location(QWidget* parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
Location::~Location()
|
||||
{
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
/* TRANSLATOR PartGui::Location */
|
||||
|
||||
Location::Location(QWidget* parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
Location::~Location()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
if (!this->activeView.isNull()) {
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>
|
||||
|
@ -589,7 +588,7 @@ Location::~Location()
|
|||
viewer->setRedirectToSceneGraph(false);
|
||||
viewer->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Location::on_viewPositionButton_clicked()
|
||||
{
|
||||
|
@ -643,46 +642,46 @@ void Location::pickCallback(void * ud, SoEventCallback * n)
|
|||
QString Location::toPlacement() const
|
||||
{
|
||||
Base::Vector3f d = ui.loc->getDirection();
|
||||
gp_Dir dir = gp_Dir(d.x,d.y,d.z);
|
||||
gp_Pnt pnt = gp_Pnt(0.0,0.0,0.0);
|
||||
gp_Ax3 ax3;
|
||||
|
||||
double cosNX = dir.Dot(gp::DX());
|
||||
double cosNY = dir.Dot(gp::DY());
|
||||
double cosNZ = dir.Dot(gp::DZ());
|
||||
std::vector<double> cosXYZ;
|
||||
cosXYZ.push_back(fabs(cosNX));
|
||||
cosXYZ.push_back(fabs(cosNY));
|
||||
cosXYZ.push_back(fabs(cosNZ));
|
||||
|
||||
int pos = std::max_element(cosXYZ.begin(), cosXYZ.end()) - cosXYZ.begin();
|
||||
|
||||
// +X/-X
|
||||
if (pos == 0) {
|
||||
if (cosNX > 0)
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,1,0));
|
||||
else
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,-1,0));
|
||||
}
|
||||
// +Y/-Y
|
||||
else if (pos == 1) {
|
||||
if (cosNY > 0)
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,0,1));
|
||||
else
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,0,-1));
|
||||
}
|
||||
// +Z/-Z
|
||||
else {
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(1,0,0));
|
||||
}
|
||||
|
||||
gp_Trsf Trf;
|
||||
Trf.SetTransformation(ax3);
|
||||
Trf.Invert();
|
||||
|
||||
gp_XYZ theAxis(0,0,1);
|
||||
Standard_Real theAngle = 0.0;
|
||||
Trf.GetRotation(theAxis,theAngle);
|
||||
gp_Dir dir = gp_Dir(d.x,d.y,d.z);
|
||||
gp_Pnt pnt = gp_Pnt(0.0,0.0,0.0);
|
||||
gp_Ax3 ax3;
|
||||
|
||||
double cosNX = dir.Dot(gp::DX());
|
||||
double cosNY = dir.Dot(gp::DY());
|
||||
double cosNZ = dir.Dot(gp::DZ());
|
||||
std::vector<double> cosXYZ;
|
||||
cosXYZ.push_back(fabs(cosNX));
|
||||
cosXYZ.push_back(fabs(cosNY));
|
||||
cosXYZ.push_back(fabs(cosNZ));
|
||||
|
||||
int pos = std::max_element(cosXYZ.begin(), cosXYZ.end()) - cosXYZ.begin();
|
||||
|
||||
// +X/-X
|
||||
if (pos == 0) {
|
||||
if (cosNX > 0)
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,1,0));
|
||||
else
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,-1,0));
|
||||
}
|
||||
// +Y/-Y
|
||||
else if (pos == 1) {
|
||||
if (cosNY > 0)
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,0,1));
|
||||
else
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(0,0,-1));
|
||||
}
|
||||
// +Z/-Z
|
||||
else {
|
||||
ax3 = gp_Ax3(pnt, dir, gp_Dir(1,0,0));
|
||||
}
|
||||
|
||||
gp_Trsf Trf;
|
||||
Trf.SetTransformation(ax3);
|
||||
Trf.Invert();
|
||||
|
||||
gp_XYZ theAxis(0,0,1);
|
||||
Standard_Real theAngle = 0.0;
|
||||
Trf.GetRotation(theAxis,theAngle);
|
||||
|
||||
Base::Rotation rot(Base::convertTo<Base::Vector3d>(theAxis), theAngle);
|
||||
Base::Vector3f loc = ui.loc->getPosition();
|
||||
|
@ -696,52 +695,52 @@ QString Location::toPlacement() const
|
|||
.arg(rot[2],0,'f',2)
|
||||
.arg(rot[3],0,'f',2);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
/* TRANSLATOR PartGui::TaskPrimitives */
|
||||
|
||||
TaskPrimitives::TaskPrimitives()
|
||||
{
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
widget = new DlgPrimitives();
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(),true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
|
||||
location = new Location();
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle(),true, 0);
|
||||
taskbox->groupLayout()->addWidget(location);
|
||||
taskbox->hideGroupBox();
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskPrimitives::~TaskPrimitives()
|
||||
{
|
||||
// automatically deleted in the sub-class
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButtons TaskPrimitives::getStandardButtons() const
|
||||
{
|
||||
return QDialogButtonBox::Close|
|
||||
QDialogButtonBox::Ok;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
/* TRANSLATOR PartGui::TaskPrimitives */
|
||||
|
||||
TaskPrimitives::TaskPrimitives()
|
||||
{
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
widget = new DlgPrimitives();
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(),true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
|
||||
location = new Location();
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle(),true, 0);
|
||||
taskbox->groupLayout()->addWidget(location);
|
||||
taskbox->hideGroupBox();
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskPrimitives::~TaskPrimitives()
|
||||
{
|
||||
// automatically deleted in the sub-class
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButtons TaskPrimitives::getStandardButtons() const
|
||||
{
|
||||
return QDialogButtonBox::Close|
|
||||
QDialogButtonBox::Ok;
|
||||
}
|
||||
|
||||
void TaskPrimitives::modifyStandardButtons(QDialogButtonBox* box)
|
||||
{
|
||||
QPushButton* btn = box->button(QDialogButtonBox::Ok);
|
||||
btn->setText(QApplication::translate("PartGui::DlgPrimitives", "&Create"));
|
||||
}
|
||||
|
||||
bool TaskPrimitives::accept()
|
||||
{
|
||||
widget->createPrimitive(location->toPlacement());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TaskPrimitives::reject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskPrimitives::accept()
|
||||
{
|
||||
widget->createPrimitive(location->toPlacement());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TaskPrimitives::reject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "moc_DlgPrimitives.cpp"
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Boolean operation</string>
|
||||
<string>Model refinement</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
|
|
|
@ -19,6 +19,7 @@ BUILT_SOURCES=\
|
|||
ui_TaskFaceColors.h \
|
||||
ui_TaskShapeBuilder.h \
|
||||
ui_TaskLoft.h \
|
||||
ui_TaskSweep.h \
|
||||
moc_CrossSections.cpp \
|
||||
moc_DlgBooleanOperation.cpp \
|
||||
moc_DlgExtrusion.cpp \
|
||||
|
@ -35,6 +36,7 @@ BUILT_SOURCES=\
|
|||
moc_TaskFaceColors.cpp \
|
||||
moc_TaskShapeBuilder.cpp \
|
||||
moc_TaskLoft.cpp \
|
||||
moc_TaskSweep.cpp \
|
||||
qrc_Part.cpp
|
||||
|
||||
libPartGui_la_SOURCES=\
|
||||
|
@ -73,6 +75,8 @@ libPartGui_la_SOURCES=\
|
|||
TaskShapeBuilder.h \
|
||||
TaskLoft.cpp \
|
||||
TaskLoft.h \
|
||||
TaskSweep.cpp \
|
||||
TaskSweep.h \
|
||||
PreCompiled.cpp \
|
||||
PreCompiled.h \
|
||||
SoBrepShape.cpp \
|
||||
|
@ -230,6 +234,7 @@ EXTRA_DIST = \
|
|||
TaskFaceColors.ui \
|
||||
TaskShapeBuilder.ui \
|
||||
TaskLoft.ui \
|
||||
TaskSweep.ui \
|
||||
Resources/Part.qrc \
|
||||
Resources/translations/Part_af.qm \
|
||||
Resources/translations/Part_af.ts \
|
||||
|
|
|
@ -67,18 +67,12 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
root->insertItem(item, part);
|
||||
part->setCommand("&Part");
|
||||
*part << "Part_Import" << "Part_Export" << "Separator";
|
||||
*part << prim << "Part_Primitives" << "Separator" << "Part_ShapeFromMesh"
|
||||
<< "Part_MakeSolid" << "Part_ReverseShape" << "Part_SimpleCopy"
|
||||
<< "Part_RefineShape" << "Separator"
|
||||
*part << prim << "Part_Primitives" << "Part_Builder" << "Separator"
|
||||
<< "Part_ShapeFromMesh" << "Part_MakeSolid" << "Part_ReverseShape"
|
||||
<< "Part_SimpleCopy" << "Part_RefineShape" << "Separator"
|
||||
<< "Part_Boolean" << "Part_CrossSections" << "Part_Extrude"
|
||||
<< "Part_Revolve" << "Part_Mirror" << "Part_Fillet" << "Part_Chamfer"
|
||||
<< "Part_RuledSurface" << "Part_Loft" << "Part_Sweep"
|
||||
<< "Part_Builder";
|
||||
|
||||
//Gui::MenuItem* partSimple = new Gui::MenuItem;
|
||||
//root->insertItem(item, partSimple);
|
||||
//partSimple->setCommand("&Simple");
|
||||
//*partSimple << "Part_SimpleCylinder";
|
||||
<< "Part_RuledSurface" << "Part_Loft" << "Part_Sweep";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
@ -89,15 +83,18 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
|
||||
Gui::ToolBarItem* solids = new Gui::ToolBarItem(root);
|
||||
solids->setCommand("Solids");
|
||||
*solids << "Part_Box" << "Part_Cylinder" << "Part_Sphere" << "Part_Cone" << "Part_Torus" << "Part_Primitives";
|
||||
*solids << "Part_Box" << "Part_Cylinder" << "Part_Sphere" << "Part_Cone"
|
||||
<< "Part_Torus" << "Part_Primitives" << "Part_Builder";
|
||||
|
||||
Gui::ToolBarItem* tool = new Gui::ToolBarItem(root);
|
||||
tool->setCommand("Part tools");
|
||||
*tool << "Part_Extrude" << "Part_Revolve" << "Part_Mirror" << "Part_Fillet" << "Part_Chamfer" << "Part_RuledSurface";
|
||||
*tool << "Part_Extrude" << "Part_Revolve" << "Part_Mirror" << "Part_Fillet"
|
||||
<< "Part_Chamfer" << "Part_RuledSurface" << "Part_Loft" << "Part_Sweep";
|
||||
|
||||
Gui::ToolBarItem* boolop = new Gui::ToolBarItem(root);
|
||||
boolop->setCommand("Boolean");
|
||||
*boolop << "Part_Boolean" << "Part_Cut" << "Part_Fuse" << "Part_Common" << "Part_Section";
|
||||
*boolop << "Part_Boolean" << "Part_Cut" << "Part_Fuse" << "Part_Common"
|
||||
<< "Part_Section" << "Part_CrossSections";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ def makeBottle(myWidth=50.0, myHeight=70.0, myThickness=30.0):
|
|||
aTrsf=Base.Matrix()
|
||||
aTrsf.rotateZ(math.pi) # rotate around the z-axis
|
||||
|
||||
aMirroredWire=aWire.transformGeometry(aTrsf)
|
||||
aMirroredWire=aWire.copy()
|
||||
aMirroredWire.transformShape(aTrsf)
|
||||
myWireProfile=Part.Wire([aWire,aMirroredWire])
|
||||
|
||||
myFaceProfile=Part.Face(myWireProfile)
|
||||
|
@ -80,8 +81,11 @@ def makeBottle(myWidth=50.0, myHeight=70.0, myThickness=30.0):
|
|||
|
||||
# This doesn't work for any reason
|
||||
myBody = myBody.makeThickness([faceToRemove],-myThickness/50 , 1.e-3)
|
||||
myThreading = Part.makeThread(myNeckHeight/10, myNeckRadius*0.06, myHeight/10, myNeckRadius*0.99)
|
||||
myThreading.translate(Base.Vector(0,0,myHeight))
|
||||
myCompound = Part.Compound([myBody, myThreading])
|
||||
|
||||
return myBody
|
||||
return myCompound
|
||||
|
||||
def makeBoreHole():
|
||||
# create a document if needed
|
||||
|
|
|
@ -178,7 +178,7 @@ App::DocumentObjectExecReturn *Pocket::execute(void)
|
|||
it_near = it;
|
||||
upToFace = (std::string(Type.getValueAsString()) == "UpToLast" ? it_far->face : it_near->face);
|
||||
} else {
|
||||
if (FaceName.getValue() == "")
|
||||
if (FaceName.isEmpty())
|
||||
return new App::DocumentObjectExecReturn("Cannot extrude up to face: No face selected");
|
||||
|
||||
// Get active object, this is the object that the user referenced when he clicked on the face!
|
||||
|
|
|
@ -17,6 +17,8 @@ libPartDesign_la_SOURCES=\
|
|||
FeatureChamfer.h \
|
||||
FeatureDressUp.cpp \
|
||||
FeatureDressUp.h \
|
||||
FeatureGroove.cpp \
|
||||
FeatureGroove.h \
|
||||
Body.cpp \
|
||||
Body.h \
|
||||
FeatureSketchBased.cpp \
|
||||
|
|
|
@ -8,8 +8,10 @@ BUILT_SOURCES=\
|
|||
moc_TaskPocketParameters.cpp \
|
||||
moc_TaskChamferParameters.cpp \
|
||||
moc_TaskFilletParameters.cpp \
|
||||
moc_TaskGrooveParameters.cpp \
|
||||
moc_TaskHoleParameters.cpp \
|
||||
moc_TaskRevolutionParameters.cpp \
|
||||
ui_TaskGrooveParameters.h \
|
||||
ui_TaskPadParameters.h \
|
||||
ui_TaskPatternRectangularParameters.h \
|
||||
ui_TaskPocketParameters.h \
|
||||
|
@ -19,6 +21,7 @@ BUILT_SOURCES=\
|
|||
ui_TaskRevolutionParameters.h
|
||||
|
||||
libPartDesignGui_la_UI=\
|
||||
TaskGrooveParameters.ui \
|
||||
TaskPadParameters.ui \
|
||||
TaskPatternRectangularParameters.ui \
|
||||
TaskPocketParameters.ui \
|
||||
|
@ -32,6 +35,8 @@ libPartDesignGui_la_SOURCES=\
|
|||
Command.cpp \
|
||||
PreCompiled.cpp \
|
||||
PreCompiled.h \
|
||||
TaskGrooveParameters.cpp \
|
||||
TaskGrooveParameters.h \
|
||||
TaskPadParameters.cpp \
|
||||
TaskPadParameters.h \
|
||||
TaskPatternRectangularParameters.cpp \
|
||||
|
@ -58,6 +63,8 @@ libPartDesignGui_la_SOURCES=\
|
|||
ViewProviderChamfer.h \
|
||||
ViewProviderFillet.cpp \
|
||||
ViewProviderFillet.h \
|
||||
ViewProviderGroove.cpp \
|
||||
ViewProviderGroove.h \
|
||||
ViewProviderRevolution.cpp \
|
||||
ViewProviderRevolution.h \
|
||||
ViewProviderPatternRectangular.cpp \
|
||||
|
|
|
@ -92,7 +92,7 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
|
|||
// According to bug #0000521 the reversed option
|
||||
// shouldn't be de-activated if the pad has a support face
|
||||
ui->checkBoxReversed->setChecked(reversed);
|
||||
ui->lineFaceName->setText(upToFace == "" ? tr("No face selected") : tr(upToFace));
|
||||
ui->lineFaceName->setText(pcPad->FaceName.isEmpty() ? tr("No face selected") : tr(upToFace));
|
||||
ui->changeMode->clear();
|
||||
ui->changeMode->insertItem(0, tr("Dimension"));
|
||||
ui->changeMode->insertItem(1, tr("To last"));
|
||||
|
|
|
@ -86,7 +86,7 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge
|
|||
ui->lineFaceName->setEnabled(false);
|
||||
} else if (index == 4) { // Only this option requires to select a face
|
||||
ui->doubleSpinBox->setEnabled(false);
|
||||
ui->lineFaceName->setText(upToFace == "" ? tr("No face selected") : tr(upToFace));
|
||||
ui->lineFaceName->setText(pcPocket->FaceName.isEmpty() ? tr("No face selected") : tr(upToFace));
|
||||
} else { // Neither value nor face required
|
||||
ui->doubleSpinBox->setEnabled(false);
|
||||
ui->lineFaceName->setEnabled(false);
|
||||
|
|
|
@ -51,7 +51,7 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
|||
int SecondIndex= Constraint::GeoUndef;
|
||||
int SecondPos = none;
|
||||
int ThirdIndex = Constraint::GeoUndef;
|
||||
int ThirdPos = none;
|
||||
//int ThirdPos = none;
|
||||
double Value = 0;
|
||||
// Note: In Python 2.x PyArg_ParseTuple prints a warning if a float is given but an integer is expected.
|
||||
// This means we must use a PyObject and check afterwards if it's a float or integer.
|
||||
|
|
|
@ -182,7 +182,7 @@ bool BrowserView::chckHostAllowed(const QString& host)
|
|||
void BrowserView::onDownloadRequested(const QNetworkRequest & request)
|
||||
{
|
||||
Dialog::DownloadDialog dlg (request.url(),this);
|
||||
int result = dlg.exec();
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void BrowserView::load(const char* URL)
|
||||
|
|
|
@ -24,7 +24,7 @@ SET /P M=Reebuild and press enter
|
|||
|
||||
rem making of the bin zip file
|
||||
|
||||
"c:\Program Files\7-Zip\7z.exe" a -t7z FreeCAD.7z "-xr!*.idb" "-xr!*.pdb" "-xr!*.ilk" "-xr!*.rule" "-xr!*.svn-base" "-xr!*.pyc" "-xr!*.stamp" "-xr!*.cmake" "-xr!*.svn*" "-xr!*.vcproj" "-xr!*.am" ..\..\bin ..\..\Mod ..\..\Doc ..\..\data
|
||||
"c:\Program Files\7-Zip\7z.exe" a -t7z FreeCAD.7z "-xr!*.idb" "-xr!*.pdb" "-xr!*.ilk" "-xr!*.rule" "-xr!*.svn-base" "-xr!*.pyc" "-xr!*.stamp" "-xr!*.cmake" "-xr!*.svn*" "-xr!*.vcproj" "-xr!*.am" "-xr!CMakeFiles" "-xr!*.dir" ..\..\bin ..\..\Mod ..\..\Doc ..\..\data
|
||||
|
||||
call CopyRelease.bat
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<?if $(var.ProcessorArchitecture)=x64 ?>
|
||||
<Merge Id="CRT" Language="0" SourceFile='$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_CRT_x86_x64.msm' DiskId="1"/>
|
||||
<?else ?>
|
||||
<Merge Id="CRT" Language="0" SourceFile='Microsoft_VC90_CRT_x86.msm' DiskId="1"/>
|
||||
<Merge Id="CRT" Language="0" SourceFile='$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_CRT_x86.msm' DiskId="1"/>
|
||||
<?endif ?>
|
||||
|
||||
<?if $(var.ProcessorArchitecture)=x64 ?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user