}
FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const std::list<ModelHighAPI_Selection>& theEdgesFaces,
const ModelHighAPI_Double& theRadius1,
const ModelHighAPI_Double& theRadius2)
: FeaturesAPI_Fillet(theFeature)
{
if (initialize()) {
fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS(), mycreationMethod);
- fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theEdgesFaces, myedgesfacesselected);
fillAttribute(theRadius1, mystartRadius);
fillAttribute(theRadius2, myendRadius);
}
FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const std::list<ModelHighAPI_Selection>& theEdgesFaces,
const std::list<ModelHighAPI_Double>& thepointCurvCood,
const std::list<ModelHighAPI_Double>& theRadius)
: FeaturesAPI_Fillet(theFeature)
{
if (initialize()) {
fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES(), mycreationMethod);
- fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_BY_CURVILEAR_ABSCISSA(),
- mycreationMethodmulti);
- fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_BY_CURVILEAR_ABSCISSA(), mycreationMethodmulti);
+ fillAttribute(theEdgesFaces, myedgesfacesselected);
int aRowIndex = 0;
myvaluescurv()->setSize( thepointCurvCood.size(), 2 );
aBase->selectionList(FeaturesPlugin_Fillet::ARRAY_POINT_RADIUS_BY_POINTS());
AttributeTablesPtr anAttrTable =
aBase->tables(FeaturesPlugin_Fillet::VALUES_ID());
- theDumper << aBase << " = model.addFilletMultiRadiusByPoints(" << aDocName;
- theDumper << ", " << anAttrEdgeSelec;
+ theDumper << aBase << " = model.addFilletMultiRadiusByPoints(" << aDocName << ", " << anAttrEdgeSelec;
theDumper << ", " << anAttrPoint ;
theDumper<<", [";
for(int aRow = 0; aRow < myvalues()->rows(); aRow++) {
theDumper<<"]";
}else{
- AttributeTablesPtr anAttrTable =
- aBase->tables(FeaturesPlugin_Fillet::VALUES_CURV_ID());
- theDumper << aBase << " = model.addFilletMultiRadiusBycurvAbs(" << aDocName;
- theDumper << ", " << anAttrObjects;
+ AttributeSelectionListPtr anAttrEdgesFaces =
+ aBase->selectionList(FeaturesPlugin_Fillet::EDGES_FACES_LIST_ID());
+ AttributeTablesPtr anAttrTable = aBase->tables(FeaturesPlugin_Fillet::VALUES_CURV_ID());
+ theDumper << aBase << " = model.addFilletMultiRadiusBycurvAbs(" << aDocName << ", " << anAttrEdgesFaces;
theDumper << ", ";
theDumper<<"[";
for(int aRow = 0; aRow < myvaluescurv()->rows(); aRow++) {
theDumper<<"]";
}
}else
- { theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrObjects;
+ {
std::string aCreationMethod = aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD())->value();
if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS()) {
+ theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrObjects;
AttributeDoublePtr anAttrRadius = aBase->real(FeaturesPlugin_Fillet::RADIUS_ID());
theDumper << ", " << anAttrRadius;
} else if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS()) {
+ AttributeSelectionListPtr anAttrEdgesFaces =
+ aBase->selectionList(FeaturesPlugin_Fillet::EDGES_FACES_LIST_ID());
+ theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrEdgesFaces;
AttributeDoublePtr anAttrRadius1 = aBase->real(FeaturesPlugin_Fillet::START_RADIUS_ID());
AttributeDoublePtr anAttrRadius2 = aBase->real(FeaturesPlugin_Fillet::END_RADIUS_ID());
theDumper << ", " << anAttrRadius1 << ", " << anAttrRadius2;
/// Constructor with values.
FEATURESAPI_EXPORT
explicit FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const std::list<ModelHighAPI_Selection>& theEdgesFaces,
const ModelHighAPI_Double& theRadius1,
const ModelHighAPI_Double& theRadius2);
/// Constructor with values.
FEATURESAPI_EXPORT
explicit FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const std::list<ModelHighAPI_Selection>& theEdgesFaces,
const std::list<ModelHighAPI_Double>& thepointCurvCood,
const std::list<ModelHighAPI_Double>& theRadius);
/// Destructor.
FEATURESAPI_EXPORT
virtual ~FeaturesAPI_Fillet2D();
- INTERFACE_10(FeaturesPlugin_Fillet::ID(),
+ INTERFACE_11(FeaturesPlugin_Fillet::ID(),
creationMethod, FeaturesPlugin_Fillet::CREATION_METHOD(),
ModelAPI_AttributeString,
/** Creation method */,
/** Base objects */,
edgeselected, FeaturesPlugin_Fillet::EDGE_SELECTED_ID(),
ModelAPI_AttributeSelection,
- /** Base objects */,
+ /** edge objects */,
+ edgesfacesselected, FeaturesPlugin_Fillet::EDGES_FACES_LIST_ID(),
+ ModelAPI_AttributeSelectionList,
+ /** edge and face objects */,
arraypointradiusbypoint, FeaturesPlugin_Fillet::ARRAY_POINT_RADIUS_BY_POINTS(),
ModelAPI_AttributeSelectionList,
- /** Base objects */,
+ /** selection points */,
myvalues, FeaturesPlugin_Fillet::VALUES_ID(),
ModelAPI_AttributeTables,
/** table for methode multi-radiuses by point */,
TestFillet_MultiLevelCompound_v95_2.py
TestFillet_MultiLevelCompound_v95_3.py
TestFillet_MultiLevelCompound_v95_4.py
+ TestFillet_MultiRadius.py
TestChamfer_MultiLevelCompound_v0_1.py
TestChamfer_MultiLevelCompound_v0_2.py
TestChamfer_MultiLevelCompound_v0_3.py
AttributePtr aSelectionList =
data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
+
+ data()->addAttribute(EDGES_FACES_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
+
data()->addAttribute(START_RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(END_RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
AttributePtr FeaturesPlugin_Fillet::objectsAttribute()
{
- 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()
- && string(CREATION_METHOD_MULTIPLES_RADIUSES())->value() == CREATION_METHOD_BY_POINTS()) {
-
- 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->context(), anEdges->value()); // anEdges->namingName() );
+ if( string(CREATION_METHOD())->value() == CREATION_METHOD_MULTIPLES_RADIUSES() )
+ {
+ if( string(CREATION_METHOD_MULTIPLES_RADIUSES())->value() == CREATION_METHOD_BY_POINTS())
+ {
+ return attribute(EDGE_SELECTED_ID());
+ }else{
+ return attribute(EDGES_FACES_LIST_ID());
+ }
+ }else if ( string(CREATION_METHOD())->value() == CREATION_METHOD_VARYING_RADIUS() )
+ {
+ return attribute(EDGES_FACES_LIST_ID());
}
- if( theID == OBJECT_LIST_ID() &&
- !(string(CREATION_METHOD())->value() == CREATION_METHOD_MULTIPLES_RADIUSES()
- && string(CREATION_METHOD_MULTIPLES_RADIUSES())->value() == CREATION_METHOD_BY_POINTS() ) ){
-
- data()->selection(EDGE_SELECTED_ID())->setValue(ObjectPtr(),GeomShapePtr());
- }
+ return attribute(OBJECT_LIST_ID());
- data()->execState(ModelAPI_StateMustBeUpdated);
+}
+
+void FeaturesPlugin_Fillet::attributeChanged(const std::string& theID)
+{
}
const std::string& FeaturesPlugin_Fillet::modifiedShapePrefix() const
static const std::string MY_OBJECT_LIST_ID("main_objects");
return MY_OBJECT_LIST_ID;
}
+ /// Attribute name of main objects.
+ inline static const std::string& EDGES_FACES_LIST_ID()
+ {
+ static const std::string MY_EDGES_FACES_LIST_ID("edges_faces_seleted");
+ return MY_EDGES_FACES_LIST_ID;
+ }
/// Attribute name of start radius.
inline static const std::string& START_RADIUS_ID()
{
bool isStoreFullHierarchy = data()->version() == CHAMFERFILLET_VERSION_1;
+ AttributeSelectionPtr anObject =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+
+ if( anObject.get() )
+ {
+ if ( !addShapeInHierarchy(anObject , theObjects, isStoreFullHierarchy) )
+ return false;
+ return true;
+ }
AttributeSelectionListPtr anObjectsSelList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); ++anObjectsIndex) {
AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
- GeomShapePtr anObject = anObjectAttr->value();
- if (!anObject)
+
+ if ( !addShapeInHierarchy(anObjectAttr , theObjects, isStoreFullHierarchy) )
+ return false;
+ }
+ return true;
+}
+
+bool FeaturesPlugin_VersionedChFi::addShapeInHierarchy(const AttributeSelectionPtr& theAttribute,
+ GeomAPI_ShapeHierarchy& theObjects,
+ bool theIsStoreFullHierarchy)
+{
+ GeomShapePtr anObject = theAttribute->value();
+ if (!anObject)
+ return false;
+
+ ResultPtr aContext = theAttribute->context();
+ GeomShapePtr aParent;
+ 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;
- ResultPtr aContext = anObjectAttr->context();
- GeomShapePtr aParent;
- if (aContext.get()) {
- ResultBodyPtr aCtxOwner = ModelAPI_Tools::bodyOwner(aContext);
- if (aCtxOwner && aCtxOwner->shape()->shapeType() == GeomAPI_Shape::COMPSOLID)
- {
- aContext = aCtxOwner;
+ // 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);
}
- aParent = aContext->shape();
+ }else
+ {
+ theObjects.addObject(anObject);
+ theObjects.addParent(anObject, aParent);
+ }
+
+ if (theIsStoreFullHierarchy)
+ ModelAPI_Tools::fillShapeHierarchy(aParent, aContext, theObjects);
+ } else { // get it from a feature
+ FeaturePtr aFeature = theAttribute->contextFeature();
+ if (aFeature.get()) {
+ aParent = aFeature->firstResult()->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);
- }
-
- if (isStoreFullHierarchy)
- ModelAPI_Tools::fillShapeHierarchy(aParent, aContext, theObjects);
- } else { // get it from a feature
- FeaturePtr aFeature = anObjectAttr->contextFeature();
- if (aFeature.get()) {
- aParent = aFeature->firstResult()->shape();
- if (!aParent)
- return false;
-
- 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);
- }
+ 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);
}
}
}
return true;
-}
+}
\ No newline at end of file
#include <GeomAPI_Shape.h>
#include <GeomAPI_ShapeHierarchy.h>
+#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_Feature.h>
/// Process SelectionList attribute and fill the objects hierarchy.
bool processAttribute(const std::shared_ptr<ModelAPI_Attribute>& theAttribute,
GeomAPI_ShapeHierarchy& theObjects);
+
+ // Add Shape in the object hierarchy
+ bool addShapeInHierarchy(const AttributeSelectionPtr& theAttribute,
+ GeomAPI_ShapeHierarchy& theObjects,
+ bool theIsStoreFullHierarchy);
/// Return attribute storing the selected objects of the operation.
virtual std::shared_ptr<ModelAPI_Attribute> objectsAttribute() = 0;
myDelegate = new DataArrayItemDelegate(myTypeMethodeBypoint);
- //JL_CGLB myDataTbl->installEventFilter(this);
myDataTbl->setItemDelegate(myDelegate);
myDataTbl->verticalHeader()->hide();
myDataTbl->setRowHeight(0, 25);
- //JL_CGLB myDataTbl->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
if(myTypeMethodeBypoint){
myfirstRowValue.push_back("Start extremity");
myDataTbl->setHorizontalHeaderLabels(aHeaders);
- //myDataTbl->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
QTableWidgetItem* aItem;
for(int j =0; j<3;j++)
{
QModelIndex index = myDataTbl->currentIndex();
int i = index.row();
- if( i == -1 )
- return false;
-
- if( !myDataTbl->currentItem()->isSelected() && myDataTbl->rowCount() >2 )
- return false;
-
- myDataTbl->blockSignals(true);
+ if( i != -1
+ && !(!myDataTbl->currentItem()->isSelected() && myDataTbl->rowCount() >2))
+ {
- if ( i == myDataTbl->rowCount() -1)
- i = myDataTbl->rowCount() - 2;
+ myDataTbl->blockSignals(true);
- if ( i == 0)
- i = 1;
- else
- i= i+1;
- myDataTbl->model()->insertRow(i);
+ if ( i == myDataTbl->rowCount() -1)
+ i = myDataTbl->rowCount() - 2;
- QTableWidgetItem* aItem =0;
+ if ( i == 0)
+ i = 1;
+ else
+ i= i+1;
+ myDataTbl->model()->insertRow(i);
- aItem = myDataTbl->item( i, 0 );
- aItem = new QTableWidgetItem( "" );
- myDataTbl->setItem(i, 0, aItem);
+ QTableWidgetItem* aItem =0;
- aItem = new QTableWidgetItem("0.1");
- myDataTbl->setItem(i, 1, aItem);
+ aItem = myDataTbl->item( i, 0 );
+ aItem = new QTableWidgetItem( "" );
+ myDataTbl->setItem(i, 0, aItem);
+ aItem = new QTableWidgetItem("0.1");
+ myDataTbl->setItem(i, 1, aItem);
- aItem = new QTableWidgetItem("0.5");
- myDataTbl->setItem(i, 2, aItem);
- myDataTbl->blockSignals(false);
+ aItem = new QTableWidgetItem("0.5");
+ myDataTbl->setItem(i, 2, aItem);
+ myDataTbl->blockSignals(false);
- emit valuesChanged();
- myDataTbl->setCurrentCell( i, 0);
+ emit valuesChanged();
+ myDataTbl->setCurrentCell( i, 0);
+ }
}
//**********************************************************************************
title="Varying radius"
tooltip="Fillet with varying radius"
icon="icons/Features/fillet_var_radius.png">
- <multi_selector id="main_objects"
+ <multi_selector id="edges_faces_seleted"
label="Faces or/and edges"
icon=""
tooltip="Select objects"
tooltip="Fillet with multiple radiuses"
icon="icons/Features/fillet_var_multiple_radiuses.png">
<toolbox id="by_point_method">
- <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="Edges or/and faces"
- icon=""
- tooltip="Select objects"
- shape_types="edges faces"
- 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>
<box id="by_points"
title="By points"
tooltip="Fillet with multiple radiuses by points"
</multiradius-panel>
<validator id="FeaturesPlugin_ValidatorFilletSelection" parameters = "main_objects"/>
</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="edges_faces_seleted"
+ label="Edges or/and faces"
+ icon=""
+ tooltip="Select objects"
+ shape_types="edges faces"
+ 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>