${PROJECT_SOURCE_DIR}/src/GeomDataAPI
${PROJECT_SOURCE_DIR}/src/ModelAPI
${PROJECT_SOURCE_DIR}/src/PartSetPlugin
- ${PROJECT_SOURCE_DIR}/src/SketchPlugin
${CAS_INCLUDE_DIRS}
)
#include <PartSetPlugin_Part.h>
-#include <SketchPlugin_SketchEntity.h>
-
#include <OSD_OpenFile.hxx>
#include <fstream>
FeaturePtr aFeature = theComposite->subFeature(anIndex);
if (isDumped(aFeature))
continue;
- bool isForce = true;
- // check the feature is a sketch entity and a copy of another entity
- std::shared_ptr<SketchPlugin_SketchEntity> aSketchEntity =
- std::dynamic_pointer_cast<SketchPlugin_SketchEntity>(aFeature);
- if (aSketchEntity && aSketchEntity->isCopy())
- isForce = false;
- dumpFeature(aFeature, isForce);
+ dumpFeature(aFeature, true);
}
- // dump empty line for appearance
- myDumpBuffer << std::endl;
return true;
}
theDumper.process(aCompFeat);
}
+ // avoid multiple empty lines
+ size_t anInd = std::string::npos;
+ while ((anInd = aBufCopy.find("\n\n\n")) != std::string::npos)
+ aBufCopy.erase(anInd, 1);
// then store currently dumped string
theDumper.myFullDump << aBufCopy;
bool process(const std::shared_ptr<ModelAPI_Document>& theDoc);
/// Iterate all features in composite feature and dump them into intermediate buffer
+ MODELHIGHAPI_EXPORT
bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite);
/// Check the entity is already dumped
protected:
std::set<EntityPtr> myNotDumpedEntities; ///< list of entities, used by other features but not dumped yet
+
+ friend class SketchAPI_Sketch;
};
#endif
//==================================================================================================
void SketchAPI_Arc::dump(ModelHighAPI_Dumper& theDumper) const
{
+ if (isCopy())
+ return; // no need to dump copied feature
+
FeaturePtr aBase = feature();
const std::string& aSketchName = theDumper.parentName(aBase);
//==================================================================================================
void SketchAPI_Circle::dump(ModelHighAPI_Dumper& theDumper) const
{
+ if (isCopy())
+ return; // no need to dump copied feature
+
FeaturePtr aBase = feature();
const std::string& aSketchName = theDumper.parentName(aBase);
void SketchAPI_Line::dump(ModelHighAPI_Dumper& theDumper) const
{
+ if (isCopy())
+ return; // no need to dump copied feature
+
FeaturePtr aBase = feature();
const std::string& aSketchName = theDumper.parentName(aBase);
void SketchAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
{
+ if (isCopy())
+ return; // no need to dump copied feature
+
FeaturePtr aBase = feature();
const std::string& aSketchName = theDumper.parentName(aBase);
<< ", model.defaultPlane(\"" << aPlaneName << "\"))" << std::endl;
}
}
+
+ // dump sketch's subfeatures
+ CompositeFeaturePtr aCompFeat = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aBase);
+ theDumper.process(aCompFeat);
+ // necessary to be sure that the result of sketch was built
+ theDumper << "model.do()" << std::endl;
}
theDumper << aName << ".setAuxiliary(" << anAux << ")" <<std::endl;
}
}
+
+bool SketchAPI_SketchEntity::isCopy() const
+{
+ // check the feature is a copy of another entity
+ std::shared_ptr<SketchPlugin_SketchEntity> aSketchEntity =
+ std::dynamic_pointer_cast<SketchPlugin_SketchEntity>(feature());
+ return aSketchEntity && aSketchEntity->isCopy();
+}
std::shared_ptr<ModelAPI_AttributeBoolean> myAuxiliary;
bool initialize();
+
+ /// Check the entity is a copy of another feature
+ bool isCopy() const;
};
//! Pointer on SketchEntity object