+ Fix for subelements of SelectionObject, fix for SketchObjectPy::fillet()
This commit is contained in:
parent
6593dc97b8
commit
540bf6e655
|
@ -352,7 +352,7 @@ bool SelectionSingleton::hasSelection(const char* doc) const
|
||||||
// typeId = App::DocumentObject::getClassTypeId();
|
// typeId = App::DocumentObject::getClassTypeId();
|
||||||
// return getSelectionEx(pDocName,typeId);
|
// return getSelectionEx(pDocName,typeId);
|
||||||
//}
|
//}
|
||||||
std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDocName,Base::Type typeId) const
|
std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDocName, Base::Type typeId) const
|
||||||
{
|
{
|
||||||
std::vector<SelectionObject> temp;
|
std::vector<SelectionObject> temp;
|
||||||
|
|
||||||
|
@ -373,26 +373,31 @@ std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDoc
|
||||||
for (std::list<_SelObj>::const_iterator It = _SelList.begin();It != _SelList.end();++It) {
|
for (std::list<_SelObj>::const_iterator It = _SelList.begin();It != _SelList.end();++It) {
|
||||||
if (It->pDoc == pcDoc) {
|
if (It->pDoc == pcDoc) {
|
||||||
// right type?
|
// right type?
|
||||||
if(It->pObject->getTypeId().isDerivedFrom(typeId)){
|
if (It->pObject->getTypeId().isDerivedFrom(typeId)){
|
||||||
// if the object has already an entry
|
// if the object has already an entry
|
||||||
if (SortMap.find(It->pObject) != SortMap.end()){
|
if (SortMap.find(It->pObject) != SortMap.end()){
|
||||||
// only add sub-element
|
// only add sub-element
|
||||||
|
if (!It->SubName.empty()) {
|
||||||
SortMap[It->pObject].SubNames.push_back(It->SubName);
|
SortMap[It->pObject].SubNames.push_back(It->SubName);
|
||||||
SortMap[It->pObject].SelPoses.push_back(Base::Vector3d(It->x,It->y,It->z));
|
SortMap[It->pObject].SelPoses.push_back(Base::Vector3d(It->x,It->y,It->z));
|
||||||
}
|
}
|
||||||
else{
|
}
|
||||||
|
else {
|
||||||
// create a new entry
|
// create a new entry
|
||||||
SelectionObject tempSelObj;
|
SelectionObject tempSelObj;
|
||||||
tempSelObj.DocName = It->DocName;
|
tempSelObj.DocName = It->DocName;
|
||||||
tempSelObj.FeatName = It->FeatName;
|
tempSelObj.FeatName = It->FeatName;
|
||||||
tempSelObj.SubNames.push_back(It->SubName);
|
|
||||||
tempSelObj.TypeName = It->TypeName.c_str();
|
tempSelObj.TypeName = It->TypeName.c_str();
|
||||||
|
if (!It->SubName.empty()) {
|
||||||
|
tempSelObj.SubNames.push_back(It->SubName);
|
||||||
tempSelObj.SelPoses.push_back(Base::Vector3d(It->x,It->y,It->z));
|
tempSelObj.SelPoses.push_back(Base::Vector3d(It->x,It->y,It->z));
|
||||||
|
}
|
||||||
SortMap.insert(std::pair<App::DocumentObject*,SelectionObject>(It->pObject,tempSelObj));
|
SortMap.insert(std::pair<App::DocumentObject*,SelectionObject>(It->pObject,tempSelObj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::map<App::DocumentObject*,SelectionObject>::const_iterator It = SortMap.begin();It != SortMap.end();++It)
|
for (std::map<App::DocumentObject*,SelectionObject>::const_iterator It = SortMap.begin();It != SortMap.end();++It)
|
||||||
temp.push_back(It->second);
|
temp.push_back(It->second);
|
||||||
|
|
||||||
|
|
|
@ -284,10 +284,11 @@ PyObject* SketchObjectPy::fillet(PyObject *args)
|
||||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Point, radius
|
Py_Return;
|
||||||
}
|
}
|
||||||
PyErr_Clear();
|
|
||||||
|
|
||||||
|
PyErr_Clear();
|
||||||
|
// Point, radius
|
||||||
if (PyArg_ParseTuple(args, "iid|i", &geoId1, &posId1, &radius, &trim)) {
|
if (PyArg_ParseTuple(args, "iid|i", &geoId1, &posId1, &radius, &trim)) {
|
||||||
if (this->getSketchObjectPtr()->fillet(geoId1, (Sketcher::PointPos) posId1, radius, trim?true:false)) {
|
if (this->getSketchObjectPtr()->fillet(geoId1, (Sketcher::PointPos) posId1, radius, trim?true:false)) {
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
|
@ -295,8 +296,13 @@ PyObject* SketchObjectPy::fillet(PyObject *args)
|
||||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Py_Return;
|
Py_Return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyErr_SetString(PyExc_TypeError, "fillet() method accepts:\n"
|
||||||
|
"-- int,int,Vector,Vector,float,[int]\n"
|
||||||
|
"-- int,int,float,[int]\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* SketchObjectPy::trim(PyObject *args)
|
PyObject* SketchObjectPy::trim(PyObject *args)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user