Export single STEP object with absolute coordinate instead of (0,0,0) as default origin
This commit is contained in:
committed by
Yorik van Havre
parent
dc84141477
commit
1220eb00b4
@@ -438,7 +438,8 @@ private:
|
||||
}
|
||||
int export_app_object(App::DocumentObject* obj, Import::ExportOCAF ocaf,
|
||||
std::vector <TDF_Label>& hierarchical_label,
|
||||
std::vector <TopLoc_Location>& hierarchical_loc)
|
||||
std::vector <TopLoc_Location>& hierarchical_loc,
|
||||
std::vector <App::DocumentObject*>& hierarchical_part)
|
||||
{
|
||||
std::vector <int> local_label;
|
||||
int root_id;
|
||||
@@ -453,11 +454,11 @@ private:
|
||||
|
||||
for ( it = entries.begin(); it != entries.end(); it++ ) {
|
||||
int new_label=0;
|
||||
new_label=export_app_object((*it),ocaf,hierarchical_label,hierarchical_loc);
|
||||
new_label=export_app_object((*it),ocaf,hierarchical_label,hierarchical_loc, hierarchical_part);
|
||||
local_label.push_back(new_label);
|
||||
}
|
||||
|
||||
ocaf.createNode(part,root_id,hierarchical_label,hierarchical_loc);
|
||||
ocaf.createNode(part,root_id,hierarchical_label,hierarchical_loc, hierarchical_part);
|
||||
std::vector<int>::iterator label_it;
|
||||
for (label_it = local_label.begin(); label_it != local_label.end(); ++label_it) {
|
||||
ocaf.pushNode(root_id,(*label_it), hierarchical_label,hierarchical_loc);
|
||||
@@ -476,7 +477,7 @@ private:
|
||||
colors.push_back(static_cast<PartGui::ViewProviderPart*>(vp)->ShapeColor.getValue());
|
||||
}
|
||||
|
||||
return_label=ocaf.saveShape(part, colors,hierarchical_label,hierarchical_loc);
|
||||
return_label=ocaf.saveShape(part, colors,hierarchical_label,hierarchical_loc,hierarchical_part);
|
||||
}
|
||||
|
||||
return(return_label);
|
||||
@@ -504,17 +505,21 @@ private:
|
||||
Import::ExportOCAF ocaf(hDoc, keepExplicitPlacement);
|
||||
|
||||
// That stuff is exporting a list of selected oject into FreeCAD Tree
|
||||
std::vector <TDF_Label> hierarchical_label;
|
||||
std::vector <TopLoc_Location> hierarchical_loc;
|
||||
std::vector <App::DocumentObject*> hierarchical_part;
|
||||
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
PyObject* item = (*it).ptr();
|
||||
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
|
||||
std::vector <TDF_Label> hierarchical_label;
|
||||
std::vector <TopLoc_Location> hierarchical_loc;
|
||||
export_app_object(obj,ocaf, hierarchical_label, hierarchical_loc);
|
||||
export_app_object(obj,ocaf, hierarchical_label, hierarchical_loc,hierarchical_part);
|
||||
}
|
||||
}
|
||||
|
||||
// Free Shapes must have absolute placement and not explicit
|
||||
ocaf.reallocateFreeShape(hierarchical_label, hierarchical_loc,hierarchical_part);
|
||||
|
||||
Base::FileInfo file(Utf8Name.c_str());
|
||||
if (file.hasExtension("stp") || file.hasExtension("step")) {
|
||||
//Interface_Static::SetCVal("write.step.schema", "AP214IS");
|
||||
@@ -524,10 +529,12 @@ private:
|
||||
optionScheme_214 = hGrp_stp->GetBool("Scheme_214",true);
|
||||
optionScheme_203 = hGrp_stp->GetBool("Scheme_203",false);
|
||||
if (optionScheme_214)
|
||||
Interface_Static::SetCVal("write.step.schema", "AP214CD");
|
||||
Interface_Static::SetCVal("write.step.schema", "AP214IS");
|
||||
if (optionScheme_203)
|
||||
Interface_Static::SetCVal("write.step.schema", "AP203");
|
||||
STEPCAFControl_Writer writer;
|
||||
Interface_Static::SetIVal("write.step.assembly",1);
|
||||
// writer.SetColorMode(Standard_False);
|
||||
writer.Transfer(hDoc, STEPControl_AsIs);
|
||||
|
||||
// edit STEP header
|
||||
|
||||
Reference in New Issue
Block a user