aBase->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED());
theDumper<<","<< aShapeSelected;
-
+
theDumper <<","<< stlabsolute() <<","<< stlrelative();
if (stldeflectionType()->value() == ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE()) {
else {
theDumper <<","<< "False";
}
-
+
if (stlfileType()->value() == ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY()) {
theDumper << "False";
}
ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
const std::string & theFilePath,
const ModelHighAPI_Selection& theSelectedShape,
- double aDeflectionRelative,
- double aDeflectionAbsolute,
- const bool anIsRelative,
- const bool anIsASCII)
+ double theDeflectionRelative,
+ double theDeflectionAbsolute,
+ const bool theIsRelative,
+ const bool theIsASCII)
{
apply(); // finish previous operation to make sure all previous operations are done
std::shared_ptr<ModelAPI_Feature> aFeature =
return ExportPtr(new ExchangeAPI_Export(aFeature,
theFilePath,
theSelectedShape,
- aDeflectionRelative,
- aDeflectionAbsolute,
- anIsRelative,
- anIsASCII));
+ theDeflectionRelative,
+ theDeflectionAbsolute,
+ theIsRelative,
+ theIsASCII));
}
ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::string & theFilePath,
const ModelHighAPI_Selection& theSelectedShape,
- double aDeflectionRelative ,
- double aDeflectionAbsolute,
- const bool anIsRelative,
- const bool anIsASCII);
+ double theDeflectionRelative ,
+ double theDeflectionAbsolute,
+ const bool theIsRelative,
+ const bool theIsASCII);
/// Constructor with values for XAO of selected result export.
EXCHANGEAPI_EXPORT
explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::string & theFilePath,
- const ModelHighAPI_Selection& theResult,
- const std::string & theAuthor,
- const std::string & theGeometryName = std::string());
+ const std::string & theFilePath,
+ const ModelHighAPI_Selection& theResult,
+ const std::string & theAuthor,
+ const std::string & theGeometryName = std::string());
/// Constructor with values for export in other formats than XAO.
EXCHANGEAPI_EXPORT
*/
EXCHANGEAPI_EXPORT
ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
- const std::string & theFilePath,
- const std::list<ModelHighAPI_Selection> & theSelectionList,
- const std::string & theFileFormat = std::string());
+ const std::string & theFilePath,
+ const std::list<ModelHighAPI_Selection> & theSelectionList,
+ const std::string & theFileFormat = std::string());
/**\ingroup CPPHighAPI
* \brief Exports to XAO file all results of the current document
*/
EXCHANGEAPI_EXPORT
ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
- const std::string & theFilePath,
- const std::string & theAuthor = std::string(),
- const std::string & theGeometryName = std::string());
+ const std::string & theFilePath,
+ const std::string & theAuthor = std::string(),
+ const std::string & theGeometryName = std::string());
/**\ingroup CPPHighAPI
* \brief Exports to STL file the result of the current document
*/
EXCHANGEAPI_EXPORT
ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
- const std::string & theFilePath,
- const ModelHighAPI_Selection& theSelectedShape,
- double aDeflectionRelative,
- double aDeflectionAbsolute,
- const bool anIsRelative,
- const bool anIsASCII);
+ const std::string & theFilePath,
+ const ModelHighAPI_Selection& theSelectedShape,
+ double theDeflectionRelative,
+ double theDeflectionAbsolute,
+ const bool theIsRelative,
+ const bool theIsASCII);
/**\ingroup CPPHighAPI
* \brief Exports to XAO file the selected result with groups parts related to it only.
ModelAPI_AttributeSelectionList::typeId());
data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(),
ModelAPI_AttributeString::typeId());
- data()->addAttribute(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(),
+ data()->addAttribute(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(),
ModelAPI_AttributeSelection::typeId());
data()->addAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(),
ModelAPI_AttributeString::typeId());
- data()->addAttribute(ExchangePlugin_ExportFeature::STL_RELATIVE(),
+ data()->addAttribute(ExchangePlugin_ExportFeature::STL_RELATIVE(),
ModelAPI_AttributeDouble::typeId());
double defelection = Config_PropManager::real("Visualization", "body_deflection");
real(ExchangePlugin_ExportFeature::STL_RELATIVE())->setValue(defelection);
- data()->addAttribute(ExchangePlugin_ExportFeature::STL_ABSOLUTE(),
+ data()->addAttribute(ExchangePlugin_ExportFeature::STL_ABSOLUTE(),
ModelAPI_AttributeDouble::typeId());
data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE(),
ModelAPI_AttributeString::typeId());
if (string(STL_FILE_TYPE())->value() == STL_FILE_TYPE_ASCII()) {
anIsASCII = true;
- }
+ }
// Perform the export
std::string anError;
bool aResult = false;
aResult = STLExport(theFileName,
- "STL",
aShape,
aValue,
- anIsRelative,
+ anIsRelative,
anIsASCII,
anError);
<shape_selector id="stl_object_selected"
label="Object"
tooltip="Object to export."
- shape_types="vertices edges wires faces shells solids compsolids compounds">
+ shape_types="faces shells solids compsolids compounds">
<validator id="GeomValidators_Finite"/>
</shape_selector>
<groupbox title="Deflection">
tooltip="Value indicate by user">
<doublevalue id="stl_absolute"
tooltip="Absolute value."
- min="0.0"
- max="1.0"
+ min="1e-12"
step="0.1"
default="0.5">
</doublevalue>
</radio>
</radiobox>
</groupbox >
- <!--stringvalue id="xao_author"
- label="Author"
- placeholder="Please input the author">
- </stringvalue>
- <stringvalue id="xao_geometry_name"
- label="Geometry name"
- placeholder="Please input the geometry name">
- </stringvalue-->
</case>
</switch>
</source>
#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X, Y) , Z ) )
bool STLExport(const std::string& theFileName,
- const std::string& /*theFormatName*/,
- const std::shared_ptr<GeomAPI_Shape>& theShape,
- const double aDeflection,
- const bool anIsRelative,
- const bool anIsASCII,
- std::string& theError)
+ const std::shared_ptr<GeomAPI_Shape>& theShape,
+ const double theDeflection,
+ const bool theIsRelative,
+ const bool theIsASCII,
+ std::string& theError)
{
#ifdef _DEBUG
std::cout << "Export STl into file " << theFileName << std::endl;
try
{
- // Set "C" numeric locale to save numbers correctly
- GeomAlgoAPI_Tools::Localizer loc;
- double lDeflection = aDeflection;
+ double lDeflection = theDeflection;
StlAPI_Writer aWriter;
// copy source shape
BRepBuilderAPI_Copy aCopy( theShape->impl<TopoDS_Shape>(), Standard_False );
TopoDS_Shape aCopyShape = aCopy.Shape();
// ASCII mode
- aWriter.ASCIIMode() = anIsASCII;
- if ( anIsRelative ) {
+ aWriter.ASCIIMode() = theIsASCII;
+ if ( theIsRelative ) {
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
Bnd_Box bndBox;
BRepBndLib::Add( theShape->impl<TopoDS_Shape>(), bndBox );
bndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
- lDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * aDeflection;
+ lDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * theDeflection;
}
//Compute triangulation
- BRepTools::Clean( aCopyShape );
BRepMesh_IncrementalMesh aMesh( aCopyShape, lDeflection );
aWriter.Write( aCopyShape, theFileName.c_str() );
/// Implementation of the export STL files algorithms
GEOMALGOAPI_EXPORT
bool STLExport(const std::string& theFileName,
- const std::string& /*theFormatName*/,
- const std::shared_ptr<GeomAPI_Shape>& theShape,
- const double aDeflection,
- const bool anIsRelative,
- const bool anIsASCII,
- std::string& theError);
+ const std::shared_ptr<GeomAPI_Shape>& theShape,
+ const double theDeflection,
+ const bool theIsRelative,
+ const bool theIsASCII,
+ std::string& theError);
#endif /* GEOMALGOAPI_STLEXPORT_H_ */