Attacher: Py: renames

AttachEngine attributes and methods:
getShapeType -> getRefTypeOfShape
isShapeOfType -> isFittingRefType
downgradeType -> downgradeRefType
getTypeRank -> deleted (rank exposed through getRefTypeInfo )
getTypeInfo -> getRefTypeInfo
suggestMapModes -> suggestModes
This commit is contained in:
DeepSOIC 2016-05-13 18:41:12 +03:00
parent 632cf142fe
commit 98a472b18d
2 changed files with 18 additions and 35 deletions

View File

@ -77,29 +77,24 @@
<UserDocu>getModeInfo(mode): returns supported reference combinations, user-friendly name, and so on.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getShapeType">
<Methode Name="getRefTypeOfShape">
<Documentation>
<UserDocu>getShapeType(shape): returns shape type as interpreted by AttachEngine. Returns a string.</UserDocu>
<UserDocu>getRefTypeOfShape(shape): returns shape type as interpreted by AttachEngine. Returns a string.</UserDocu>
</Documentation>
</Methode>
<Methode Name="isShapeOfType">
<Methode Name="isFittingRefType">
<Documentation>
<UserDocu>isShapeOfType(type_shape, type_needed): tests if shape type, specified by type_shape (string), fits a type required by attachment mode type_needed (string). e.g. 'Circle' fits a requirement of 'Edge', and 'Curve' doesn't fit if a 'Circle' is required.</UserDocu>
<UserDocu>isFittingRefType(type_shape, type_needed): tests if shape type, specified by type_shape (string), fits a type required by attachment mode type_needed (string). e.g. 'Circle' fits a requirement of 'Edge', and 'Curve' doesn't fit if a 'Circle' is required.</UserDocu>
</Documentation>
</Methode>
<Methode Name="downgradeType">
<Methode Name="downgradeRefType">
<Documentation>
<UserDocu>downgradeType(type): returns next more general type. E.g. downgradeType('Circle') yeilds 'Curve'.</UserDocu>
<UserDocu>downgradeRefType(type): returns next more general type. E.g. downgradeType('Circle') yeilds 'Curve'.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getTypeRank">
<Methode Name="getRefTypeInfo">
<Documentation>
<UserDocu>getTypeRank(type): returns rank of shape type. Rank is how many times the type can be downgraded, before it becomes 'Any'.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getTypeInfo">
<Documentation>
<UserDocu>getTypeInfo(type): returns information (dict) on shape type. Keys:'UserFriendlyName', 'TypeIndex'.</UserDocu>
<UserDocu>getRefTypeInfo(type): returns information (dict) on shape type. Keys:'UserFriendlyName', 'TypeIndex'.</UserDocu>
</Documentation>
</Methode>
<Methode Name="copy" Const="true">
@ -120,10 +115,10 @@ Returns the new placement. If not attached, returns None. If attachment fails,
an exception is raised.</UserDocu>
</Documentation>
</Methode>
<Methode Name="suggestMapModes">
<Methode Name="suggestModes">
<Documentation>
<UserDocu>suggestMapModes(): runs mode suggestion routine and returns a dictionary with
<UserDocu>suggestModes(): runs mode suggestion routine and returns a dictionary with
results and supplementary information.
Keys:

View File

@ -292,7 +292,7 @@ PyObject* AttachEnginePy::getModeInfo(PyObject* args)
} ATTACHERPY_STDCATCH_METH;
}
PyObject* AttachEnginePy::getShapeType(PyObject* args)
PyObject* AttachEnginePy::getRefTypeOfShape(PyObject* args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapePy::Type), &pcObj))
@ -305,7 +305,7 @@ PyObject* AttachEnginePy::getShapeType(PyObject* args)
} ATTACHERPY_STDCATCH_METH;
}
PyObject* AttachEnginePy::isShapeOfType(PyObject* args)
PyObject* AttachEnginePy::isFittingRefType(PyObject* args)
{
char* type_shape_str;
char* type_need_str;
@ -319,7 +319,7 @@ PyObject* AttachEnginePy::isShapeOfType(PyObject* args)
} ATTACHERPY_STDCATCH_METH;
}
PyObject* AttachEnginePy::downgradeType(PyObject* args)
PyObject* AttachEnginePy::downgradeRefType(PyObject* args)
{
char* type_shape_str;
if (!PyArg_ParseTuple(args, "s", &type_shape_str))
@ -331,20 +331,7 @@ PyObject* AttachEnginePy::downgradeType(PyObject* args)
} ATTACHERPY_STDCATCH_METH;
}
PyObject* AttachEnginePy::getTypeRank(PyObject* args)
{
char* type_shape_str;
if (!PyArg_ParseTuple(args, "s", &type_shape_str))
return 0;
try {
eRefType type_shape = AttachEngine::getRefTypeByName(std::string(type_shape_str));
int result = AttachEngine::getTypeRank(type_shape);
return Py::new_reference_to(Py::Int(result));
} ATTACHERPY_STDCATCH_METH;
}
PyObject* AttachEnginePy::getTypeInfo(PyObject* args)
PyObject* AttachEnginePy::getRefTypeInfo(PyObject* args)
{
char* typeName;
if (!PyArg_ParseTuple(args, "s", &typeName))
@ -355,6 +342,7 @@ PyObject* AttachEnginePy::getTypeInfo(PyObject* args)
eRefType rt = attacher.getRefTypeByName(typeName);
Py::Dict ret;
ret["TypeIndex"] = Py::Int(rt);
ret["Rank"] = Py::Int(AttachEngine::getTypeRank(rt));
try {
Py::Module module(PyImport_ImportModule("PartGui"),true);
@ -374,11 +362,11 @@ PyObject* AttachEnginePy::getTypeInfo(PyObject* args)
Base::Console().Warning("AttachEngine: Gui not up, so no gui-related entries in getModeInfo.\n");
e.clear();
} else {
Base::Console().Warning("AttachEngine.getTypeInfo: error obtaining GUI strings\n");
Base::Console().Warning("AttachEngine.getRefTypeInfo: error obtaining GUI strings\n");
e.clear();
}
} catch (Base::Exception &e){
Base::Console().Warning("AttachEngine.getTypeInfo: error obtaining GUI strings:");
Base::Console().Warning("AttachEngine.getRefTypeInfo: error obtaining GUI strings:");
Base::Console().Warning(e.what());
Base::Console().Warning("\n");
}
@ -415,7 +403,7 @@ PyObject* AttachEnginePy::calculateAttachedPlacement(PyObject* args)
return NULL;
}
PyObject* AttachEnginePy::suggestMapModes(PyObject* args)
PyObject* AttachEnginePy::suggestModes(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;