import SHAPERSTUDY_ORB
import SHAPERSTUDY_utils
+import time
+
## @ingroup Plugins
# Feature to export all shapes and groups into the GEOM module
class PublishToStudyFeature(ModelAPI.ModelAPI_Feature):
## Exports all shapes and groups into the GEOM module.
def execute(self):
+ print("PublishToStudy execute start")
+ t0=time.time()
aSession = ModelAPI.ModelAPI_Session.get()
aPartSet = aSession.moduleDocument()
# check that the PartSet document current feature is the last to avoid problems with all
aDeadGroupEntry = "dead0" + str(anIndex) + "_" + aGroup.GetEntry()
aGroup.SetEntry(aDeadGroupEntry)
+ t1=time.time()
+ print("PublishToStudy execute took %.3f s"%(t1-t0))
+
# Part of the "execute" method: processes the Groups of theRes result publication.
# If theFields is true, the same is performed for Fields.
def processGroups(self, theRes, theEngine, thePartFeatureId, theStudyShape, theFields):
else:
allRefGroups.append(ModelAPI.referencedFeatures(theRes, "Group", True))
allRefGroups.append(ModelAPI.referencedFeatures(theRes, "Shared_faces", True))
+
for aRefGroups in allRefGroups:
for aRef in aRefGroups:
aGroupIndices = []
for aGroupRes in aRef.results():
aShape = aGroupRes.shape()
anExplorer = GeomAPI_ShapeExplorer(aShape, aSelType)
+
+ print("loop on GeomAlgoAPI_CompoundBuilder::id start for group", aGroupRes.data().name())
+ t1=time.time()
while anExplorer.more():
anId = GeomAlgoAPI.GeomAlgoAPI_CompoundBuilder.id(aResShape, anExplorer.current())
if anId > 0 and not anId in aGroupHasIndex:
aGroupIndices.append(anId)
aGroupHasIndex[anId] = 0
anExplorer.next()
+ t2=time.time()
+ print("loop on GeomAlgoAPI_CompoundBuilder::id took %.3f s"%(t2-t1))
if len(aGroupIndices): # create group
aGroupFeatureId = aRef.data().featureId()
if theFields:
const std::list<ModelHighAPI_Selection> & theSelectionList,
const std::string & theFileFormat)
{
+ std::cout << "exportToFile " << theFileFormat << std::endl;
apply(); // finish previous operation to make sure all previous operations are done
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
const std::string & theAuthor,
const std::string & theGeometryName)
{
+ std::cout << "exportToXAO " << std::endl;
apply(); // finish previous operation to make sure all previous operations are done
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
const std::string & /*theAuthor*/,
const std::string & /*theGeometryName*/)
{
+ std::cout << "exportToXAO with selected shape" << std::endl;
apply(); // finish previous operation to make sure all previous operations are done
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
const std::string & theAuthor,
const std::string & theGeometryName)
{
+ std::cout << "exportToXAOMem with selected shape" << std::endl;
apply(); // finish previous operation to make sure all previous operations are done
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
#include <XAO_Geometry.hxx>
#include <ExchangePlugin_Tools.h>
+#include <chrono>
+#include <iostream>
ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature()
{
}
}
+ std::string msg;
+ if (isMemoryExport)
+ msg = "to memory";
+ else
+ msg = "to file";
+ std::cout << "ExchangePlugin_ExportFeature::exportFile " << aFormatName << " " << msg << std::endl;
+
if (aFormatName == "XAO") {
exportXAO(theFileName, isMemoryExport);
return;
void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName,
const bool isMemoryExport)
{
+ std::cout << "ExchangePlugin_ExportFeature::exportXAO start" << std::endl;
+ std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
+
try {
std::string anError;
if (aDocuments.empty())
aDocuments.push_back(document());
std::list<DocumentPtr>::iterator aDoc = aDocuments.begin();
- for(; aDoc != aDocuments.end(); aDoc++) {
+ int i=0;
+ for(; aDoc != aDocuments.end(); aDoc++, i++) {
// groups
int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group());
for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) {
XAO::Group* aXaoGroup = aXao.addGroup(aGroupDimension,
Locale::Convert::toString(aResultGroup->data()->name()));
+ std::cout << "loop on GeomAlgoAPI_CompoundBuilder::id start for doc " << i ;
+ std::cout << " and group " << Locale::Convert::toString(aResultGroup->data()->name()) << std::endl;
+ std::chrono::steady_clock::time_point start2 = std::chrono::steady_clock::now();
+
try {
GeomAPI_ShapeExplorer aGroupResExplorer(aResultGroup->shape(), aSelType);
for(; aGroupResExplorer.more(); aGroupResExplorer.next()) {
aXao.removeGroup(aXaoGroup);
// LCOV_EXCL_STOP
}
+
+ std::chrono::steady_clock::time_point end2 = std::chrono::steady_clock::now();
+ std::cout << "loop on GeomAlgoAPI_CompoundBuilder::id took "
+ << std::chrono::duration_cast<std::chrono::microseconds>(end2 - start2).count()*1e-6 << " seconds" << std::endl;
}
// fields
return;
}
// LCOV_EXCL_STOP
+
+ std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
+ std::cout << "ExchangePlugin_ExportFeature::exportXAO took "
+ << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count()*1e-6 << " seconds" << std::endl;
}
bool ExchangePlugin_ExportFeature::isMacro() const
#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAlgoAPI_SortListOfShapes.h>
#include <Config_PropManager.h>
+#include <chrono>
// DEB
//#include <TCollection_AsciiString.hxx>
//#define DEB_IMPORT 1
const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
const std::string& theName)
{
+// std::cout << "Model_BodyBuilder::loadModifiedShapes start" << std::endl;
+// std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
GeomShapePtr aResultShape = shape();
GeomShapePtr aShapeToExplore = theOldShape;
if (theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore)) {
storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label());
}
}
+// std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
+// std::cout << "Model_BodyBuilder::loadModifiedShapes took "
+// << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count()*1e-6 << " seconds" << std::endl;
}
void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
#include <sstream>
#include <vector>
#include <array>
+#include <chrono>
#define RECURSE_TOP_LEVEL 50
const GeomShapePtr theResultShape,
const std::string& theNamePrefix)
{
+ std::cout << "ModelAPI_Tools::loadModifiedShapes start" << std::endl;
+ std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape);
ListOfShape aShapes = theBaseShapes;
theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE, theNamePrefix);
theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE, theNamePrefix);
}
+ std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
+ std::cout << "ModelAPI_Tools::loadModifiedShapes took "
+ << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count()*1e-6 << " seconds" << std::endl;
}
//==================================================================================================