fillAttribute(theEdgesFaces, myedgesfacesselected);
fillAttribute(theRadius1, mystartRadius);
fillAttribute(theRadius2, myendRadius);
-
- execIfBaseNotEmpty();
+ if (myedgesfacesselected->size() > 0)
+ execute();
}
}
: FeaturesAPI_Fillet(theFeature)
{
if (initialize()) {
- fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES(), mycreationMethod);
+ fillAttribute(FeaturesPlugin_Fillet::METHOD_MULTIPLES_RADIUSES(), mycreationMethod);
fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_BY_POINTS(), mycreationMethodmulti);
- fillAttribute(theedgeselected, edgeselected());
+ fillAttribute(theedgeselected, myedgeselected);
fillAttribute(thepoint, myarraypointradiusbypoint);
GeomEdgePtr anEdge = GeomEdgePtr(new GeomAPI_Edge( edgeselected()->value()));
myvalues()->setValue(aVal, aRowIndex, 0 );
aVal.myDouble = aRowsRadiusIter->value();
myvalues()->setValue(aVal, aRowIndex, 1 );
- execIfBaseNotEmpty();
+
+ execute();
}
}
: FeaturesAPI_Fillet(theFeature)
{
if (initialize()) {
- fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES(), mycreationMethod);
+ fillAttribute(FeaturesPlugin_Fillet::METHOD_MULTIPLES_RADIUSES(), mycreationMethod);
fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_BY_CURVILEAR_ABSCISSA(), mycreationMethodmulti);
- fillAttribute(theEdgesFaces, myedgesfacesselected);
+ fillAttribute(theEdgesFaces, myedgesfacesmultiselected);
int aRowIndex = 0;
myvaluescurv()->setSize( thepointCurvCood.size(), 2 );
myvaluescurv()->setValue(aVal, aRowIndex, 0 );
aVal.myDouble = aRowsRadiusIter->value();
myvaluescurv()->setValue(aVal, aRowIndex, 1 );
- }
- execIfBaseNotEmpty();
+ }
+ if (myedgesfacesmultiselected->size() > 0)
+ execute();
}
}
if ( aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD())->value()
- == FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES() )
+ == FeaturesPlugin_Fillet::METHOD_MULTIPLES_RADIUSES() )
{
AttributeSelectionPtr anAttrEdgeSelec =
aBase->selection(FeaturesPlugin_Fillet::EDGE_SELECTED_ID());
- if( aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES())->value()
+ if( aBase->string(FeaturesPlugin_Fillet::CREATION_MULTI_RADIUS_METHODE())->value()
== FeaturesPlugin_Fillet::CREATION_METHOD_BY_POINTS() )
{
}else{
AttributeSelectionListPtr anAttrEdgesFaces =
- aBase->selectionList(FeaturesPlugin_Fillet::EDGES_FACES_LIST_ID());
+ aBase->selectionList(FeaturesPlugin_Fillet::EDGES_FACES_MULTI_LIST_ID());
AttributeTablesPtr anAttrTable = aBase->tables(FeaturesPlugin_Fillet::VALUES_CURV_ID());
theDumper << aBase << " = model.addFilletMultiRadiusBycurvAbs(" << aDocName << ", " << anAttrEdgesFaces;
theDumper << ", ";
FEATURESAPI_EXPORT
virtual ~FeaturesAPI_Fillet2D();
- INTERFACE_11(FeaturesPlugin_Fillet::ID(),
+ INTERFACE_12(FeaturesPlugin_Fillet::ID(),
creationMethod, FeaturesPlugin_Fillet::CREATION_METHOD(),
ModelAPI_AttributeString,
/** Creation method */,
- creationMethodmulti, FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES(),
+ creationMethodmulti, FeaturesPlugin_Fillet::CREATION_MULTI_RADIUS_METHODE(),
ModelAPI_AttributeString,
/** Creation method */,
baseObjects, FeaturesPlugin_Fillet::OBJECT_LIST_ID(),
edgesfacesselected, FeaturesPlugin_Fillet::EDGES_FACES_LIST_ID(),
ModelAPI_AttributeSelectionList,
/** edge and face objects */,
+ edgesfacesmultiselected, FeaturesPlugin_Fillet::EDGES_FACES_MULTI_LIST_ID(),
+ ModelAPI_AttributeSelectionList,
+ /** edge and face objects */,
arraypointradiusbypoint, FeaturesPlugin_Fillet::ARRAY_POINT_RADIUS_BY_POINTS(),
ModelAPI_AttributeSelectionList,
/** selection points */,
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(EDGES_FACES_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
+ AttributePtr aSelectionEdgesFacesList =
+ data()->addAttribute(EDGES_FACES_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
+
+ AttributePtr aSelectionEdgesFacesMultiList =
+ data()->addAttribute(EDGES_FACES_MULTI_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
+
+ AttributePtr aSelectionEdgeSelected =
+ data()->addAttribute(EDGE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(CREATION_MULTI_RADIUS_METHODE(), ModelAPI_AttributeString::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());
- tables(VALUES_ID())->setSize(2,2);
- tables(VALUES_CURV_ID())->setSize(2,2);
- ModelAPI_AttributeTables::Value aVar;
- aVar.myDouble = 0.0;
- tables(VALUES_ID())->setValue(aVar,0,0);
- tables(VALUES_CURV_ID())->setValue(aVar,0,0);
- aVar.myDouble = 1;
- tables(VALUES_ID())->setValue(aVar,0,1);
- tables(VALUES_CURV_ID())->setValue(aVar,0,1);
-
- tables(VALUES_ID())->setValue(aVar,1,0);
- tables(VALUES_CURV_ID())->setValue(aVar,1,0);
- aVar.myDouble = 2;
- tables(VALUES_ID())->setValue(aVar,1,1);
- tables(VALUES_CURV_ID())->setValue(aVar,1,1);
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATION_MULTI_RADIUS_METHODE());
+ initVersion(aSelectionEdgeSelected);
+ initVersion(aSelectionEdgesFacesMultiList);
+ initVersion(aSelectionEdgesFacesList);
initVersion(aSelectionList);
+
}
AttributePtr FeaturesPlugin_Fillet::objectsAttribute()
{
- if( string(CREATION_METHOD())->value() == CREATION_METHOD_MULTIPLES_RADIUSES() )
+ if( string(CREATION_METHOD())->value() == METHOD_MULTIPLES_RADIUSES() )
{
- if( string(CREATION_METHOD_MULTIPLES_RADIUSES())->value() == CREATION_METHOD_BY_POINTS())
+ if( string(CREATION_MULTI_RADIUS_METHODE())->value() == CREATION_METHOD_BY_POINTS())
{
return attribute(EDGE_SELECTED_ID());
}else{
- return attribute(EDGES_FACES_LIST_ID());
+ return attribute(EDGES_FACES_MULTI_LIST_ID());
}
}else if ( string(CREATION_METHOD())->value() == CREATION_METHOD_VARYING_RADIUS() )
{
std::shared_ptr<GeomAlgoAPI_Fillet> aFilletBuilder;
ListOfShape aFilletEdges = extractEdges(theEdges);
- if ( aCreationMethod->value() == CREATION_METHOD_MULTIPLES_RADIUSES() )
+ if ( aCreationMethod->value() == METHOD_MULTIPLES_RADIUSES())
{
std::list<double> coodCurv;
std::list<double> radiuses;
AttributeTablesPtr aTablesAttr;
- if( string(CREATION_METHOD_MULTIPLES_RADIUSES())->value() == CREATION_METHOD_BY_POINTS() )
+ if( string(CREATION_MULTI_RADIUS_METHODE())->value() == CREATION_METHOD_BY_POINTS() )
{
aTablesAttr = tables(VALUES_ID());
return MY_VARYING_RADIUS;
}
- inline static const std::string CREATION_METHOD_MULTIPLES_RADIUSES()
+ inline static const std::string METHOD_MULTIPLES_RADIUSES()
{
static std::string MY_METHOD_MULTIPLES_RADIUSES("multiple_radiuses");
return MY_METHOD_MULTIPLES_RADIUSES;
}
+ inline static const std::string CREATION_MULTI_RADIUS_METHODE()
+ {
+ static std::string MY_CREATION_MULTI_RADIUS_METHODE("multiple_radiuses_methode");
+ return MY_CREATION_MULTI_RADIUS_METHODE;
+ }
+
+ 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;
+ }
inline static const std::string CREATION_METHOD_BY_POINTS()
{
- static std::string MY_CREATION_METHOD_BY_POINTS("by_point_method");
+ static std::string MY_CREATION_METHOD_BY_POINTS("by_points");
return MY_CREATION_METHOD_BY_POINTS;
}
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_EDGES_FACES_LIST_ID;
}
+ /// Attribute name of main objects.
+ inline static const std::string& EDGES_FACES_MULTI_LIST_ID()
+ {
+ static const std::string
+ MY_EDGES_FACES_MULTI_LIST_ID("edges_faces_seleted_multi");
+ return MY_EDGES_FACES_MULTI_LIST_ID;
+ }
/// Attribute name of start radius.
inline static const std::string& START_RADIUS_ID()
{
{
bool isStoreFullHierarchy = data()->version() == CHAMFERFILLET_VERSION_1;
- AttributeSelectionPtr anObject =
+ AttributeSelectionPtr anObject =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
if( anObject.get() )
const Config_WidgetAPI* theData,
bool TypeMethodeBypoint):
ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0),
- myTypeMethodeBypoint(TypeMethodeBypoint),mySetSelection(true)
+ myTypeMethodeBypoint(TypeMethodeBypoint),mySetSelection(true), mySortList(false)
{
QVBoxLayout* aMainLayout = new QVBoxLayout(this);
}
}
}
- else if (theEvent->type() == QEvent::Show ) {
- DataPtr aData = myFeature->data();
- if( myTypeMethodeBypoint )
- aData->string(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES())
- ->setValue(FeaturesPlugin_Fillet::CREATION_METHOD_BY_POINTS() );
- else
- aData->string(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES())
- ->setValue(FeaturesPlugin_Fillet::CREATION_METHOD_BY_CURVILEAR_ABSCISSA() );
- }
return ModuleBase_WidgetSelector::eventFilter(theObject, theEvent);
}
-
-
//**********************************************************************************
bool FeaturesPlugin_WidgetFilletMultiRadiuses::storeValueCustom()
{
aTablesAttr->setValue( getValue( aTblVal ), i, j);
}
}
+
+
+ if(myTypeMethodeBypoint && mySortList ){
+ AttributeSelectionListPtr aSelectionListAttr =
+ aData->selectionList(FeaturesPlugin_Fillet::ARRAY_POINT_RADIUS_BY_POINTS());
+ if( aSelectionListAttr->isInitialized() )
+ {
+ std::map<double,std::pair<QString,QString>>::iterator itValuesSort;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> alist = getAttributeSelection();
+ aSelectionListAttr->clear();
+ itValuesSort = myValuesSort.begin();
+ for(;itValuesSort != myValuesSort.end();++itValuesSort)
+ {
+ std::pair<QString,QString> elem = itValuesSort->second;
+ ResultPtr aResult;
+ GeomShapePtr aShape;
+ foreach(ModuleBase_ViewerPrsPtr aPrs, alist) {
+ aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs->object());
+ aShape = aPrs->shape();
+ if (!aResult.get() && !aShape.get())
+ continue;
+ if (aResult->data()->name()== Locale::Convert::toWString(elem.first.toStdString())) {
+ aSelectionListAttr->append(aResult, aShape);
+ break;
+ }
+ }
+ }
+ }
+ }
return true;
}
else{
aTablesAttr = aData->tables(FeaturesPlugin_Fillet::VALUES_CURV_ID());
}
+
+ if( aTablesAttr->rows() == 0 )
+ {
+ aTablesAttr->setSize(2,2);
+ ModelAPI_AttributeTables::Value aVar;
+ aVar.myDouble = 0.0;
+ aTablesAttr->setValue(aVar,0,0);
+ aVar.myDouble = 1;
+ aTablesAttr->setValue(aVar,0,1);
+ aTablesAttr->setValue(aVar,1,0);
+ aVar.myDouble = 2;
+ aTablesAttr->setValue(aVar,1,1);
+ }
AttributeSelectionPtr anEdges =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(
aData->attribute(FeaturesPlugin_Fillet::EDGE_SELECTED_ID()));
- std::map<double,std::pair<QString,QString>> aValuesSort;
-
+ myValuesSort.clear();
double res;
int aRows = 0;
std::map<double,std::pair<QString,QString>>::iterator itValuesSort;
res = (aPntCurv->distance(first) / taille);
QString aName = QString::fromStdWString(attsel->namingName());
QString aRad = findRadius( QString::number(res) );
- if ( aValuesSort.find( res ) == aValuesSort.end() )
- aValuesSort[ res ] = std::make_pair(aName, aRad );
+ if ( myValuesSort.find( res ) == myValuesSort.end() )
+ myValuesSort[ res ] = std::make_pair(aName, aRad );
i++;
+ mySortList = true;
}
res = 0.0;
- aValuesSort[ res ] = std::make_pair (myfirstRowValue[0], findRadius( QString::number(res) ));
+ myValuesSort[ res ] = std::make_pair (myfirstRowValue[0], findRadius( QString::number(res) ));
res = 1.0;
- aValuesSort[ res ] = std::make_pair (myLastRowValue[0], findRadius( QString::number(res) ));
- aRows = aValuesSort.size();
+ std::cout << "res = restore = " << res << std::endl;
+ myValuesSort[ res ] = std::make_pair (myLastRowValue[0], findRadius( QString::number(res) ));
+ aRows = myValuesSort.size();
}else{
ModelAPI_AttributeTables::Value aVal;
for (int anIndex = 0; anIndex < aTablesAttr->rows(); ++anIndex) {
aVal = aTablesAttr->value(anIndex,0);
double curv = getValueText(aVal).toDouble();
- if ( aValuesSort.find( curv ) == aValuesSort.end() )
- aValuesSort[ curv ] = std::make_pair(getValueText(aVal),
- findRadius(getValueText(aVal)));
+ if ( myValuesSort.find( curv ) == myValuesSort.end() )
+ myValuesSort[ curv ] = std::make_pair(getValueText(aVal),
+ findRadius(getValueText(aVal)));
}
- aRows = aValuesSort.size();
+ aRows = myValuesSort.size();
}else{
res = 0.0;
- aValuesSort[ res ] = std::make_pair (myfirstRowValue[0], myfirstRowValue[2]);
+ myValuesSort[ res ] = std::make_pair (myfirstRowValue[0], myfirstRowValue[2]);
res = 1.0;
- aValuesSort[ res ] = std::make_pair (myLastRowValue[0], myLastRowValue[2]);
+ myValuesSort[ res ] = std::make_pair (myLastRowValue[0], myLastRowValue[2]);
aRows = 2;
}
myDataTbl->setRowCount(aRows);
- itValuesSort = aValuesSort.begin();
+ itValuesSort = myValuesSort.begin();
for (int k = 0; k < aRows; k++, ++itValuesSort ) {
setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues, const bool theToValidate)
{
+ mySortList = false;
if ( theValues.size() > 1 || !myTypeMethodeBypoint || theValues.size() == 0 )
{
mySetSelection = false;
/// \param theToValidate a validation of the values flag
virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
const bool theToValidate);
+
/// Return the attribute values wrapped in a list of viewer presentations
/// \return a list of viewer presentations, which contains an attribute result and
/// a shape. If the attribute do not uses the shape, it is empty
bool mySetSelection;
+ bool mySortList;
+
DataArrayItemDelegate* myDelegate;
std::vector<QString> myfirstRowValue;
std::vector<QString> myLastRowValue;
+ std::map<double,std::pair<QString,QString>> myValuesSort;
};
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
- <validator id="FeaturesPlugin_ValidatorFilletSelection"/>
+ <validator id="FeaturesPlugin_ValidatorFilletSelection" parameters="edge,wire,face"/>
</multi_selector>
<doublevalue id="radius1"
label="Start radius"
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="PartSet_DifferentObjects"/>
- <validator id="FeaturesPlugin_ValidatorFilletSelectionEdge"/>
- </shape_selector>
- <multiradius-panel id="array_point_radius_by_point"
- filter_points="false">
- <validator id="GeomValidators_ShapeType" parameters="empty,vertex"/>
- </multiradius-panel>
- <validator id="FeaturesPlugin_ValidatorFilletSelection" parameters = "main_objects"/>
- </box>
- <box id="by_curvilinear_abscissa_methode"
+ <toolbox id="multiple_radiuses_methode">
+ <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"
+ <multi_selector id="edges_faces_seleted_multi"
label="Edges or/and faces"
icon=""
tooltip="Select objects"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
- <validator id="FeaturesPlugin_ValidatorFilletSelection"/>
+ <validator id="FeaturesPlugin_ValidatorFilletSelection" parameters="edge,wire,face"/>
</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"
+ icon="icons/Features/fillet_multiradius_by_point.png">
+ <shape_selector id="edge_selected"
+ icon="icons/Features/edge.png"
+ tooltip="Select edge"
+ shape_types="edge"
+ use_choice="false"
+ concealment="true">
+ <validator id="PartSet_DifferentObjects"/>
+ <validator id="FeaturesPlugin_ValidatorFilletSelectionEdge" parameters="edge,wire"/>
+ </shape_selector>
+ <multiradius-panel id="array_point_radius_by_point"
+ filter_points="false">
+ <validator id="GeomValidators_ShapeType" parameters="empty,vertex"/>
+ </multiradius-panel>
+ </box>
</toolbox>
</box>
</toolbox>