[PartDesign] Dynamic hole cut-types
‣ Make countersink and counterbore on metric holes freely definable by user. ‣ Fixed the Naming of M1.6, M2, M2.5 and M3.5 ‣ Added constructor for custom enums from Enums to PropertyEnumeration ‣ Put definitions of cut-types (counterbore/countersink) for screwtypes into json-files for easy modification. ‣ Allow users to put its own definitions in json-files in [UserDir]/Mod/PartDesign/Resources/Hole ‣ Contains several examples of cut-type definition json-files that are propably not production-ready. This uses a local copy of nlohmann::json¹ to read json-files. __________ ¹ This is a very nice,header-only C++ library under the MIT License (https://github.com/nlohmann/json). I copied the single-file-version and the forward-declaration-header into …/PartDesign/App/ so no new dependencies arise.
This commit is contained in:
@@ -329,6 +329,17 @@ void PropertyEnumeration::setEnums(const char **plEnums)
|
||||
_enum._index = std::min<int>(index, max);
|
||||
}
|
||||
|
||||
void PropertyEnumeration::setEnums(const std::vector<std::string> &Enums)
|
||||
{
|
||||
if (_enum.isValid()) {
|
||||
const std::string &index = getValueAsString();
|
||||
_enum.setEnums(Enums);
|
||||
setValue(index.c_str());
|
||||
} else {
|
||||
_enum.setEnums(Enums);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyEnumeration::setValue(const char *value)
|
||||
{
|
||||
aboutToSetValue();
|
||||
|
||||
Reference in New Issue
Block a user