Improve hierarchical exporter
This commit is contained in:
committed by
Yorik van Havre
parent
a83d71c7c8
commit
ef4efc52e5
@@ -221,6 +221,7 @@ private:
|
||||
hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc);
|
||||
|
||||
bool keepExplicitPlacement = list.size() > 1;
|
||||
|
||||
Import::ExportOCAF ocaf(hDoc, keepExplicitPlacement);
|
||||
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
@@ -230,7 +231,9 @@ private:
|
||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
Part::Feature* part = static_cast<Part::Feature*>(obj);
|
||||
std::vector<App::Color> colors;
|
||||
ocaf.saveShape(part, colors);
|
||||
std::vector <TDF_Label> hierarchical_label;
|
||||
std::vector <TopLoc_Location> hierarchical_loc;
|
||||
ocaf.saveShape(part, colors, hierarchical_label, hierarchical_loc);
|
||||
}
|
||||
else {
|
||||
Base::Console().Message("'%s' is not a shape, export will be ignored.\n", obj->Label.getValue());
|
||||
@@ -246,7 +249,9 @@ private:
|
||||
Part::Feature* part = static_cast<Part::Feature*>(obj);
|
||||
App::PropertyColorList colors;
|
||||
colors.setPyObject(item1.ptr());
|
||||
ocaf.saveShape(part, colors.getValues());
|
||||
std::vector <TDF_Label> hierarchical_label;
|
||||
std::vector <TopLoc_Location> hierarchical_loc;
|
||||
ocaf.saveShape(part, colors.getValues(), hierarchical_label, hierarchical_loc);
|
||||
}
|
||||
else {
|
||||
Base::Console().Message("'%s' is not a shape, export will be ignored.\n", obj->Label.getValue());
|
||||
|
||||
@@ -530,7 +530,7 @@ int ExportOCAF::saveShape(Part::Feature* part, const std::vector<App::Color>& co
|
||||
{
|
||||
const TopoDS_Shape& shape = part->Shape.getValue();
|
||||
if (shape.IsNull())
|
||||
return;
|
||||
return -1;
|
||||
|
||||
TopoDS_Shape baseShape;
|
||||
TopLoc_Location aLoc;
|
||||
@@ -560,11 +560,11 @@ int ExportOCAF::saveShape(Part::Feature* part, const std::vector<App::Color>& co
|
||||
aShapeTool->SetShape(shapeLabel, baseShape);
|
||||
|
||||
TDataStd_Name::Set(shapeLabel, TCollection_ExtendedString(part->Label.getValue(), 1));
|
||||
|
||||
/*
|
||||
if (keepExplicitPlacement) {
|
||||
aShapeTool->AddComponent(rootLabel, shapeLabel, aLoc);
|
||||
}
|
||||
|
||||
*/
|
||||
// Add color information
|
||||
Quantity_Color col;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user