diff --git a/src/App/Application.cpp b/src/App/Application.cpp
index 2aa62f41dc..8cdf9610aa 100644
--- a/src/App/Application.cpp
+++ b/src/App/Application.cpp
@@ -1776,6 +1776,9 @@ void Application::ParseOptions(int ac, char ** av)
else if (strcmp(av[i],"-session") == 0) {
merge = true;
}
+ else if (strcmp(av[i],"-graphicssystem") == 0) {
+ merge = true;
+ }
}
// 0000659: SIGABRT on startup in boost::program_options (Boost 1.49)
diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp
index a05c6d3376..7678b9be44 100644
--- a/src/App/PropertyLinks.cpp
+++ b/src/App/PropertyLinks.cpp
@@ -291,8 +291,14 @@ void PropertyLinkList::Save(Base::Writer &writer) const
{
writer.Stream() << writer.ind() << "" << endl;
writer.incInd();
- for (int i = 0; igetNameInDocument() << "\"/>" << endl;;
+ for (int i = 0; igetNameInDocument() << "\"/>" << endl;
+ else
+ writer.Stream() << writer.ind() << "" << endl;
+ }
+
writer.decInd();
writer.Stream() << writer.ind() << "" << endl;
}
diff --git a/src/Base/PyObjectBase.h b/src/Base/PyObjectBase.h
index 1b9ae3fc01..a1fcd50f42 100644
--- a/src/Base/PyObjectBase.h
+++ b/src/Base/PyObjectBase.h
@@ -84,6 +84,21 @@
*/
#define PYFUNCIMP_S(CLASS,SFUNC) PyObject* CLASS::SFUNC (PyObject *self,PyObject *args,PyObject *kwd)
+
+/** Macro for initialization function of Python modules.
+ */
+#if PY_MAJOR_VERSION >= 3
+# define PyMOD_INIT_FUNC(name) PyMODINIT_FUNC PyInit_##name(void)
+#else
+# define PyMOD_INIT_FUNC(name) PyMODINIT_FUNC init##name(void)
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+# define PyMOD_Return(name) return name
+#else
+# define PyMOD_Return(name) return (void)name
+#endif
+
/**
* Union to convert from PyTypeObject to PyObject pointer.
*/
diff --git a/src/Gui/CombiView.cpp b/src/Gui/CombiView.cpp
index ca840c8ba4..a46d10974b 100644
--- a/src/Gui/CombiView.cpp
+++ b/src/Gui/CombiView.cpp
@@ -57,7 +57,6 @@ CombiView::CombiView(Gui::Document* pcDocument, QWidget *parent)
tabs = new QTabWidget ();
tabs->setObjectName(QString::fromUtf8("combiTab"));
tabs->setTabPosition(QTabWidget::North);
- //tabs->setTabShape(QTabWidget::Triangular);
pLayout->addWidget( tabs, 0, 0 );
// splitter between tree and property view
diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp
index a7211bd8ec..a81a156b33 100644
--- a/src/Gui/CommandView.cpp
+++ b/src/Gui/CommandView.cpp
@@ -2519,13 +2519,12 @@ StdCmdSceneInspector::StdCmdSceneInspector()
void StdCmdSceneInspector::activated(int iMsg)
{
Q_UNUSED(iMsg);
- View3DInventor* child = qobject_cast(getMainWindow()->activeWindow());
- if (child) {
- View3DInventorViewer* viewer = child->getViewer();
+ Gui::Document* doc = Application::Instance->activeDocument();
+ if (doc) {
static QPointer dlg = 0;
if (!dlg)
dlg = new Gui::Dialog::DlgInspector(getMainWindow());
- dlg->setNode(viewer->getSceneGraph());
+ dlg->setDocument(doc);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->show();
}
diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp
index 7cab8a575c..2c5efba8e3 100644
--- a/src/Gui/DlgGeneralImp.cpp
+++ b/src/Gui/DlgGeneralImp.cpp
@@ -238,14 +238,17 @@ void DlgGeneralImp::loadSettings()
}
}
- int size = QApplication::style()->pixelMetric(QStyle::PM_ToolBarIconSize);
int current = getMainWindow()->iconSize().width();
- this->toolbarIconSize->addItem(tr("Default (%1 x %1)").arg(size), QVariant((int)size));
- this->toolbarIconSize->addItem(tr("Small (%1 x %1)").arg(16), QVariant((int)16));
- this->toolbarIconSize->addItem(tr("Large (%1 x %1)").arg(32), QVariant((int)32));
- this->toolbarIconSize->addItem(tr("Extra large (%1 x %1)").arg(48), QVariant((int)48));
+ this->toolbarIconSize->addItem(tr("Small (%1px)").arg(16), QVariant((int)16));
+ this->toolbarIconSize->addItem(tr("Medium (%1px)").arg(24), QVariant((int)24));
+ this->toolbarIconSize->addItem(tr("Large (%1px)").arg(32), QVariant((int)32));
+ this->toolbarIconSize->addItem(tr("Extra large (%1px)").arg(48), QVariant((int)48));
index = this->toolbarIconSize->findData(QVariant(current));
- if (index > -1) this->toolbarIconSize->setCurrentIndex(index);
+ if (index < 0) {
+ this->toolbarIconSize->addItem(tr("Custom (%1px)").arg(current), QVariant((int)current));
+ index = this->toolbarIconSize->findData(QVariant(current));
+ }
+ this->toolbarIconSize->setCurrentIndex(index);
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");
this->tiledBackground->setChecked(hGrp->GetBool("TiledBackground", false));
diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp
index f2ff9b70a9..ee984fee79 100644
--- a/src/Gui/PropertyView.cpp
+++ b/src/Gui/PropertyView.cpp
@@ -70,7 +70,9 @@ PropertyView::PropertyView(QWidget *parent)
tabs = new QTabWidget (this);
tabs->setObjectName(QString::fromUtf8("propertyTab"));
tabs->setTabPosition(QTabWidget::South);
+#if defined(Q_OS_WIN32)
tabs->setTabShape(QTabWidget::Triangular);
+#endif
pLayout->addWidget(tabs, 0, 0);
propertyEditorView = new Gui::PropertyEditor::PropertyEditor();
diff --git a/src/Gui/SceneInspector.cpp b/src/Gui/SceneInspector.cpp
index 5bc6e3804f..013520d182 100644
--- a/src/Gui/SceneInspector.cpp
+++ b/src/Gui/SceneInspector.cpp
@@ -23,15 +23,18 @@
#include "PreCompiled.h"
#ifndef _PreComp_
-# include
+# include
# include
#endif
#include "SceneInspector.h"
#include "ui_SceneInspector.h"
-#include "MainWindow.h"
#include "View3DInventor.h"
#include "View3DInventorViewer.h"
+#include "ViewProviderDocumentObject.h"
+#include "Document.h"
+#include "Application.h"
+#include
using namespace Gui::Dialog;
@@ -97,15 +100,21 @@ void SceneModel::setNode(QModelIndex index, SoNode* node)
for (int i=0; igetNumChildren();i++) {
SoNode* child = group->getChild(i);
setNode(this->index(i, 0, index), child);
- // See ViewProviderDocumentObject::updateData
- QByteArray name(child->getName());
- name = QByteArray::fromPercentEncoding(name);
- this->setData(this->index(i, 1, index), QVariant(QString::fromUtf8(name)));
+
+ QMap::iterator it = nodeNames.find(child);
+ if (it != nodeNames.end()) {
+ this->setData(this->index(i, 1, index), QVariant(it.value()));
+ }
}
}
// insert icon
}
+void SceneModel::setNodeNames(const QMap& names)
+{
+ nodeNames = names;
+}
+
// --------------------------------------------------------
/* TRANSLATOR Gui::Dialog::DlgInspector */
@@ -130,6 +139,18 @@ DlgInspector::~DlgInspector()
delete ui;
}
+void DlgInspector::setDocument(Gui::Document* doc)
+{
+ setNodeNames(doc);
+
+ View3DInventor* view = qobject_cast(doc->getActiveView());
+ if (view) {
+ View3DInventorViewer* viewer = view->getViewer();
+ setNode(viewer->getSceneGraph());
+ ui->treeView->expandToDepth(3);
+ }
+}
+
void DlgInspector::setNode(SoNode* node)
{
SceneModel* model = static_cast(ui->treeView->model());
@@ -145,6 +166,32 @@ void DlgInspector::setNode(SoNode* node)
#endif
}
+void DlgInspector::setNodeNames(Gui::Document* doc)
+{
+ std::vector vps = doc->getViewProvidersOfType
+ (Gui::ViewProviderDocumentObject::getClassTypeId());
+ QMap nodeNames;
+ for (std::vector::iterator it = vps.begin(); it != vps.end(); ++it) {
+ Gui::ViewProviderDocumentObject* vp = static_cast(*it);
+ App::DocumentObject* obj = vp->getObject();
+ if (obj) {
+ QString label = QString::fromUtf8(obj->Label.getValue());
+ nodeNames[vp->getRoot()] = label;
+ }
+
+ std::vector modes = vp->getDisplayMaskModes();
+ for (std::vector::iterator jt = modes.begin(); jt != modes.end(); ++jt) {
+ SoNode* node = vp->getDisplayMaskMode(jt->c_str());
+ if (node) {
+ nodeNames[node] = QString::fromStdString(*jt);
+ }
+ }
+ }
+
+ SceneModel* model = static_cast(ui->treeView->model());
+ model->setNodeNames(nodeNames);
+}
+
void DlgInspector::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
@@ -156,11 +203,16 @@ void DlgInspector::changeEvent(QEvent *e)
void DlgInspector::on_refreshButton_clicked()
{
- View3DInventor* child = qobject_cast(getMainWindow()->activeWindow());
- if (child) {
- View3DInventorViewer* viewer = child->getViewer();
- setNode(viewer->getSceneGraph());
- ui->treeView->expandToDepth(3);
+ Gui::Document* doc = Application::Instance->activeDocument();
+ if (doc) {
+ setNodeNames(doc);
+
+ View3DInventor* view = qobject_cast(doc->getActiveView());
+ if (view) {
+ View3DInventorViewer* viewer = view->getViewer();
+ setNode(viewer->getSceneGraph());
+ ui->treeView->expandToDepth(3);
+ }
}
else {
SceneModel* model = static_cast(ui->treeView->model());
diff --git a/src/Gui/SceneInspector.h b/src/Gui/SceneInspector.h
index a7b187c71d..27ff489ef2 100644
--- a/src/Gui/SceneInspector.h
+++ b/src/Gui/SceneInspector.h
@@ -25,10 +25,12 @@
#include
#include
+#include
class SoNode;
namespace Gui {
+class Document;
namespace Dialog {
class Ui_SceneInspector;
@@ -53,11 +55,14 @@ public:
bool setHeaderData (int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole);
/// insert the first node in tree
void setNode(SoNode* node);
+ /// set names per node
+ void setNodeNames(const QMap& names);
/// returns standard parent's flags
Qt::ItemFlags flags (const QModelIndex & index) const;
private:
void setNode(QModelIndex, SoNode*);
+ QMap nodeNames;
};
/// Dialog window to display scenegraph model as a tree
@@ -69,13 +74,15 @@ public:
DlgInspector(QWidget* parent = 0, Qt::WindowFlags fl = 0);
~DlgInspector();
- void setNode(SoNode* node);
+ void setDocument(Gui::Document* doc);
private Q_SLOTS:
void on_refreshButton_clicked();
protected:
void changeEvent(QEvent *e);
+ void setNode(SoNode* node);
+ void setNodeNames(Gui::Document*);
private:
Ui_SceneInspector* ui;
diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp
index 8795282405..ec8e5bb0da 100644
--- a/src/Gui/Splashscreen.cpp
+++ b/src/Gui/Splashscreen.cpp
@@ -34,6 +34,10 @@
# include
#endif
+#if QT_VERSION < 0x050000
+# include
+#endif
+
#include
#include "Splashscreen.h"
@@ -140,10 +144,16 @@ public:
return;
}
- splash->showMessage(msg.replace(QLatin1String("\n"), QString()), alignment, textColor);
- QMutex mutex;
- QMutexLocker ml(&mutex);
- QWaitCondition().wait(&mutex, 50);
+#if QT_VERSION < 0x050000
+ const QGLContext* ctx = QGLContext::currentContext();
+ if (!ctx)
+#endif
+ {
+ splash->showMessage(msg.replace(QLatin1String("\n"), QString()), alignment, textColor);
+ QMutex mutex;
+ QMutexLocker ml(&mutex);
+ QWaitCondition().wait(&mutex, 50);
+ }
}
private:
diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp
index 7e89d675c8..4eaf744d47 100644
--- a/src/Gui/ViewProvider.cpp
+++ b/src/Gui/ViewProvider.cpp
@@ -275,21 +275,6 @@ SbMatrix ViewProvider::convert(const Base::Matrix4D &rcMatrix) const
void ViewProvider::addDisplayMaskMode(SoNode *node, const char* type)
{
- if (type) {
- std::string name = type;
- for (std::string::iterator it = name.begin(); it != name.end(); ++it) {
- if (it == name.begin()) {
- if (!SbName::isBaseNameStartChar(*it))
- *it = '_';
- }
- else {
- if (!SbName::isBaseNameChar(*it))
- *it = '_';
- }
- }
- node->setName(name.c_str());
- }
-
_sDisplayMaskModes[type] = pcModeSwitch->getNumChildren();
pcModeSwitch->addChild(node);
}
diff --git a/src/Gui/ViewProviderDocumentObject.cpp b/src/Gui/ViewProviderDocumentObject.cpp
index bbaca4ca48..89dfdb190c 100644
--- a/src/Gui/ViewProviderDocumentObject.cpp
+++ b/src/Gui/ViewProviderDocumentObject.cpp
@@ -190,14 +190,6 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj)
void ViewProviderDocumentObject::updateData(const App::Property* prop)
{
- if (pcObject && prop == &pcObject->Label) {
- // SoBase::setName() replaces characters that according to the
- // VRML standard are invalid. To avoid the replacement we use
- // the percent encoding.
- QByteArray ba(pcObject->Label.getValue());
- QByteArray name = ba.toPercentEncoding();
- pcRoot->setName(name.constData());
- }
ViewProvider::updateData(prop);
}
diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py
index 30a5443dea..a07b28641b 100644
--- a/src/Mod/Arch/ArchCommands.py
+++ b/src/Mod/Arch/ArchCommands.py
@@ -707,7 +707,7 @@ def pruneIncluded(objectslist,strict=False):
for obj in objectslist:
toplevel = True
if obj.isDerivedFrom("Part::Feature"):
- if not (Draft.getType(obj) in ["Window","Clone","Pipe"]):
+ if not (Draft.getType(obj) in ["Window","Clone","Pipe","Rebar"]):
for parent in obj.InList:
if parent.isDerivedFrom("Part::Feature") and not (Draft.getType(parent) in ["Facebinder"]):
if not parent.isDerivedFrom("Part::Part2DObject"):
diff --git a/src/Mod/Arch/ArchRebar.py b/src/Mod/Arch/ArchRebar.py
index 655411c13a..c65b14f84d 100644
--- a/src/Mod/Arch/ArchRebar.py
+++ b/src/Mod/Arch/ArchRebar.py
@@ -183,6 +183,56 @@ class _Rebar(ArchComponent.Component):
v = DraftGeomUtils.vec(e).normalize()
return e.Vertexes[0].Point,v
return None,None
+
+ def getRebarData(self,obj):
+ if len(obj.InList) != 1:
+ return
+ if Draft.getType(obj.InList[0]) != "Structure":
+ return
+ if not obj.InList[0].Shape:
+ return
+ if not obj.Base:
+ return
+ if not obj.Base.Shape:
+ return
+ if not obj.Base.Shape.Wires:
+ return
+ if not obj.Diameter.Value:
+ return
+ if not obj.Amount:
+ return
+ father = obj.InList[0]
+ wire = obj.Base.Shape.Wires[0]
+ axis = obj.Base.Placement.Rotation.multVec(FreeCAD.Vector(0,0,-1))
+ size = (ArchCommands.projectToVector(father.Shape.copy(),axis)).Length
+ if hasattr(obj,"Rounding"):
+ if obj.Rounding:
+ radius = obj.Rounding * obj.Diameter.Value
+ import DraftGeomUtils
+ wire = DraftGeomUtils.filletWire(wire,radius)
+ wires = []
+ if obj.Amount == 1:
+ offset = DraftVecUtils.scaleTo(axis,size/2)
+ wire.translate(offset)
+ wires.append(wire)
+ else:
+ if obj.OffsetStart.Value:
+ baseoffset = DraftVecUtils.scaleTo(axis,obj.OffsetStart.Value)
+ else:
+ baseoffset = None
+ interval = size - (obj.OffsetStart.Value + obj.OffsetEnd.Value)
+ interval = interval / (obj.Amount - 1)
+ vinterval = DraftVecUtils.scaleTo(axis,interval)
+ for i in range(obj.Amount):
+ if i == 0:
+ if baseoffset:
+ wire.translate(baseoffset)
+ wires.append(wire)
+ else:
+ wire = wire.copy()
+ wire.translate(vinterval)
+ wires.append(wire)
+ return [wires,obj.Diameter.Value/2]
def execute(self,obj):
diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py
index 02af353bc0..e05e4fb1e9 100644
--- a/src/Mod/Arch/ArchSite.py
+++ b/src/Mod/Arch/ArchSite.py
@@ -431,7 +431,10 @@ class _Site(ArchFloor._Floor):
if obj.Perimeter.Value != l:
obj.Perimeter = l
# compute volumes
- shapesolid = obj.Terrain.Shape.extrude(obj.ExtrusionVector)
+ if obj.Terrain.Shape.Solids:
+ shapesolid = obj.Terrain.Shape.copy()
+ else:
+ shapesolid = obj.Terrain.Shape.extrude(obj.ExtrusionVector)
addvol = 0
subvol = 0
for sub in obj.Subtractions:
diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py
index 14fa677d38..e19c89594f 100644
--- a/src/Mod/Arch/importIFC.py
+++ b/src/Mod/Arch/importIFC.py
@@ -21,6 +21,8 @@
#* *
#***************************************************************************
+from __future__ import print_function
+
__title__ = "FreeCAD IFC importer - Enhanced ifcopenshell-only version"
__author__ = "Yorik van Havre","Jonathan Wiedemann"
__url__ = "http://www.freecadweb.org"
@@ -344,7 +346,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
FreeCAD.Console.PrintError("IfcOpenShell was not found on this system. IFC support is disabled\n")
return
- if DEBUG: print("Opening ",filename,"...",)
+ if DEBUG: print("Opening ",filename,"...",end="")
try:
doc = FreeCAD.getDocument(docname)
except:
@@ -358,8 +360,6 @@ def insert(filename,docname,skip=[],only=[],root=None):
if root:
ROOT_ELEMENT = root
- if DEBUG: print ("done.")
-
#global ifcfile # keeping global for debugging purposes
filename = decode(filename,utf=True)
ifcfile = ifcopenshell.open(filename)
@@ -380,7 +380,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
annotations = ifcfile.by_type("IfcAnnotation")
materials = ifcfile.by_type("IfcMaterial")
- if DEBUG: print("Building relationships table...",)
+ if DEBUG: print("Building relationships table...",end="")
# building relations tables
objects = {} # { id:object, ... }
@@ -476,7 +476,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
pid = product.id()
guid = product.GlobalId
ptype = product.is_a()
- if DEBUG: print(count+1,"/",len(products)," creating object #",pid," : ",ptype,)
+ if DEBUG: print(count+1,"/",len(products)," creating object #",pid," : ",ptype,end="")
name = str(ptype[3:])
if product.Name:
name = product.Name.encode("utf8")
@@ -491,9 +491,9 @@ def insert(filename,docname,skip=[],only=[],root=None):
if ptype in structuralifcobjects:
archobj = False
structobj = True
- if DEBUG: print(" (struct)",)
+ if DEBUG: print(" (struct)",end="")
else:
- if DEBUG: print(" (arch)",)
+ if DEBUG: print(" (arch)",end="")
if MERGE_MODE_ARCH == 4 and archobj:
if DEBUG: print(" skipped.")
continue
@@ -514,7 +514,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
try:
prepr = product.Representation
except:
- if DEBUG: print(" ERROR unable to get object representation",)
+ if DEBUG: print(" ERROR unable to get object representation",end="")
if prepr and (MERGE_MODE_ARCH == 0) and archobj and CREATE_CLONES:
for s in prepr.Representations:
@@ -538,7 +538,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
pass # IfcOpenShell will yield an error if a given product has no shape, but we don't care
if brep:
- if DEBUG: print(" ",str(len(brep)/1000),"k ",)
+ if DEBUG: print(" ",str(len(brep)/1000),"k ",end="")
shape = Part.Shape()
shape.importBrepFromString(brep)
@@ -551,20 +551,20 @@ def insert(filename,docname,skip=[],only=[],root=None):
if DEBUG: print("skipping space ",pid)
elif structobj:
structshapes[pid] = shape
- if DEBUG: print(shape.Solids," ",)
+ if DEBUG: print(shape.Solids," ",end="")
baseobj = shape
else:
shapes[pid] = shape
- if DEBUG: print(shape.Solids," ",)
+ if DEBUG: print(shape.Solids," ",end="")
baseobj = shape
else:
if clone:
- if DEBUG: print("clone ",)
+ if DEBUG: print("clone ",end="")
else:
if GET_EXTRUSIONS:
ex = Arch.getExtrusionData(shape)
if ex:
- print("extrusion ",)
+ print("extrusion ",end="")
baseface = FreeCAD.ActiveDocument.addObject("Part::Feature",name+"_footprint")
# bug in ifcopenshell? Some faces of a shell may have non-null placement
# workaround to remove the bad placement: exporting/reimporting as step
@@ -587,13 +587,13 @@ def insert(filename,docname,skip=[],only=[],root=None):
baseobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name+"_body")
baseobj.Shape = shape
else:
- if DEBUG: print("null shape ",)
+ if DEBUG: print("null shape ",end="")
if not shape.isValid():
- if DEBUG: print("invalid shape ",)
+ if DEBUG: print("invalid shape ",end="")
#continue
else:
- if DEBUG: print(" no brep ",)
+ if DEBUG: print(" no brep ",end="")
if MERGE_MODE_ARCH == 0 and archobj:
@@ -622,7 +622,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
obj.Placement.Rotation = r
obj.Placement.move(v)
else:
- print "failed to compute placement ",
+ print ("failed to compute placement ",)
else:
obj = getattr(Arch,"make"+freecadtype)(baseobj=baseobj,name=name)
if store:
@@ -747,7 +747,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
if MERGE_MODE_STRUCT == 2:
- if DEBUG: print("Joining Structural shapes...")
+ if DEBUG: print("Joining Structural shapes...",end="")
for host,children in groups.items(): # Structural
if ifcfile[host].is_a("IfcStructuralAnalysisModel"):
@@ -770,7 +770,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
else:
- if DEBUG: print("Processing Struct relationships...")
+ if DEBUG: print("Processing Struct relationships...",end="")
# groups
for host,children in groups.items():
@@ -792,7 +792,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
Arch.addComponents(cobs,objects[host])
if DEBUG: FreeCAD.ActiveDocument.recompute()
- if DEBUG: print "done"
+ if DEBUG: print ("done")
if MERGE_MODE_ARCH > 2: # if ArchObj is compound or ArchObj not imported
FreeCAD.ActiveDocument.recompute()
@@ -809,7 +809,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
if ifcfile[host].Name:
grp_name = ifcfile[host].Name
else:
- if DEBUG: print "no group name specified for entity: #", ifcfile[host].id(), ", entity type is used!"
+ if DEBUG: print ("no group name specified for entity: #", ifcfile[host].id(), ", entity type is used!")
grp_name = ifcfile[host].is_a() + "_" + str(ifcfile[host].id())
grp = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup",grp_name.encode("utf8"))
objects[host] = grp
@@ -821,7 +821,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
if MERGE_MODE_ARCH == 3:
- if DEBUG: print("Joining Arch shapes...")
+ if DEBUG: print("Joining Arch shapes...",end="")
for host,children in additions.items(): # Arch
if ifcfile[host].is_a("IfcBuildingStorey"):
@@ -845,11 +845,11 @@ def insert(filename,docname,skip=[],only=[],root=None):
obj = FreeCAD.ActiveDocument.addObject("Part::Feature","UnclaimedArch")
obj.Shape = Part.makeCompound(shapes.values())
- if DEBUG: print "done"
+ if DEBUG: print ("done")
else:
- if DEBUG: print("Processing Arch relationships...")
+ if DEBUG: print("Processing Arch relationships...",end="")
# subtractions
if SEPARATE_OPENINGS:
@@ -871,6 +871,8 @@ def insert(filename,docname,skip=[],only=[],root=None):
if DEBUG: print("adding ",len(cobs), " object(s) to ", objects[host].Label)
Arch.addComponents(cobs,objects[host])
if DEBUG: FreeCAD.ActiveDocument.recompute()
+
+ if DEBUG: print("done.")
FreeCAD.ActiveDocument.recompute()
@@ -884,7 +886,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
# 2D elements
- if DEBUG and annotations:print("Creating 2D geometry...")
+ if DEBUG and annotations:print("Creating 2D geometry...",end="")
scaling = getScaling(ifcfile)
#print "scaling factor =",scaling
@@ -915,10 +917,12 @@ def insert(filename,docname,skip=[],only=[],root=None):
count += 1
FreeCAD.ActiveDocument.recompute()
+
+ if DEBUG and annotations: print("done.")
# Materials
- if DEBUG and materials: print("Creating materials...")
+ if DEBUG and materials: print("Creating materials...",end="")
#print "mattable:",mattable
#print "materials:",materials
fcmats = {}
@@ -947,7 +951,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
if hasattr(objects[o],"BaseMaterial"):
objects[o].BaseMaterial = mat
- if DEBUG and materials: print "done"
+ if DEBUG and materials: print ("done")
FreeCAD.ActiveDocument.recompute()
@@ -1356,7 +1360,7 @@ def export(exportList,filename):
if EXPORT_2D:
curvestyles = {}
- if annotations and DEBUG: print "exporting 2D objects..."
+ if annotations and DEBUG: print ("exporting 2D objects...")
for anno in annotations:
xvc = ifcfile.createIfcDirection((1.0,0.0,0.0))
zvc = ifcfile.createIfcDirection((0.0,0.0,1.0))
@@ -1597,6 +1601,19 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
shapes.append(shape)
solidType = "SweptSolid"
shapetype = "extrusion"
+ elif hasattr(obj.Proxy,"getRebarData"):
+ # export rebars as IfcSweptDiskSolid
+ rdata = obj.Proxy.getRebarData(obj)
+ if rdata:
+ # convert to meters
+ r = rdata[1] * 0.001
+ for w in rdata[0]:
+ w.scale(0.001)
+ cur = createCurve(ifcfile,w)
+ shape = ifcfile.createIfcSweptDiskSolid(cur,r)
+ shapes.append(shape)
+ solidType = "SweptSolid"
+ shapetype = "extrusion"
if not shapes:
# brep representation
diff --git a/src/Mod/Complete/App/AppComplete.cpp b/src/Mod/Complete/App/AppComplete.cpp
index 5c202fc90f..4d5a45e6e3 100644
--- a/src/Mod/Complete/App/AppComplete.cpp
+++ b/src/Mod/Complete/App/AppComplete.cpp
@@ -30,6 +30,7 @@
#include
#include
+#include
#include
#include "CompleteConfiguration.h"
@@ -57,7 +58,7 @@ PyObject* initModule()
/* Python entry */
-PyMODINIT_FUNC initComplete()
+PyMOD_INIT_FUNC(Complete)
{
// load dependent module
try {
@@ -86,8 +87,9 @@ PyMODINIT_FUNC initComplete()
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
- return;
+ PyMOD_Return(0);
}
- (void)Complete::initModule();
+ PyObject* mod = Complete::initModule();
Base::Console().Log("Loading Complete module... done\n");
+ PyMOD_Return(mod);
}
diff --git a/src/Mod/Complete/Gui/AppCompleteGui.cpp b/src/Mod/Complete/Gui/AppCompleteGui.cpp
index 6709afeaa1..09505603f8 100644
--- a/src/Mod/Complete/Gui/AppCompleteGui.cpp
+++ b/src/Mod/Complete/Gui/AppCompleteGui.cpp
@@ -74,32 +74,32 @@ PyObject* initModule()
/* Python entry */
-PyMODINIT_FUNC initCompleteGui()
+PyMOD_INIT_FUNC(CompleteGui)
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
- return;
+ PyMOD_Return(0);
}
- // try to load dependent modules, currently not (AssemblyGui, CamGui)
- char *modules[] = {"PartGui", "MeshGui", "MeshPartGui", "PointsGui", "DrawingGui", "RaytracingGui", "SketcherGui", "PartDesignGui", "ImageGui", "TestGui"};
- size_t nModules = sizeof(modules) / sizeof(char*);
- for (size_t i = 0; i < nModules; i++) {
- try {
- Base::Interpreter().loadModule(modules[i]);
- }
- catch (const Base::Exception& e) {
- Base::Console().Error("%s\n", e.what());
- // Prints message to console window if we are in interactive mode
- PyErr_Print();
- continue;
- }
- mods.append(QSTRING(modules[i]));
- }
-
-# ifdef COMPLETE_USE_DRAFTING
- mods.append(QSTRING("DraftGui"));
- try {
+ // try to load dependent modules, currently not (AssemblyGui, CamGui)
+ char *modules[] = {"PartGui", "MeshGui", "MeshPartGui", "PointsGui", "DrawingGui", "RaytracingGui", "SketcherGui", "PartDesignGui", "ImageGui", "TestGui"};
+ size_t nModules = sizeof(modules) / sizeof(char*);
+ for (size_t i = 0; i < nModules; i++) {
+ try {
+ Base::Interpreter().loadModule(modules[i]);
+ }
+ catch (const Base::Exception& e) {
+ Base::Console().Error("%s\n", e.what());
+ // Prints message to console window if we are in interactive mode
+ PyErr_Print();
+ continue;
+ }
+ mods.append(QSTRING(modules[i]));
+ }
+
+# ifdef COMPLETE_USE_DRAFTING
+ mods.append(QSTRING("DraftGui"));
+ try {
Py::Module module(PyImport_ImportModule("FreeCADGui"),true);
Py::Callable method(module.getAttr(std::string("getWorkbench")));
@@ -128,15 +128,15 @@ PyMODINIT_FUNC initCompleteGui()
// Get the CompleteWorkbench handler
args.setItem(0,Py::String("CompleteWorkbench"));
}
- catch (const Base::Exception& e) {
- Base::Console().Error("%s\n", e.what());
- mods.removeAt(mods.size());
- // Prints message to console window if we are in interactive mode
- PyErr_Print();
- }
-# endif
+ catch (const Base::Exception& e) {
+ Base::Console().Error("%s\n", e.what());
+ mods.removeAt(mods.size());
+ // Prints message to console window if we are in interactive mode
+ PyErr_Print();
+ }
+# endif
- (void) CompleteGui::initModule();
+ PyObject* mod = CompleteGui::initModule();
Base::Console().Log("Loading GUI of Complete module... done\n");
// instantiating the commands
@@ -145,4 +145,6 @@ PyMODINIT_FUNC initCompleteGui()
// add resources and reloads the translators
loadCompleteResource();
+
+ PyMOD_Return(mod);
}
diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py
index ef7d8d958c..d3e58eb02c 100644
--- a/src/Mod/Draft/Draft.py
+++ b/src/Mod/Draft/Draft.py
@@ -217,6 +217,8 @@ def isClone(obj,objtype,recursive=False):
"""isClone(obj,objtype,[recursive]): returns True if the given object is
a clone of an object of the given type. If recursive is True, also check if
the clone is a clone of clone (of clone...) of the given type."""
+ if isinstance(objtype,list):
+ return any([isClone(obj,t,recursive) for t in objtype])
if getType(obj) == "Clone":
if len(obj.Objects) == 1:
if getType(obj.Objects[0]) == objtype:
@@ -331,14 +333,14 @@ def shapify(obj):
def getGroupContents(objectslist,walls=False,addgroups=False):
'''getGroupContents(objectlist,[walls,addgroups]): if any object of the given list
is a group, its content is appened to the list, which is returned. If walls is True,
- walls are also scanned for included windows. If addgroups is true, the group itself
- is also included in the list.'''
+ walls and structures are also scanned for included windows or rebars. If addgroups
+ is true, the group itself is also included in the list.'''
def getWindows(obj):
l = []
if getType(obj) in ["Wall","Structure"]:
for o in obj.OutList:
l.extend(getWindows(o))
- elif (getType(obj) == "Window") or isClone(obj,"Window"):
+ elif (getType(obj) in ["Window","Rebar"]) or isClone(obj,["Window","Rebar"]):
l.append(obj)
return l
diff --git a/src/Mod/Fem/App/AppFemPy.cpp b/src/Mod/Fem/App/AppFemPy.cpp
index 6a6314e4b7..8c87238ded 100644
--- a/src/Mod/Fem/App/AppFemPy.cpp
+++ b/src/Mod/Fem/App/AppFemPy.cpp
@@ -281,16 +281,13 @@ private:
std::string EncodedName = std::string(fileName);
PyMem_Free(fileName);
- if (!pcObj)
+ if (pcObj)
{
- App::DocumentObjectPy* objpy= static_cast(pcObj);
- App::DocumentObject* obj = objpy->getDocumentObjectPtr();
- if (!obj)
+ if (PyObject_TypeCheck(pcObj, &(App::DocumentObjectPy::Type)))
{
- App::Document* pcDoc = App::GetApplication().getActiveDocument();
- obj = pcDoc->getActiveObject();
+ App::DocumentObject* obj = static_cast(pcObj)->getDocumentObjectPtr();
+ FemVTKTools::writeResult(EncodedName.c_str(), obj);
}
- FemVTKTools::readFluidicResult(EncodedName.c_str(), obj);
}
else
FemVTKTools::writeResult(EncodedName.c_str());
diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt
index 4f22594a6a..f7fa2c5408 100755
--- a/src/Mod/Fem/App/CMakeLists.txt
+++ b/src/Mod/Fem/App/CMakeLists.txt
@@ -113,7 +113,9 @@ SET(FemScripts_SRCS
ccxFrdReader.py
convert2TetGen.py
importInpMesh.py
+ importVTKResults.py
importZ88Mesh.py
+ importZ88Results.py
Init.py
InitGui.py
FemAnalysis.py
@@ -139,7 +141,6 @@ SET(FemScripts_SRCS
FemMaterial.py
FemSelectionObserver.py
TestFem.py
- z88DispReader.py
TaskPanelFemBeamSection.ui
TaskPanelFemMeshGmsh.ui
TaskPanelFemMeshGroup.ui
diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt
index 3aa85c5053..7fe32b3cba 100755
--- a/src/Mod/Fem/CMakeLists.txt
+++ b/src/Mod/Fem/CMakeLists.txt
@@ -116,7 +116,7 @@ INSTALL(
# solver Z88
importZ88Mesh.py
- z88DispReader.py
+ importZ88Results.py
FemInputWriterZ88.py
FemToolsZ88.py
FemSolverZ88.py
@@ -124,6 +124,9 @@ INSTALL(
_ViewProviderFemSolverZ88.py
_CommandSolverZ88.py
+ # additional imports and exports
+ importVTKResults.py
+
DESTINATION
Mod/Fem
)
diff --git a/src/Mod/Fem/FemToolsZ88.py b/src/Mod/Fem/FemToolsZ88.py
index 6f68220325..5599a07cbb 100644
--- a/src/Mod/Fem/FemToolsZ88.py
+++ b/src/Mod/Fem/FemToolsZ88.py
@@ -190,11 +190,11 @@ class FemToolsZ88(FemTools.FemTools):
def load_results_o2(self):
import os
- import z88DispReader
+ import importZ88Results
disp_result_file = self.working_dir + '/z88o2.txt'
if os.path.isfile(disp_result_file):
result_name_prefix = 'Z88_' + self.solver.AnalysisType + '_'
- z88DispReader.import_z88_disp(disp_result_file, self.analysis, result_name_prefix)
+ importZ88Results.import_z88_disp(disp_result_file, self.analysis, result_name_prefix)
for m in self.analysis.Member:
if m.isDerivedFrom("Fem::FemResultObject"):
self.results_present = True
diff --git a/src/Mod/Fem/Init.py b/src/Mod/Fem/Init.py
index 865ebb09c5..0d775cbd16 100644
--- a/src/Mod/Fem/Init.py
+++ b/src/Mod/Fem/Init.py
@@ -30,13 +30,14 @@ import FreeCAD
FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
if("BUILD_FEM_VTK" in FreeCAD.__cmake__):
- FreeCAD.addImportType("FEM results (*.vtk *.vtp *.vts *.vtr *.vtu *.vti)", "Fem")
FreeCAD.addImportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")
FreeCAD.addExportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")
+ # FreeCAD.addImportType("FEM results (*.vtk *.vtp *.vts *.vtr *.vtu *.vti)", "importVTKResults") # not implemented yet
+ FreeCAD.addExportType("FEM CFD Result in VTK format (*.vtk *.vtu)", "importVTKResults")
FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
FreeCAD.addImportType("Mesh from Calculix/Abaqus input file (*.inp)", "importInpMesh")
FreeCAD.addImportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addExportType("Z88 mesh file (*.txt)", "importZ88Mesh")
-FreeCAD.addImportType("Z88 displacement result file (*.txt)", "z88DispReader")
+FreeCAD.addImportType("Z88 result file (*.txt)", "importZ88Results")
diff --git a/src/Mod/Fem/importVTKResults.py b/src/Mod/Fem/importVTKResults.py
new file mode 100644
index 0000000000..8193e5d6fa
--- /dev/null
+++ b/src/Mod/Fem/importVTKResults.py
@@ -0,0 +1,70 @@
+# ***************************************************************************
+# * (c) Qingfeng Xia 2017 *
+# * *
+# * This file is part of the FreeCAD CAx development system. *
+# * *
+# * This program is free software; you can redistribute it and/or modify *
+# * it under the terms of the GNU Lesser General Public License (LGPL) *
+# * as published by the Free Software Foundation; either version 2 of *
+# * the License, or (at your option) any later version. *
+# * for detail see the LICENCE text file. *
+# * *
+# * FreeCAD is distributed in the hope that it will be useful, *
+# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+# * GNU Lesser General Public License for more details. *
+# * *
+# * You should have received a copy of the GNU Library General Public *
+# * License along with FreeCAD; if not, write to the Free Software *
+# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
+# * USA *
+# * *
+# * Juergen Riegel 2002 *
+# ***************************************************************************/
+
+__title__ = "FreeCAD Result import and export VTK file library"
+__author__ = "Qingfeng Xia"
+__url__ = "http://www.freecadweb.org"
+
+## @package importVTKResults
+# \ingroup FEM
+
+import os
+import FreeCAD
+
+
+if open.__module__ == '__builtin__':
+ pyopen = open # because we'll redefine open below
+
+
+def insert(filename, docname):
+ "called when freecad wants to import a file"
+ try:
+ doc = FreeCAD.getDocument(docname)
+ except NameError:
+ doc = FreeCAD.newDocument(docname)
+ FreeCAD.ActiveDocument = doc
+ importFemResult(filename)
+
+
+def open(filename):
+ "called when freecad opens a file"
+ docname = os.path.splitext(os.path.basename(filename))[0]
+ insert(filename, docname)
+
+
+def importFemResult(filename):
+ FreeCAD.Console.PrintError("FemResult import is not implemented, actually not necessary\n")
+
+
+def export(objectslist, filename):
+ "called when freecad exports a fem result object"
+ if len(objectslist) != 1:
+ FreeCAD.Console.PrintError("This exporter can only export one object at once\n")
+ return
+ obj = objectslist[0]
+ if not obj.isDerivedFrom("Fem::FemResultObject"):
+ FreeCAD.Console.PrintError("object selcted is not FemResultObject.\n")
+ return
+ import Fem
+ Fem.writeResult(filename, obj)
diff --git a/src/Mod/Fem/z88DispReader.py b/src/Mod/Fem/importZ88Results.py
similarity index 97%
rename from src/Mod/Fem/z88DispReader.py
rename to src/Mod/Fem/importZ88Results.py
index 35e24a202d..592c20ab36 100644
--- a/src/Mod/Fem/z88DispReader.py
+++ b/src/Mod/Fem/importZ88Results.py
@@ -24,7 +24,7 @@ __title__ = "FreeCAD Z88 Disp Reader"
__author__ = "Bernd Hahnebach "
__url__ = "http://www.freecadweb.org"
-## @package z88DispReader
+## @package importZ88Results
# \ingroup FEM
import FreeCAD
@@ -57,6 +57,8 @@ def insert(filename, docname):
def import_z88_disp(filename, analysis=None, result_name_prefix=None):
'''insert a FreeCAD FEM Result object in the ActiveDocument
'''
+ if result_name_prefix is None:
+ result_name_prefix = ''
m = read_z88_disp(filename)
if(len(m['Nodes']) > 0):
if analysis is None:
@@ -141,9 +143,9 @@ def read_z88_disp(z88_disp_input):
pure usage:
import FemToolsZ88
fea = FemToolsZ88.FemToolsZ88()
- import z88dispReader
+ import importZ88Results
disp_file = '/pathtofile/z88o2.txt'
- z88DispReader.import_z88_disp(disp_file , fea.analysis)
+ importZ88Results.import_z88_disp(disp_file , fea.analysis)
The FreeCAD file needs to have an Analysis and an appropiate FEM Mesh
'''
diff --git a/src/Mod/Import/App/ImportOCAF.cpp b/src/Mod/Import/App/ImportOCAF.cpp
index 8e1ffe54e0..f4f57fa50d 100644
--- a/src/Mod/Import/App/ImportOCAF.cpp
+++ b/src/Mod/Import/App/ImportOCAF.cpp
@@ -64,17 +64,27 @@
# endif
#endif
-#include "ImportOCAF.h"
#include
#include
#include
#include
#include
#include
+#include "ImportOCAF.h"
#include
#include
#include
+#include
+#include
+
+#ifdef HAVE_TBB
+#include
+#include
+#include
+#endif
+
+
using namespace Import;
@@ -94,20 +104,29 @@ ImportOCAF::~ImportOCAF()
void ImportOCAF::loadShapes()
{
+ std::vector lValue;
myRefShapes.clear();
- loadShapes(pDoc->Main(), TopLoc_Location(), default_name, "", false);
+ loadShapes(pDoc->Main(), TopLoc_Location(), default_name, "", false, lValue);
}
void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
- const std::string& defaultname, const std::string& /*assembly*/, bool isRef)
+ const std::string& defaultname, const std::string& /*assembly*/, bool isRef,
+ std::vector& lValue)
{
int hash = 0;
+#ifdef HAVE_TBB
+ using namespace tbb;
+ task_group g;
+#endif
TopoDS_Shape aShape;
+
+ std::vector localValue;
+
if (aShapeTool->GetShape(label,aShape)) {
hash = aShape.HashCode(HashUpper);
}
- Handle(TDataStd_Name) name;
+ Handle_TDataStd_Name name;
std::string part_name = defaultname;
if (label.FindAttribute(TDataStd_Name::GetID(),name)) {
TCollection_ExtendedString extstr = name->Get();
@@ -132,7 +151,7 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
}
TopLoc_Location part_loc = loc;
- Handle(XCAFDoc_Location) hLoc;
+ Handle_XCAFDoc_Location hLoc;
if (label.FindAttribute(XCAFDoc_Location::GetID(), hLoc)) {
if (isRef)
part_loc = part_loc * hLoc->Get();
@@ -167,7 +186,7 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
TDF_Label ref;
if (aShapeTool->IsReference(label) && aShapeTool->GetReferredShape(label, ref)) {
- loadShapes(ref, part_loc, part_name, asm_name, true);
+ loadShapes(ref, part_loc, part_name, asm_name, true, lValue);
}
if (isRef || myRefShapes.find(hash) == myRefShapes.end()) {
@@ -179,34 +198,57 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
if (!asm_name.empty())
part_name = asm_name;
if (isRef)
- createShape(label, loc, part_name);
+ createShape(label, loc, part_name, lValue);
else
- createShape(label, part_loc, part_name);
+ createShape(label, part_loc, part_name, localValue);
}
else {
+ // This is probably an Assembly let's try to create a Compound with the name
+ Part::Compound *pcCompound = NULL;
+ if (aShapeTool->IsAssembly(label)) {
+ pcCompound = static_cast(doc->addObject
+ ("Part::Compound",asm_name.c_str()));
+ }
+
for (TDF_ChildIterator it(label); it.More(); it.Next()) {
- loadShapes(it.Value(), part_loc, part_name, asm_name, isRef);
+ loadShapes(it.Value(), part_loc, part_name, asm_name, isRef, localValue);
+ }
+
+ if (pcCompound) {
+ pcCompound->Links.setValues(localValue);
+ lValue.push_back(pcCompound);
+ Node_Shapes.push_back(pcCompound->getNameInDocument());
}
}
}
}
-void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc, const std::string& name)
+void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc, const std::string& name,
+ std::vector& lValue)
{
const TopoDS_Shape& aShape = aShapeTool->GetShape(label);
- std::vector lValue;
+#ifdef HAVE_TBB
+ using namespace tbb;
+ task_group g;
+#endif
if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND) {
TopExp_Explorer xp;
int ctSolids = 0, ctShells = 0;
+ std::vector localValue;
Part::Compound *pcCompound = static_cast(doc->addObject
("Part::Compound",name.c_str() ));
- for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++)
- createShape(xp.Current(), loc, name, lValue);
- for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++)
- createShape(xp.Current(), loc, name, lValue);
- pcCompound->Links.setValues(lValue);
+ for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++) {
+ createShape(xp.Current(), loc, name, localValue);
+ }
+ for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++) {
+ createShape(xp.Current(), loc, name, localValue);
+ }
+
+ pcCompound->Links.setValues(localValue);
+ lValue.push_back(pcCompound);
+ Node_Shapes.push_back(pcCompound->getNameInDocument());
if (ctSolids > 0 || ctShells > 0)
return;
}
@@ -223,6 +265,7 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
else
part->Shape.setValue(aShape);
part->Label.setValue(name);
+ Leaf_Shapes.push_back(part->getNameInDocument());
lvalue.push_back(part);
Quantity_Color aColor;
diff --git a/src/Mod/Import/App/ImportOCAF.h b/src/Mod/Import/App/ImportOCAF.h
index dbf077d90e..7d145882fe 100644
--- a/src/Mod/Import/App/ImportOCAF.h
+++ b/src/Mod/Import/App/ImportOCAF.h
@@ -35,6 +35,8 @@
#include