%feature("kwargs") addCommon;
%feature("kwargs") addCut;
%feature("kwargs") addFillet;
-%feature("kwargs") addFilletMultiRadiusBypoint;
-%feature("kwargs") addFilletMultiRadiusByCurv;
%feature("kwargs") addFuse;
%feature("kwargs") addIntersection;
%feature("kwargs") addMultiRotation;
INCLUDE(Common)
INCLUDE(UnitTest)
-INCLUDE(UseQtExt)
-
-# additional include directories
-INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
- ${PROJECT_SOURCE_DIR}/src/Locale
- ${QT_INCLUDES})
-
-# additional preprocessor / compiler flags
-ADD_DEFINITIONS(${QT_DEFINITIONS})
-
SET(PROJECT_HEADERS
FeaturesPlugin.h
FeaturesPlugin_ImportResult.h
FeaturesPlugin_Defeaturing.h
FeaturesPlugin_VersionedChFi.h
- FeaturesPlugin_WidgetCreator.h
- FeaturesPlugin_WidgetFilletMultiRadiuses.h
-)
-
-SET(PROJECT_MOC_HEADERS
- FeaturesPlugin_WidgetFilletMultiRadiuses.h
)
SET(PROJECT_SOURCES
FeaturesPlugin_ImportResult.cpp
FeaturesPlugin_Defeaturing.cpp
FeaturesPlugin_VersionedChFi.cpp
- FeaturesPlugin_WidgetCreator.cpp
- FeaturesPlugin_WidgetFilletMultiRadiuses.cpp
)
SET(XML_RESOURCES
FeaturesPlugin_msg_ru.ts
)
-# sources / moc wrappings
-QT_WRAP_MOC(PROJECT_AUTOMOC ${PROJECT_MOC_HEADERS})
-
-#QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES})
-
-SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES})
SOURCE_GROUP ("XML Files" FILES ${XML_RESOURCES})
SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
../GeomAPI
../GeomAlgoAPI
../GeomValidators
- ../ModuleBase
../Events
../Config
${OpenCASCADE_INCLUDE_DIR}
)
ADD_DEFINITIONS(-DFEATURESPLUGIN_EXPORTS)
-ADD_LIBRARY(FeaturesPlugin MODULE
- ${PROJECT_SOURCES}
- ${PROJECT_HEADERS}
- ${XML_RESOURCES}
- ${TEXT_RESOURCES}
- ${PROJECT_AUTOMOC})
+ADD_LIBRARY(FeaturesPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES} ${TEXT_RESOURCES})
TARGET_LINK_LIBRARIES(FeaturesPlugin ${PROJECT_LIBRARIES})
INSTALL(TARGETS FeaturesPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
TestFillet1D_Wire_3.py
TestFillet1D_Wire_4.py
TestFillet1D_Wire_5.py
+ Test19931.py
+ Test20027.py
)
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
-#include <ModelAPI_AttributeDoubleArray.h>
-#include <ModelAPI_AttributeTables.h>
-
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_ShapeExplorer.h>
-#include <GeomAPI_Pnt.h>
-#include <GeomAPI_Edge.h>
-
-#include <GeomDataAPI_Point.h>
-#include <iostream>
-#include <Locale_Convert.h>
-#include <GeomAlgoAPI_PointBuilder.h>
-#include <GeomAPI_Vertex.h>
-#include <math.h>
-
// Extract edges from the list
static ListOfShape extractEdges(const ListOfShape& theShapes)
void FeaturesPlugin_Fillet::initAttributes()
{
data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(CREATION_METHOD_MULTIPLES_RADIUSES(), ModelAPI_AttributeString::typeId());
-
AttributePtr aSelectionList =
data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
data()->addAttribute(START_RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(END_RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(VALUES_ID(), ModelAPI_AttributeTables::typeId());
- data()->addAttribute(VALUES_CURV_ID(), ModelAPI_AttributeTables::typeId());
- data()->addAttribute(EDGE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId());
-
- data()->addAttribute(ARRAY_POINT_RADIUS_BY_POINTS(), ModelAPI_AttributeSelectionList::typeId());
-
- data()->addAttribute(CREATION_METHOD_BY_POINTS(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(CREATION_METHOD_BY_CURVILEAR_ABSCISSA(), ModelAPI_AttributeString::typeId());
-
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), END_RADIUS_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ARRAY_POINT_RADIUS_BY_POINTS());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VALUES_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VALUES_CURV_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATION_METHOD_MULTIPLES_RADIUSES());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATION_METHOD_BY_CURVILEAR_ABSCISSA());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATION_METHOD_BY_POINTS());
initVersion(aSelectionList);
}
return attribute(OBJECT_LIST_ID());
}
-void FeaturesPlugin_Fillet::attributeChanged(const std::string& theID)
-{
- if (theID == EDGE_SELECTED_ID()
- && string(CREATION_METHOD())->value() == CREATION_METHOD_MULTIPLES_RADIUSES()) {
-
- AttributeSelectionPtr anEdges =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(attribute(EDGE_SELECTED_ID()));
- AttributeSelectionListPtr array = selectionList(OBJECT_LIST_ID());
- if(array->isInitialized())
- array->clear();
- array->append(anEdges->namingName() );
- }
-}
-
const std::string& FeaturesPlugin_Fillet::modifiedShapePrefix() const
{
static const std::string& THE_PREFIX("Fillet");
const ListOfShape& theEdges)
{
AttributeStringPtr aCreationMethod = string(CREATION_METHOD());
- std::string anError;
-
- if (!aCreationMethod){
- setError(anError);
+ if (!aCreationMethod)
return GeomMakeShapePtr();
+
+ bool isFixedRadius = aCreationMethod->value() == CREATION_METHOD_SINGLE_RADIUS();
+ double aRadius1 = 0.0, aRadius2 = 0.0;
+ if (isFixedRadius)
+ aRadius1 = real(RADIUS_ID())->value();
+ else {
+ aRadius1 = real(START_RADIUS_ID())->value();
+ aRadius2 = real(END_RADIUS_ID())->value();
}
-
+
+ // Perform fillet operation
std::shared_ptr<GeomAlgoAPI_Fillet> aFilletBuilder;
-
- ListOfShape aFilletEdges = extractEdges(theEdges);
+ std::string anError;
- std::cout << "coucou aCreationMethod->value() = " << aCreationMethod->value()<< std::endl;
- if ( aCreationMethod->value() == CREATION_METHOD_MULTIPLES_RADIUSES() )
- {
-
- std::list<double> coodCurv;
- std::list<double> radiuses;
- AttributeTablesPtr aTablesAttr;
-
- if( string(CREATION_METHOD_MULTIPLES_RADIUSES())->value() == CREATION_METHOD_BY_POINTS() )
- {
- aTablesAttr = tables(VALUES_ID());
-
- }else{
- aTablesAttr = tables(VALUES_CURV_ID());
- }
-
- int aRows = aTablesAttr->rows();
- ModelAPI_AttributeTables::Value aVal;
- for (int k = 0; k < aRows; k++) {
- aVal = aTablesAttr->value(k, 0);
- coodCurv.push_back(aVal.myDouble);
- aVal = aTablesAttr->value(k, 1);
- radiuses.push_back(aVal.myDouble);
- }
-
- aFilletBuilder.reset(new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, coodCurv,radiuses));
-
- }else
- {
- bool isFixedRadius = aCreationMethod->value() == CREATION_METHOD_SINGLE_RADIUS();
- double aRadius1 = 0.0, aRadius2 = 0.0;
- if (isFixedRadius)
- aRadius1 = real(RADIUS_ID())->value();
- else {
- aRadius1 = real(START_RADIUS_ID())->value();
- aRadius2 = real(END_RADIUS_ID())->value();
- }
-
- if (isFixedRadius)
- aFilletBuilder.reset(new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1));
- else
- aFilletBuilder.reset(new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1, aRadius2));
- }
+ ListOfShape aFilletEdges = extractEdges(theEdges);
+ if (isFixedRadius)
+ aFilletBuilder.reset(new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1));
+ else
+ aFilletBuilder.reset(new GeomAlgoAPI_Fillet(theSolid, aFilletEdges, aRadius1, aRadius2));
if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, getKind(), anError)) {
- setError(anError);
- return GeomMakeShapePtr();
+ setError(anError);
+ return GeomMakeShapePtr();
}
return aFilletBuilder;
}
-
return MY_VARYING_RADIUS;
}
- inline static const std::string CREATION_METHOD_MULTIPLES_RADIUSES()
- {
- static std::string MY_METHOD_MULTIPLES_RADIUSES("multiple_radiuses");
- return MY_METHOD_MULTIPLES_RADIUSES;
- }
-
- inline static const std::string CREATION_METHOD_BY_POINTS()
- {
- static std::string MY_CREATION_METHOD_BY_POINTS("by_point_method");
- return MY_CREATION_METHOD_BY_POINTS;
- }
-
- inline static const std::string ARRAY_POINT_RADIUS_BY_POINTS()
- {
- static std::string MY_ARRAY_POINT_RADIUS_BY_POINTS("array_point_radius_by_point");
- return MY_ARRAY_POINT_RADIUS_BY_POINTS;
- }
-
- inline static const std::string CREATION_METHOD_BY_CURVILEAR_ABSCISSA()
- {
- static std::string MY_CREATION_METHOD_BY_CURVILEAR_ABSCISSA("by_curvilinear_abscissa_methode");
- return MY_CREATION_METHOD_BY_CURVILEAR_ABSCISSA;
- }
-
/// Attribute name of main objects.
inline static const std::string& OBJECT_LIST_ID()
{
return MY_START_RADIUS_ID;
}
- /// Attribute name of edge selected.
- inline static const std::string& EDGE_SELECTED_ID()
- {
- static const std::string MY_EDGE_SELECTED_ID("edge_selected");
- return MY_EDGE_SELECTED_ID;
- }
-
- /// attribute name of list of tables that contain deafult values (row 0) and the custom values
- inline static const std::string& VALUES_ID()
- {
- static const std::string MY_VALUES_ID("values");
- return MY_VALUES_ID;
- }
-
- /// attribute name of list of tables that contain deafult values (row 0) and the custom values
- inline static const std::string& VALUES_CURV_ID()
- {
- static const std::string MY_VALUES_ID("values_curv");
- return MY_VALUES_ID;
- }
-
/// Attribute name of end radius.
inline static const std::string& END_RADIUS_ID()
{
/// Request for initialization of data model of the feature: adding all attributes.
FEATURESPLUGIN_EXPORT virtual void initAttributes();
- FEATURESPLUGIN_EXPORT void attributeChanged(const std::string& theID);
-
/// Use plugin manager for features creation.
FeaturesPlugin_Fillet();
#include <FeaturesPlugin_ValidatorTransform.h>
#include <FeaturesPlugin_Validators.h>
-#include <ModuleBase_WidgetCreatorFactory.h>
-
-#include "FeaturesPlugin_WidgetCreator.h"
-
#include <ModelAPI_Session.h>
#include <string>
FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
{
-
- WidgetCreatorFactoryPtr aWidgetCreatorFactory = ModuleBase_WidgetCreatorFactory::get();
- aWidgetCreatorFactory->registerCreator(
- std::shared_ptr<FeaturesPlugin_WidgetCreator>(new FeaturesPlugin_WidgetCreator()));
-
SessionPtr aMgr = ModelAPI_Session::get();
-
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
new FeaturesPlugin_ValidatorTransform);
#include <GeomAPI_ShapeExplorer.h>
-#include <iostream>
static const std::string CHAMFERFILLET_VERSION_1("v9.5");
anOriginalSolids.push_back(aSolid);
anEdges.insert(anEdges.end(), aSubs.begin(), aSubs.end());
-
}
// Build results of the operaion.
if (aContext.get()) {
ResultBodyPtr aCtxOwner = ModelAPI_Tools::bodyOwner(aContext);
if (aCtxOwner && aCtxOwner->shape()->shapeType() == GeomAPI_Shape::COMPSOLID)
- {
aContext = aCtxOwner;
- }
aParent = aContext->shape();
if (!aParent)
return false;
// store full shape hierarchy for the corresponding version only
- if (anObject->shapeType() <= GeomAPI_Shape::SOLID)
- {
- ListOfShape anEdges;
- collectSubs(aParent, anEdges, GeomAPI_Shape::EDGE);
- for (ListOfShape::iterator anIt = anEdges.begin(); anIt != anEdges.end(); ++anIt) {
- theObjects.addObject(*anIt);
- theObjects.addParent(*anIt, aParent);
- }
- }else
- {
- theObjects.addObject(anObject);
- theObjects.addParent(anObject, aParent);
- }
-
+ theObjects.addObject(anObject);
+ theObjects.addParent(anObject, aParent);
if (isStoreFullHierarchy)
ModelAPI_Tools::fillShapeHierarchy(aParent, aContext, theObjects);
} else { // get it from a feature
</context>
<context>
<name>Fillet:main_objects</name>
- <message>
- <source>Faces, edges or/and solids</source>
- <translation>Faces, arêtes ou/et solides</translation>
- </message>
<message>
<source>Faces or/and edges</source>
<translation>Faces ou/et arêtes</translation>
tooltip="Fillet with fixed radius"
icon="icons/Features/fillet_fixed_radius.png">
<multi_selector id="main_objects"
- label="Faces, edges or/and solids"
+ label="Faces or/and edges"
icon=""
tooltip="Select objects"
- shape_types="edges faces solids"
+ shape_types="edges faces"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
<validator id="GeomValidators_Positive"/>
</doublevalue>
</box>
- <box id="multiple_radiuses"
- title="Multiple radiuses"
- tooltip="Fillet with multiple radiuses"
- icon="icons/Features/fillet_var_multiple_radiuses.png">
- <toolbox id="by_point_method">
- <box id="by_points"
- title="By points"
- tooltip="Fillet with multiple radiuses by points"
- icon="icons/Features/fillet_multiradius_by_point.png">
- <shape_selector id="edge_selected"
- icon="icons/Features/edge.png"
- label="Start"
- tooltip="Select edge"
- shape_types="edge"
- use_choice="false"
- concealment="true">
- <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
- <!--validator id="FeaturesPlugin_ValidatorFilletSelection"/-->
- </shape_selector>
- <multiradius-panel id="array_point_radius_by_point"
- filter_points="false">
- <validator id="GeomValidators_ShapeType" parameters="empty,vertex"/>
- </multiradius-panel>
- </box>
- <box id="by_curvilinear_abscissa_methode"
- title="By curvilinear abscissa"
- tooltip="Fillet with multiple radiuses by curvilinear abscissa"
- icon="icons/Features/fillet_multiradius_by_curv.png">
- <multi_selector id="main_objects"
- label="Faces, edges or/and solids"
- icon=""
- tooltip="Select objects"
- shape_types="edges faces solids"
- use_choice="false"
- concealment="true">
- <validator id="PartSet_DifferentObjects"/>
- <validator id="FeaturesPlugin_ValidatorFilletSelection"/>
- </multi_selector>
- <multiradiuscurv-panel id="array_point_radius_by_point"
- filter_points="false">
- <validator id="GeomValidators_ShapeType" parameters="empty,vertex"/>
- </multiradiuscurv-panel>
- </box>
- </toolbox>
- </box>
</toolbox>
</source>
<source path="fillet1d_widget.xml"/>
</feature>
<feature id="Fillet" title="Fillet" tooltip="Perform fillet on face or edge"
- icon="icons/Features/fillet.png" auto_preview="false" helpfile="filletFeature.html">
+ icon="icons/Features/fillet.png" auto_preview="true" helpfile="filletFeature.html">
<source path="fillet_widget.xml"/>
</feature>
<feature id="Chamfer" title="Chamfer" tooltip="Perform chamfer on face or edge"
<source path="chamfer_widget.xml"/>
</feature>
<feature id="FusionFaces" title="Fuse Faces" tooltip="Performs fusion of connected faces"
- icon="icons/Features/fusion_faces.png" auto_preview="true" helpfile="FeaturesPlugin/fusionFacesFeature.html">
+ icon="icons/Features/fusion_faces.png" auto_preview="true" helpfile="fuseFeatureFaces.html">
<source path="fusion_faces_widget.xml"/>
</feature>
<feature id="Defeaturing" title="Defeaturing" tooltip="Perform removing faces from solid"
GeomAlgoAPI_Placement.h
GeomAlgoAPI_BREPImport.h
GeomAlgoAPI_STEPImport.h
- GeomAlgoAPI_STEPImportXCAF.h
GeomAlgoAPI_IGESImport.h
GeomAlgoAPI_BREPExport.h
GeomAlgoAPI_STEPExport.h
- GeomAlgoAPI_STLExport.h
GeomAlgoAPI_IGESExport.h
GeomAlgoAPI_Transform.h
GeomAlgoAPI_ShapeTools.h
GeomAlgoAPI_Placement.cpp
GeomAlgoAPI_BREPImport.cpp
GeomAlgoAPI_STEPImport.cpp
- GeomAlgoAPI_STEPImportXCAF.cpp
GeomAlgoAPI_IGESImport.cpp
GeomAlgoAPI_BREPExport.cpp
GeomAlgoAPI_STEPExport.cpp
- GeomAlgoAPI_STLExport.cpp
GeomAlgoAPI_IGESExport.cpp
GeomAlgoAPI_Transform.cpp
GeomAlgoAPI_ShapeTools.cpp
--- /dev/null
+// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef GeomAlgoAPI_BasicProperties_H_
+#define GeomAlgoAPI_BasicProperties_H_
+
+#include <GeomAlgoAPI.h>
+#include <GeomAPI_Shape.h>
+#include <Standard_TypeDef.hxx>
+
+/// Run chamfer operation with two distances or with a distance and an angle .
+ /// \param theShape the shape
+ /// \param theTolerance tolerance desirated
+ /// \param theLength lenght calculated
+ /// \param theSurfArea Surface Area calculated
+ /// \param theVolume Volume calculated
+ /// \param theError error
+GEOMALGOAPI_EXPORT
+bool GetBasicProperties( const std::shared_ptr<GeomAPI_Shape>& theShape,
+ const Standard_Real theTolerance,
+ Standard_Real& theLength,
+ Standard_Real& theSurfArea,
+ Standard_Real& theVolume,
+ std::string& theError);
+
+#endif
#include <GeomAlgoAPI_DFLoader.h>
#include <BRepFilletAPI_MakeFillet.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
-#include <gp_Pnt2d.hxx>
//=================================================================================================
GeomAlgoAPI_Fillet::GeomAlgoAPI_Fillet(const GeomShapePtr& theBaseSolid,
build(theBaseSolid, theFilletEdges, theStartRadius, theEndRadius);
}
-//=================================================================================================
-GeomAlgoAPI_Fillet::GeomAlgoAPI_Fillet(const GeomShapePtr& theBaseSolid,
- const ListOfShape& theFilletEdges,
- const std::list<double>& theCurvCoord,
- const std::list<double>& theRadiuses)
-{
- if (theRadiuses.size()== 0 )
- return;
- build(theBaseSolid, theFilletEdges,theCurvCoord, theRadiuses);
-}
-
//=================================================================================================
void GeomAlgoAPI_Fillet::build(const GeomShapePtr& theBaseSolid,
const ListOfShape& theFilletEdges,
setShape(aShape);
setDone(true);
}
-
-//=================================================================================================
-void GeomAlgoAPI_Fillet::build(const GeomShapePtr& theBaseSolid,
- const ListOfShape& theFilletEdges,
- const std::list<double>& theCurvCoord,
- const std::list<double>& theRadiuses)
-{
- if (!theBaseSolid || theFilletEdges.empty() || theRadiuses.size() == 0)
- return;
-
- // create fillet builder
- BRepFilletAPI_MakeFillet* aFilletBuilder =
- new BRepFilletAPI_MakeFillet(theBaseSolid->impl<TopoDS_Shape>());
- setImpl(aFilletBuilder);
- setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
-
- // assign filleting edges
- for (ListOfShape::const_iterator anIt = theFilletEdges.begin();
- anIt != theFilletEdges.end(); ++anIt) {
- if ((*anIt)->isEdge())
- aFilletBuilder->Add( (*anIt)->impl<TopoDS_Edge>() );
- }
-
- TColgp_Array1OfPnt2d array(1, theRadiuses.size());
-
- int i = 1;
- std::list<double>::const_iterator itCurv = theCurvCoord.begin();
- std::list<double>::const_iterator itRadius = theRadiuses.begin();
-
- for( ; itCurv != theCurvCoord.end(); ++itCurv, ++itRadius )
- {
- array.SetValue(i, gp_Pnt2d( (*itCurv) , (*itRadius)));
- i++;
- }
- // assign fillet radii for each contour of filleting edges
- int aNbContours = aFilletBuilder->NbContours();
- for (int ind = 1; ind <= aNbContours; ++ind) {
- aFilletBuilder->SetRadius(array, ind, 1);
- }
-
- // build and get result
- aFilletBuilder->Build();
- if (!aFilletBuilder->IsDone())
- return;
- TopoDS_Shape aResult = GeomAlgoAPI_DFLoader::refineResult(aFilletBuilder->Shape());
-
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
- aShape->setImpl(new TopoDS_Shape(aResult));
- setShape(aShape);
- setDone(true);
-}
\ No newline at end of file
#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAPI_Shape.h>
-#include <vector>
/// \class GeomAlgoAPI_Fillet
/// \ingroup DataAlgo
const ListOfShape& theFilletEdges,
const double theStartRadius,
const double theEndRadius);
-
- /// Run fillet operation with variable radius.
- /// \param theBaseSolid a changing solid
- /// \param theFilletEdges list of edges the fillet is performed on
- /// \param theRadiuses theradius of the fillet
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Fillet(const GeomShapePtr& theBaseSolid,
- const ListOfShape& theFilletEdges,
- const std::list<double>& theCurvCoord,
- const std::list<double>& theRadiuses);
-
private:
/// Perform fillet operation.
const ListOfShape& theFilletEdges,
const double theStartRadius,
const double theEndRadius = -1.0);
-
- /// Perform fillet operation.
- /// If theEndRadius is less than 0., the fixed radius fillet will be built.
- /// \param theBaseSolid a changing solid
- /// \param theFilletEdges list of edges the fillet is performed on
- /// \param theCurvCoord the coordinate of a point defines a relative parameter on the edge
- /// \param theRadiuses the corresponding value of the radius, and the radius evolves
- // between the first and last vertices of the contour of index
- void build(const GeomShapePtr& theBaseSolid,
- const ListOfShape& theFilletEdges,
- const std::list<double>& theCurvCoord,
- const std::list<double>& theRadiuses);
};
#endif
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
-#include <XCAFApp_Application.hxx>
-#include <XCAFDoc_DocumentTool.hxx>
-#include <OSD_Exception.hxx>
-#include <STEPCAFControl_Reader.hxx>
-#include <TDocStd_Document.hxx>
-#include <XCAFDoc_ColorTool.hxx>
-#include <XCAFDoc_ShapeTool.hxx>
-#include <GeomAlgoAPI_STEPImportXCAF.h>
-#include <Quantity_Color.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-
-// ----------------------------------------------------------------------------
-
std::shared_ptr<GeomAPI_Shape> STEPImport(const std::string& theFileName,
const std::string& theFormatName,
- const bool anScalInterUnits,
std::string& theError)
{
-
TopoDS_Shape aResShape;
// Set "C" numeric locale to save numbers correctly
// Kernel_Utils::Localizer loc;
-
+
STEPControl_Reader aReader;
//VSR: 16/09/09: Convert to METERS
if (status == IFSelect_RetDone) {
// Regard or not the model units
- if (!anScalInterUnits) {
+ if (theFormatName == "STEP_SCALE") {
// set UnitFlag to units from file
TColStd_SequenceOfAsciiString anUnitLengthNames;
TColStd_SequenceOfAsciiString anUnitAngleNames;
aGeomShape->setImpl(new TopoDS_Shape(aResShape));
return aGeomShape;
}
-
-
-std::shared_ptr<GeomAPI_Shape> STEPImportAttributs(const std::string& theFileName,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- const bool anScalInterUnits,
- const bool anMaterials,
- const bool anColor,
- std::map< std::wstring, std::list<std::wstring>> &theMaterialShape,
- std::string& theError)
-{
-
- STEPControl_Reader aReader;
- std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
- //VSR: 16/09/09: Convert to METERS
- Interface_Static::SetCVal("xstep.cascade.unit","M");
- Interface_Static::SetIVal("read.step.ideas", 1);
- Interface_Static::SetIVal("read.step.nonmanifold", 1);
-
- try {
- OCC_CATCH_SIGNALS;
-
- IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.c_str());
-
- if (status == IFSelect_RetDone) {
-
- // Regard or not the model units
- if (!anScalInterUnits) {
- // set UnitFlag to units from file
- TColStd_SequenceOfAsciiString anUnitLengthNames;
- TColStd_SequenceOfAsciiString anUnitAngleNames;
- TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
- aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames);
- if (anUnitLengthNames.Length() > 0) {
- TCollection_AsciiString aLenUnits = anUnitLengthNames.First();
- if (aLenUnits == "millimetre")
- Interface_Static::SetCVal("xstep.cascade.unit", "MM");
- else if (aLenUnits == "centimetre")
- Interface_Static::SetCVal("xstep.cascade.unit", "CM");
- else if (aLenUnits == "metre" || aLenUnits.IsEmpty())
- Interface_Static::SetCVal("xstep.cascade.unit", "M");
- else if (aLenUnits == "INCH")
- Interface_Static::SetCVal("xstep.cascade.unit", "INCH");
- else {
- theError = "The file contains not supported units.";
- aGeomShape->setImpl(new TopoDS_Shape());
- return aGeomShape;
- }
- // TODO (for other units than mm, cm, m or inch)
- //else if (aLenUnits == "")
- // Interface_Static::SetCVal("xstep.cascade.unit", "???");
- }
- }
- else {
- //cout<<"need re-scale a model"<<endl;
- // set UnitFlag to 'meter'
- Interface_Static::SetCVal("xstep.cascade.unit","M");
- }
- }
- }
- catch (Standard_Failure const& anException) {
- theError = anException.GetMessageString();
- aGeomShape->setImpl(new TopoDS_Shape());
- return aGeomShape;
- }
-
- STEPCAFControl_Reader cafreader;
- cafreader.SetColorMode(true);
- cafreader.SetNameMode(true);
- cafreader.SetMatMode(true);
-
- if(cafreader.ReadFile(theFileName.c_str()) != IFSelect_RetDone) {
- theError = "Wrong format of the imported file. Can't import file.";
- std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
- aGeomShape->setImpl(new TopoDS_Shape());
- return aGeomShape;
- }
-
- return readAttributes(cafreader,theResultBody,anMaterials, theMaterialShape, "STEP-XCAF");
- }
-
#include <GeomAlgoAPI.h>
#include <string>
-#include <GeomAPI_Shape.h>
-
-#include <ModelAPI_ResultBody.h>
+#include <GeomAPI_Shape.h>
/// Implementation of the import STEP files algorithms
GEOMALGOAPI_EXPORT
std::shared_ptr<GeomAPI_Shape> STEPImport(const std::string& theFileName,
const std::string& theFormatName,
- const bool anScalInterUnits,
std::string& theError);
-/// Implementation of the import STEP files algorithms with Attributs (Name, Color, Materials)
-GEOMALGOAPI_EXPORT
-std::shared_ptr<GeomAPI_Shape> STEPImportAttributs(const std::string& theFileName,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- const bool anScalInterUnits,
- const bool anMaterials,
- const bool anColor,
- std::map< std::wstring, std::list<std::wstring>> &theMaterialShape,
- std::string& theError);
-
#endif /* GEOMALGOAPI_STEPIMPORT_H_ */
void Model_Objects::storeResult(std::shared_ptr<ModelAPI_Data> theFeatureData,
std::shared_ptr<ModelAPI_Result> theResult,
- const int theResultIndex,
- const std::wstring& theNameShape)
+ const int theResultIndex)
{
theResult->init();
theResult->setDoc(myDoc);
theResult->data()->setName(L"");
} else {
std::wstringstream aName;
- if( theNameShape != L"" ){
- aName << theNameShape;
- }else{
- aName << aNewName;
- // if there are several results (issue #899: any number of result),
- // add unique prefix starting from second
- if (theResultIndex > 0 || theResult->groupName() == ModelAPI_ResultBody::group())
- aName << "_" << theResultIndex + 1;
- }
+ aName << aNewName;
+ // if there are several results (issue #899: any number of result),
+ // add unique prefix starting from second
+ if (theResultIndex > 0 || theResult->groupName() == ModelAPI_ResultBody::group())
+ aName << "_" << theResultIndex + 1;
aNewName = aName.str();
}
theResult->data()->setName(aNewName);
}
std::shared_ptr<ModelAPI_ResultBody> Model_Objects::createBody(
- const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex,const std::wstring& theNameShape )
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
TDF_Label aLab = resultLabel(theFeatureData, theIndex);
TDataStd_Comment::Set(aLab, ModelAPI_ResultBody::group().c_str());
}
if (!aResult.get()) {
aResult = std::shared_ptr<ModelAPI_ResultBody>(new Model_ResultBody);
- storeResult(theFeatureData, aResult, theIndex,theNameShape);
+ storeResult(theFeatureData, aResult, theIndex);
}
return aResult;
}
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a body result
std::shared_ptr<ModelAPI_ResultBody> createBody(
- const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0,
- const std::wstring& theNameShape = L"");
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a part result
std::shared_ptr<ModelAPI_ResultPart> createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
//! Initializes the data fields of the feature
void initData(ObjectPtr theObj, TDF_Label theLab, const int theTag);
-
- //! Allows to store the result in the data tree of the document
+
+ //! Allows to store the result in the data tree of the document
//! (attaches 'data' of result to tree)
void storeResult(std::shared_ptr<ModelAPI_Data> theFeatureData,
std::shared_ptr<ModelAPI_Result> theResult,
- const int theResultIndex = 0,
- const std::wstring& theNameShape = L"");
+ const int theResultIndex = 0);
//! returns the label of result by index; creates this label if it was not created before
TDF_Label resultLabel(const std::shared_ptr<ModelAPI_Data>& theFeatureData,
#include <Events_Loop.h>
#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_ShapeExplorer.h>
-#include <GeomAPI_Face.h>
-#include <GeomAPI_Pnt.h>
#include <TopoDS_Shape.hxx>
#include <TopExp_Explorer.hxx>
}
}
-void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector<int>& color) {
-
- if( myColorsShape.find(theName) == myColorsShape.end())
- myColorsShape[ theName ] = color;
-}
-
-std::wstring Model_ResultBody::addShapeName(std::shared_ptr<GeomAPI_Shape> theshape,const std::wstring& theName ){
-
- int indice = 1;
- std::wstringstream aName;
- aName << theName;
- while(myNamesShape.find(aName.str()) != myNamesShape.end() ){
- aName.str(L"");
- aName << theName << L"__" << indice;
- indice++;
- }
- myNamesShape[ aName.str() ] = theshape;
-
- return aName.str();
-}
-
-std::wstring Model_ResultBody::findShapeName(std::shared_ptr<GeomAPI_Shape> theshape){
-
- TopoDS_Shape aShape = theshape->impl<TopoDS_Shape>();
- for (std::map< std::wstring, std::shared_ptr<GeomAPI_Shape> >::iterator it = myNamesShape.begin();
- it != myNamesShape.end();
- ++it)
- {
- TopoDS_Shape curSelectedShape = (*it).second->impl<TopoDS_Shape>();
- if( (aShape.IsSame(curSelectedShape))) {
- return (*it).first;
- }
-
- }
- return L"material not found" ;
-}
-
-
-void Model_ResultBody::setShapeName(std::map< std::wstring, std::shared_ptr<GeomAPI_Shape> > &theshapename,
- std::map< std::wstring, std::vector<int>> & theColorsShape)
-{
- myNamesShape = theshapename;
- myColorsShape = theColorsShape;
-}
-void Model_ResultBody::clearShapeNameAndColor(){
- myNamesShape.clear();
- myColorsShape.clear();
-}
void Model_ResultBody::updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape,
const bool theShapeChanged)
{
aShape->setImpl(new TopoDS_Shape(aShapesIter.Value()));
ResultBodyPtr aSub;
if (mySubs.size() <= aSubIndex) { // it is needed to create a new sub-result
- std::wstring thenameshape = L"";
- // find shape name read
- for (std::map< std::wstring, std::shared_ptr<GeomAPI_Shape> >::iterator it = myNamesShape.begin();
- it != myNamesShape.end();
- ++it)
- {
- TopoDS_Shape curSelectedShape = (*it).second->impl<TopoDS_Shape>();
- if( !(aShapesIter.Value().IsSame(curSelectedShape))) continue;
- thenameshape = (*it).first;
- break;
- }
- aSub = anObjects->createBody(this->data(), aSubIndex,thenameshape);
- //finf color read
- std::map< std::wstring, std::vector<int>>::iterator itColor = myColorsShape.find(thenameshape);
- if(itColor != myColorsShape.end()){
- ModelAPI_Tools::setColor(aSub,(*itColor).second);
- }
- aSub->setShapeName(myNamesShape,myColorsShape);
+ aSub = anObjects->createBody(this->data(), aSubIndex);
mySubs.push_back(aSub);
mySubsMap[aSub] = int(mySubs.size() - 1);
if (isConcealed()) { // for issue #2579 note7
aSub->ModelAPI_ResultBody::setIsConcealed(true);
std::dynamic_pointer_cast<Model_ResultBody>(aSub)->updateConcealment();
}
-
} else { // just update shape of this result
aSub = mySubs[aSubIndex];
}
/// Makes a body on the given feature
Model_ResultBody();
-/// Updates the sub-bodies if shape of this object is composite-solid
+ /// Updates the sub-bodies if shape of this object is composite-solid
void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape,
const bool theShapeChanged = true);
const std::list<GeomShapePtr>& theAllOlds, std::list<GeomShapePtr>& theOldForSub);
friend class Model_Objects;
-
- // Add shape Name for read shape in step file
- std::wstring addShapeName(std::shared_ptr<GeomAPI_Shape>,const std::wstring& theName) override;
- // Add color for shape Name read shape in step file
- void addShapeColor( const std::wstring& theName,std::vector<int>& color) override;
- // Set the map of name and color read shape in step file
- void setShapeName(std::map< std::wstring, std::shared_ptr<GeomAPI_Shape> > &theshapename,std::map< std::wstring, std::vector<int>> & theColorsShape) override;
- // find the name of shapp read in step file
- std::wstring findShapeName(std::shared_ptr<GeomAPI_Shape> theshape) override;
- // Clear the map of name and color read shape in step file
- void clearShapeNameAndColor() override;
-
- // map with the name read in step file and shape
- std::map< std::wstring, std::shared_ptr<GeomAPI_Shape> > myNamesShape;
- // map with the name contruct and color read
- std::map< std::wstring, std::vector<int>> myColorsShape;
-
};
#endif
SET(PROJECT_LIBRARIES
Config
GeomAPI
- ${OpenCASCADE_ApplicationFramework_LIBRARIES}
+ Locale
)
SET(CMAKE_SWIG_FLAGS -threads -w325,321,362,383,302,403,451,473)
ADD_DEFINITIONS(-DMODELAPI_EXPORTS)
${PROJECT_SOURCE_DIR}/src/GeomAPI
${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
${PROJECT_SOURCE_DIR}/src/Locale
- ${OpenCASCADE_INCLUDE_DIR}
- ${OpenCASCADE_DataExchange_LIBRARIES}
- ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
- ${OpenCASCADE_ApplicationFramework_LIBRARIES}
)
Test19707.py
Test19726.py
Test19912.py
+ Test19932.py
+ Test19989.py
)
{
return data()->intArray(theID);
}
- /// Returns the double array attribute by the identifier
- inline std::shared_ptr<ModelAPI_AttributeDoubleArray> realArray(const std::string& theID)
- {
- return data()->realArray(theID);
- }
/// Returns the reference attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID)
{
#include <GeomAPI_Shape.h>
#include <GeomAPI_DataMapOfShapeShape.h>
#include <string>
-#include <map>
-#include <vector>
class ModelAPI_BodyBuilder;
class GeomAlgoAPI_MakeShape;
/// Cleans cash related to the already stored elements
MODELAPI_EXPORT virtual void cleanCash() = 0;
-
- // Add shape Name for read shape in step file
- MODELAPI_EXPORT virtual std::wstring addShapeName(std::shared_ptr<GeomAPI_Shape>,const std::wstring& theName) = 0;
- // Add color for shape Name read shape in step file
- MODELAPI_EXPORT virtual void addShapeColor(const std::wstring& theName,std::vector<int>& color) = 0;
- // Set the map of name and color read shape in step file
- MODELAPI_EXPORT virtual void setShapeName(std::map< std::wstring, std::shared_ptr<GeomAPI_Shape> > &theshapename,
- std::map< std::wstring, std::vector<int>> & theColorsShape) = 0;
- // Clear the map of name and color read shape in step file
- MODELAPI_EXPORT virtual void clearShapeNameAndColor() = 0;
- // find the name of shapp read in step file
- MODELAPI_EXPORT virtual std::wstring findShapeName(std::shared_ptr<GeomAPI_Shape> theshape) = 0;
-
protected:
/// Default constructor accessible only from Model_Objects
MODELAPI_EXPORT ModelAPI_ResultBody();
-
-
};
//! Pointer on feature object
connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)),
theParent, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)));
connect(aWidget, SIGNAL(objectUpdated()), theParent, SLOT(onObjectUpdated()));
+ aWidget->enableFocusProcessing();
}
aLayout->addWidget(aParamsWgt);
}
"""Package for Exchange plugin for the Parametric Geometry API of the Modeler.
"""
-from ExchangeAPI import addImport, addImportStep, exportToFile, exportToXAO, exportToSTL
+from ExchangeAPI import addImport, exportToFile, exportToXAO
from ExchangeAPI import exportPart, importPart
from .tools import *