[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();
|
||||
|
||||
@@ -153,10 +153,17 @@ public:
|
||||
* \endcode
|
||||
*/
|
||||
void setEnums(const char** plEnums);
|
||||
|
||||
/** setting the enumaration string as vector of strings
|
||||
* This makes the enumeration custom.
|
||||
*/
|
||||
void setEnums(const std::vector<std::string> &Enums);
|
||||
|
||||
/** set the enum by a string
|
||||
* is slower than setValue(long). Use long if possible
|
||||
*/
|
||||
void setValue(const char* value);
|
||||
|
||||
/** set directly the enum value
|
||||
* In DEBUG checks for boundaries.
|
||||
* Is faster than using setValue(const char*).
|
||||
|
||||
@@ -56,13 +56,16 @@
|
||||
#include <Base/Placement.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Application.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
#include "json.hpp"
|
||||
#include "FeatureHole.h"
|
||||
|
||||
using namespace PartDesign;
|
||||
namespace PartDesign {
|
||||
|
||||
/* TRANSLATOR PartDesign::Hole */
|
||||
|
||||
@@ -92,11 +95,11 @@ const Hole::ThreadDescription Hole::threadDescription[][171] =
|
||||
|
||||
/* ISO metric coarse */
|
||||
{
|
||||
{ "M1.60", 1.60, 0.35 },
|
||||
{ "M2.00", 2.00, 0.40 },
|
||||
{ "M2.50", 2.50, 0.45 },
|
||||
{ "M1.6", 1.60, 0.35 },
|
||||
{ "M2", 2.00, 0.40 },
|
||||
{ "M2.5", 2.50, 0.45 },
|
||||
{ "M3", 3.00, 0.50 },
|
||||
{ "M3.50", 3.50, 0.60 },
|
||||
{ "M3.5", 3.50, 0.60 },
|
||||
{ "M4", 4.00, 0.70 },
|
||||
{ "M5", 5.00, 0.80 },
|
||||
{ "M6", 6.00, 1.00 },
|
||||
@@ -354,16 +357,16 @@ const Hole::ThreadDescription Hole::threadDescription[][171] =
|
||||
};
|
||||
|
||||
/* ISO coarse metric enums */
|
||||
const char* Hole::HoleCutType_ISOmetric_Enums[] = { "None", "Counterbore", "Countersink", "Cheesehead", "Countersink socket screw", "Cap screw", NULL};
|
||||
const char* Hole::ThreadSize_ISOmetric_Enums[] = { "M1.60", "M2", "M2.50", "M3",
|
||||
"M3.50", "M4", "M5", "M6",
|
||||
std::vector<std::string> Hole::HoleCutType_ISOmetric_Enums = { "None", "Counterbore", "Countersink", "Cheesehead (deprecated)", "Countersink socket screw (deprecated)", "Cap screw (deprecated)" };
|
||||
const char* Hole::ThreadSize_ISOmetric_Enums[] = { "M1.6", "M2", "M2.5", "M3",
|
||||
"M3.5", "M4", "M5", "M6",
|
||||
"M8", "M10", "M12", "M14",
|
||||
"M16", "M20", "M22", "M24",
|
||||
"M27", "M30", "M36", "M42",
|
||||
"M48", "M56", "M64", "M68", NULL };
|
||||
const char* Hole::ThreadClass_ISOmetric_Enums[] = { "4G", "4H", "5G", "5H", "6G", "6H", "7G", "7H","8G", "8H", NULL };
|
||||
|
||||
const char* Hole::HoleCutType_ISOmetricfine_Enums[] = { "None", "Counterbore", "Countersink", "Cheesehead", "Countersink socket screw", "Cap screw", NULL};
|
||||
std::vector<std::string> Hole::HoleCutType_ISOmetricfine_Enums = { "None", "Counterbore", "Countersink", "Cheesehead (deprecated)", "Countersink socket screw (deprecated)", "Cap screw (deprecated)" };
|
||||
const char* Hole::ThreadSize_ISOmetricfine_Enums[] = {
|
||||
"M1.0x0.2", "M1.1x0.2", "M1.2x0.2", "M1.4z0.2",
|
||||
"M1.6x0.2", "M1.8x0.2", "M2x0.25", "M2.2x0.25",
|
||||
@@ -442,6 +445,8 @@ Hole::Hole()
|
||||
{
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
|
||||
readCutDefinitions();
|
||||
|
||||
ADD_PROPERTY_TYPE(Threaded, ((long)0), "Hole", App::Prop_None, "Threaded");
|
||||
|
||||
ADD_PROPERTY_TYPE(ModelActualThread, ((long)0), "Hole", App::Prop_None, "Model actual thread");
|
||||
@@ -501,29 +506,49 @@ void Hole::updateHoleCutParams()
|
||||
throw Base::IndexError("Thread type out of range");
|
||||
if (ThreadSize.getValue() < 0)
|
||||
throw Base::IndexError("Thread size out of range");
|
||||
double diameter = PartDesign::Hole::threadDescription[ThreadType.getValue()][ThreadSize.getValue()].diameter;
|
||||
double f = 1.0;
|
||||
double depth = 0;
|
||||
|
||||
if (holeCutType == "None" ||
|
||||
holeCutType == "Counterbore" ||
|
||||
holeCutType == "Countersink" ) {
|
||||
return;
|
||||
// cut definition
|
||||
if (HoleCutTypeMap.count(holeCutType) ) {
|
||||
std::string threadSize { ThreadSize.getValueAsString() };
|
||||
const CutDimensionSet &counter = HoleCutTypeMap.find(holeCutType)->second;
|
||||
if (counter.cut_type == CutDimensionSet::Counterbore) {
|
||||
const CounterBoreDimension &dimen = counter.get_bore(threadSize);
|
||||
if (dimen.thread == "None") {
|
||||
// valid values for visual feedback
|
||||
HoleCutDiameter.setValue(Diameter.getValue() + 0.1);
|
||||
HoleCutDepth.setValue(0.1);
|
||||
} else {
|
||||
HoleCutDiameter.setValue(dimen.diameter);
|
||||
HoleCutDepth.setValue(dimen.depth);
|
||||
}
|
||||
} else if (counter.cut_type == CutDimensionSet::Countersink) {
|
||||
const CounterSinkDimension &dimen = counter.get_sink(threadSize);
|
||||
if (dimen.thread == "None") {
|
||||
// valid values for visual feedback
|
||||
HoleCutDiameter.setValue(Diameter.getValue() + 0.1);
|
||||
} else {
|
||||
HoleCutDiameter.setValue(dimen.diameter);
|
||||
HoleCutCountersinkAngle.setValue(counter.angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (holeCutType == "Cheesehead") {
|
||||
f = 1.6;
|
||||
depth = 0.6;
|
||||
// handle legacy types but don’t change user settings for
|
||||
// user defined None, Counterbore and Countersink
|
||||
else if (holeCutType == "Cheesehead (deprecated)") {
|
||||
double diameter = threadDescription[ThreadType.getValue()][ThreadSize.getValue()].diameter;
|
||||
HoleCutDiameter.setValue(diameter * 1.6);
|
||||
HoleCutDepth.setValue(diameter * 0.6);
|
||||
}
|
||||
else if (holeCutType == "Countersink socket screw") {
|
||||
f = 2.0;
|
||||
depth = 0;
|
||||
else if (holeCutType == "Countersink socket screw (deprecated)") {
|
||||
double diameter = threadDescription[ThreadType.getValue()][ThreadSize.getValue()].diameter;
|
||||
HoleCutDiameter.setValue(diameter * 2.0);
|
||||
HoleCutDepth.setValue(diameter * 0.0);
|
||||
}
|
||||
else if (holeCutType == "Cap screw") {
|
||||
f = 1.5;
|
||||
depth = 1.25;
|
||||
else if (holeCutType == "Cap screw (deprecated)") {
|
||||
double diameter = threadDescription[ThreadType.getValue()][ThreadSize.getValue()].diameter;
|
||||
HoleCutDiameter.setValue(diameter * 1.5);
|
||||
HoleCutDepth.setValue(diameter * 1.25);
|
||||
}
|
||||
HoleCutDiameter.setValue(diameter * f);
|
||||
HoleCutDepth.setValue(diameter * depth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,6 +629,7 @@ void Hole::onChanged(const App::Property *prop)
|
||||
ThreadFit.setReadOnly(true);
|
||||
ThreadClass.setReadOnly(true);
|
||||
Diameter.setReadOnly(false);
|
||||
Threaded.setValue(0);
|
||||
}
|
||||
else if ( type == "ISOMetricProfile" ) {
|
||||
ThreadSize.setEnums(ThreadSize_ISOmetric_Enums);
|
||||
@@ -765,7 +791,6 @@ void Hole::onChanged(const App::Property *prop)
|
||||
std::string holeCutType;
|
||||
if (HoleCutType.isValid())
|
||||
holeCutType = HoleCutType.getValueAsString();
|
||||
|
||||
if (holeCutType == "None") {
|
||||
HoleCutDiameter.setReadOnly(true);
|
||||
HoleCutDepth.setReadOnly(true);
|
||||
@@ -781,7 +806,7 @@ void Hole::onChanged(const App::Property *prop)
|
||||
HoleCutDepth.setReadOnly(true);
|
||||
HoleCutCountersinkAngle.setReadOnly(false);
|
||||
}
|
||||
else {
|
||||
else { // screw definition
|
||||
HoleCutDiameter.setReadOnly(true);
|
||||
HoleCutDepth.setReadOnly(true);
|
||||
HoleCutCountersinkAngle.setReadOnly(true);
|
||||
@@ -992,8 +1017,13 @@ App::DocumentObjectExecReturn *Hole::execute(void)
|
||||
|
||||
BRepBuilderAPI_MakeWire mkWire;
|
||||
std::string holeCutType = HoleCutType.getValueAsString();
|
||||
bool isCountersink = (holeCutType == "Countersink" || holeCutType == "Countersink socket screw");
|
||||
bool isCounterbore = (holeCutType == "Counterbore" || holeCutType == "Cheesehead" || holeCutType == "Cap screw");
|
||||
bool isCountersink = (holeCutType == "Countersink" ||
|
||||
holeCutType == "Countersink socket screw (deprecated)" ||
|
||||
isDynamicCountersink(holeCutType));
|
||||
bool isCounterbore = (holeCutType == "Counterbore" ||
|
||||
holeCutType == "Cheesehead (deprecated)" ||
|
||||
holeCutType == "Cap screw (deprecated)" ||
|
||||
isDynamicCounterbore(holeCutType));
|
||||
double hasTaperedAngle = Tapered.getValue() ? Base::toRadians( TaperedAngle.getValue() ) : Base::toRadians(90.0);
|
||||
double radiusBottom = Diameter.getValue() / 2.0 - length * 1.0 / tan( hasTaperedAngle );
|
||||
double radius = Diameter.getValue() / 2.0;
|
||||
@@ -1270,3 +1300,149 @@ App::DocumentObjectExecReturn *Hole::execute(void)
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void Hole::addCounterType(const CutDimensionSet dimensions)
|
||||
{
|
||||
HoleCutTypeMap.emplace(dimensions.name, dimensions);
|
||||
const std::string &name = dimensions.name;
|
||||
std::vector<std::string> *list;
|
||||
switch(dimensions.thread_type) {
|
||||
case CutDimensionSet::Metric:
|
||||
list = &HoleCutType_ISOmetric_Enums;
|
||||
break;
|
||||
case CutDimensionSet::MetricFine:
|
||||
list = &HoleCutType_ISOmetricfine_Enums;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (std::all_of(list->begin(), list->end(),
|
||||
[name](const std::string &x){ return x != name; }))
|
||||
list->push_back(dimensions.name);
|
||||
}
|
||||
|
||||
bool Hole::isDynamicCounterbore(const std::string &holeCutType)
|
||||
{
|
||||
return HoleCutTypeMap.count(holeCutType) &&
|
||||
HoleCutTypeMap.find(holeCutType)->second.cut_type == CutDimensionSet::Counterbore;
|
||||
}
|
||||
|
||||
bool Hole::isDynamicCountersink(const std::string &holeCutType)
|
||||
{
|
||||
return HoleCutTypeMap.count(holeCutType) &&
|
||||
HoleCutTypeMap.find(holeCutType)->second.cut_type == CutDimensionSet::Countersink;
|
||||
}
|
||||
|
||||
/*
|
||||
* Counter Dimensions
|
||||
*/
|
||||
|
||||
const Hole::CounterBoreDimension Hole::CounterBoreDimension::nothing { "None", 0.0, 0.0 };
|
||||
const Hole::CounterSinkDimension Hole::CounterSinkDimension::nothing { "None", 0.0 };
|
||||
|
||||
Hole::CutDimensionSet::CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterBoreDimension> &&d, CutType cut, ThreadType thread) :
|
||||
bore_data{ std::move(d) }, cut_type{ cut }, thread_type{thread}, name{nme}
|
||||
{
|
||||
}
|
||||
|
||||
Hole::CutDimensionSet::CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterSinkDimension> &&d, CutType cut, ThreadType thread) :
|
||||
sink_data{ std::move(d) }, cut_type{ cut }, thread_type{thread}, name{nme}
|
||||
{
|
||||
}
|
||||
|
||||
const Hole::CounterBoreDimension &Hole::CutDimensionSet::get_bore(const std::string &t) const
|
||||
{
|
||||
auto i = std::find_if(bore_data.begin(), bore_data.end(),
|
||||
[t](const Hole::CounterBoreDimension &x) { return x.thread == t; } );
|
||||
if (i == bore_data.end())
|
||||
return CounterBoreDimension::nothing;
|
||||
else
|
||||
return *i;
|
||||
}
|
||||
|
||||
const Hole::CounterSinkDimension &Hole::CutDimensionSet::get_sink(const std::string &t) const
|
||||
{
|
||||
auto i = std::find_if(sink_data.begin(), sink_data.end(),
|
||||
[t](const Hole::CounterSinkDimension &x) { return x.thread == t; } );
|
||||
if (i == sink_data.end())
|
||||
return CounterSinkDimension::nothing;
|
||||
else
|
||||
return *i;
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, Hole::CounterBoreDimension &t)
|
||||
{
|
||||
t.thread = j["thread"].get<std::string>();
|
||||
t.diameter = j["diameter"].get<double>();
|
||||
t.depth = j["depth"].get<double>();
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, Hole::CounterSinkDimension &t)
|
||||
{
|
||||
t.thread = j["thread"].get<std::string>();
|
||||
t.diameter = j["diameter"].get<double>();
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, Hole::CutDimensionSet &t)
|
||||
{
|
||||
t.name = j["name"].get<std::string>();
|
||||
|
||||
std::string thread_type_string = j["thread_type"].get<std::string>();
|
||||
if (thread_type_string == "metric")
|
||||
t.thread_type = Hole::CutDimensionSet::Metric;
|
||||
else if (thread_type_string == "metricfine")
|
||||
t.thread_type = Hole::CutDimensionSet::MetricFine;
|
||||
else
|
||||
throw Base::IndexError(std::string("Thread type ‘") + thread_type_string + "’ unsupported");
|
||||
|
||||
std::string cut_type_string = j["cut_type"].get<std::string>();
|
||||
if (cut_type_string == "counterbore") {
|
||||
t.cut_type = Hole::CutDimensionSet::Counterbore;
|
||||
t.bore_data = j["data"].get<std::vector<Hole::CounterBoreDimension> >();
|
||||
t.angle = 0.0;
|
||||
} else if (cut_type_string == "countersink") {
|
||||
t.cut_type = Hole::CutDimensionSet::Countersink;
|
||||
t.sink_data = j["data"].get<std::vector<Hole::CounterSinkDimension> >();
|
||||
t.angle = j["angle"].get<double>();
|
||||
}
|
||||
else
|
||||
throw Base::IndexError(std::string("Cut type ‘") + cut_type_string + "’ unsupported");
|
||||
|
||||
t.name = j["name"].get<std::string>();
|
||||
}
|
||||
|
||||
void Hole::readCutDefinitions()
|
||||
{
|
||||
const char subpath[] = "Mod/PartDesign/Resources/Hole";
|
||||
std::vector<std::string> dirs {
|
||||
::App::Application::getResourceDir() + subpath,
|
||||
::App::Application::getUserAppDataDir() + subpath,
|
||||
};
|
||||
|
||||
std::cerr << "Looking for thread definitons in: ";
|
||||
for (auto &i : dirs)
|
||||
std::cerr << i << " ";
|
||||
std::cerr << "\n";
|
||||
for (auto &dir : dirs) {
|
||||
std::vector<::Base::FileInfo> files { ::Base::FileInfo(dir).getDirectoryContent() };
|
||||
for (const auto &f : files) {
|
||||
if (f.extension() == "json") {
|
||||
//std::cerr << "reading: " << f.filePath() << "\n";
|
||||
try {
|
||||
std::ifstream input(f.filePath());
|
||||
nlohmann::json j;
|
||||
input >> j;
|
||||
CutDimensionSet screwtype = j.get<CutDimensionSet>();
|
||||
addCounterType(screwtype);
|
||||
}
|
||||
catch(std::exception &e) {
|
||||
std::cerr << "Failed reading ‘" << f.filePath() << "’ with: "<< e.what() << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace PartDesign
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define PARTDESIGN_Hole_H
|
||||
|
||||
#include <App/PropertyUnits.h>
|
||||
#include "json_fwd.hpp"
|
||||
#include "FeatureSketchBased.h"
|
||||
|
||||
class Property;
|
||||
@@ -105,12 +106,12 @@ private:
|
||||
static const char* ThreadClass_None_Enums[];
|
||||
|
||||
/* ISO metric coarse profile */
|
||||
static const char* HoleCutType_ISOmetric_Enums[];
|
||||
static std::vector<std::string> HoleCutType_ISOmetric_Enums;
|
||||
static const char* ThreadSize_ISOmetric_Enums[];
|
||||
static const char* ThreadClass_ISOmetric_Enums[];
|
||||
|
||||
/* ISO metric fine profile */
|
||||
static const char* HoleCutType_ISOmetricfine_Enums[];
|
||||
static std::vector<std::string> HoleCutType_ISOmetricfine_Enums;
|
||||
static const char* ThreadSize_ISOmetricfine_Enums[];
|
||||
static const char* ThreadClass_ISOmetricfine_Enums[];
|
||||
|
||||
@@ -129,8 +130,58 @@ private:
|
||||
static const char* ThreadSize_UNEF_Enums[];
|
||||
static const char* ThreadClass_UNEF_Enums[];
|
||||
|
||||
/* Counter-xxx */
|
||||
//public:
|
||||
// Dimension for counterbore
|
||||
struct CounterBoreDimension {
|
||||
std::string thread;
|
||||
double diameter;
|
||||
double depth;
|
||||
static const CounterBoreDimension nothing;
|
||||
};
|
||||
// Dimension for countersink
|
||||
struct CounterSinkDimension {
|
||||
std::string thread;
|
||||
double diameter;
|
||||
static const CounterSinkDimension nothing;
|
||||
};
|
||||
|
||||
// cut dimensions for a screwtype
|
||||
class CutDimensionSet {
|
||||
public:
|
||||
enum CutType { Counterbore, Countersink };
|
||||
enum ThreadType { Metric, MetricFine };
|
||||
|
||||
CutDimensionSet() {}
|
||||
CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterBoreDimension> &&d, CutType cut, ThreadType thread);
|
||||
CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterSinkDimension> &&d, CutType cut, ThreadType thread);
|
||||
|
||||
const CounterBoreDimension &get_bore(const std::string &t) const;
|
||||
const CounterSinkDimension &get_sink(const std::string &t) const;
|
||||
|
||||
std::vector<CounterBoreDimension> bore_data;
|
||||
std::vector<CounterSinkDimension> sink_data;
|
||||
CutType cut_type;
|
||||
ThreadType thread_type;
|
||||
std::string name;
|
||||
double angle;
|
||||
};
|
||||
|
||||
std::map<std::string, CutDimensionSet> HoleCutTypeMap;
|
||||
|
||||
void addCounterType(const CutDimensionSet dimensions);
|
||||
bool isDynamicCounterbore(const std::string &holeCutType);
|
||||
bool isDynamicCountersink(const std::string &holeCutType);
|
||||
void updateHoleCutParams();
|
||||
void updateDiameterParam();
|
||||
void readCutDefinitions();
|
||||
|
||||
// helpers for nlohmann json
|
||||
friend void from_json(const nlohmann::json &j, CounterBoreDimension &t);
|
||||
friend void from_json(const nlohmann::json &j, CounterSinkDimension &t);
|
||||
friend void from_json(const nlohmann::json &j, CutDimensionSet &t);
|
||||
};
|
||||
|
||||
} //namespace PartDesign
|
||||
|
||||
25447
src/Mod/PartDesign/App/json.hpp
Normal file
25447
src/Mod/PartDesign/App/json.hpp
Normal file
File diff suppressed because it is too large
Load Diff
78
src/Mod/PartDesign/App/json_fwd.hpp
Normal file
78
src/Mod/PartDesign/App/json_fwd.hpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
||||
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
||||
|
||||
#include <cstdint> // int64_t, uint64_t
|
||||
#include <map> // map
|
||||
#include <memory> // allocator
|
||||
#include <string> // string
|
||||
#include <vector> // vector
|
||||
|
||||
/*!
|
||||
@brief namespace for Niels Lohmann
|
||||
@see https://github.com/nlohmann
|
||||
@since version 1.0.0
|
||||
*/
|
||||
namespace nlohmann
|
||||
{
|
||||
/*!
|
||||
@brief default JSONSerializer template argument
|
||||
|
||||
This serializer ignores the template arguments and uses ADL
|
||||
([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
|
||||
for serialization.
|
||||
*/
|
||||
template<typename T = void, typename SFINAE = void>
|
||||
struct adl_serializer;
|
||||
|
||||
template<template<typename U, typename V, typename... Args> class ObjectType =
|
||||
std::map,
|
||||
template<typename U, typename... Args> class ArrayType = std::vector,
|
||||
class StringType = std::string, class BooleanType = bool,
|
||||
class NumberIntegerType = std::int64_t,
|
||||
class NumberUnsignedType = std::uint64_t,
|
||||
class NumberFloatType = double,
|
||||
template<typename U> class AllocatorType = std::allocator,
|
||||
template<typename T, typename SFINAE = void> class JSONSerializer =
|
||||
adl_serializer,
|
||||
class BinaryType = std::vector<std::uint8_t>>
|
||||
class basic_json;
|
||||
|
||||
/*!
|
||||
@brief JSON Pointer
|
||||
|
||||
A JSON pointer defines a string syntax for identifying a specific value
|
||||
within a JSON document. It can be used with functions `at` and
|
||||
`operator[]`. Furthermore, JSON pointers are the base for JSON patches.
|
||||
|
||||
@sa [RFC 6901](https://tools.ietf.org/html/rfc6901)
|
||||
|
||||
@since version 2.0.0
|
||||
*/
|
||||
template<typename BasicJsonType>
|
||||
class json_pointer;
|
||||
|
||||
/*!
|
||||
@brief default JSON class
|
||||
|
||||
This type is the default specialization of the @ref basic_json class which
|
||||
uses the standard template types.
|
||||
|
||||
@since version 1.0.0
|
||||
*/
|
||||
using json = basic_json<>;
|
||||
|
||||
template<class Key, class T, class IgnoredLess, class Allocator>
|
||||
struct ordered_map;
|
||||
|
||||
/*!
|
||||
@brief ordered JSON class
|
||||
|
||||
This type preserves the insertion order of object keys.
|
||||
|
||||
@since version 3.9.0
|
||||
*/
|
||||
using ordered_json = basic_json<nlohmann::ordered_map>;
|
||||
|
||||
} // namespace nlohmann
|
||||
|
||||
#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
||||
@@ -133,6 +133,32 @@ INSTALL(
|
||||
Mod/PartDesign/fcsprocket
|
||||
)
|
||||
|
||||
set(PartDesignHoleDefines
|
||||
Resources/Hole/din7984.json
|
||||
Resources/Hole/iso10642.json
|
||||
Resources/Hole/iso14583.json
|
||||
Resources/Hole/iso14583part.json
|
||||
Resources/Hole/iso4762_7089.json
|
||||
Resources/Hole/iso4762.json
|
||||
)
|
||||
|
||||
add_custom_target(PartDesignHole ALL SOURCES
|
||||
${PartDesignHoleDefines}
|
||||
)
|
||||
|
||||
fc_target_copy_resource(PartDesignHole
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}/share/Mod/PartDesign
|
||||
${PartDesignHoleDefines}
|
||||
)
|
||||
|
||||
INSTALL(
|
||||
FILES
|
||||
${PartDesignHoleDefines}
|
||||
DESTINATION
|
||||
share/Mod/PartDesign/Resources/Hole
|
||||
)
|
||||
|
||||
if(BUILD_FEM)
|
||||
SET(WizardShaft_SRCS
|
||||
${PartDesign_WizardShaft}
|
||||
|
||||
23
src/Mod/PartDesign/Resources/Hole/din7984.json
Normal file
23
src/Mod/PartDesign/Resources/Hole/din7984.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "DIN 7984",
|
||||
"cut_type": "counterbore",
|
||||
"thread_type": "metric",
|
||||
"data": [
|
||||
{ "thread": "M2", "diameter": 4.3, "depth": 1.6 },
|
||||
{ "thread": "M2.5", "diameter": 5.0, "depth": 2.0 },
|
||||
{ "thread": "M3", "diameter": 6.0, "depth": 2.4 },
|
||||
{ "thread": "M3.5", "diameter": 6.5, "depth": 2.9 },
|
||||
{ "thread": "M4", "diameter": 8.0, "depth": 3.2 },
|
||||
{ "thread": "M5", "diameter": 10.0, "depth": 4.0 },
|
||||
{ "thread": "M6", "diameter": 11.0, "depth": 4.7 },
|
||||
{ "thread": "M8", "diameter": 15.0, "depth": 6.0 },
|
||||
{ "thread": "M10", "diameter": 18.0, "depth": 7.0 },
|
||||
{ "thread": "M12", "diameter": 20.0, "depth": 8.0 },
|
||||
{ "thread": "M14", "diameter": 24.0, "depth": 9.0 },
|
||||
{ "thread": "M16", "diameter": 26.0, "depth": 10.5 },
|
||||
{ "thread": "M18", "diameter": 30.0, "depth": 11.5 },
|
||||
{ "thread": "M20", "diameter": 33.0, "depth": 12.5 },
|
||||
{ "thread": "M22", "diameter": 36.0, "depth": 13.5 },
|
||||
{ "thread": "M24", "diameter": 40.0, "depth": 14.5 }
|
||||
]
|
||||
}
|
||||
18
src/Mod/PartDesign/Resources/Hole/iso10642.json
Normal file
18
src/Mod/PartDesign/Resources/Hole/iso10642.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "ISO 10642",
|
||||
"cut_type": "countersink",
|
||||
"thread_type": "metric",
|
||||
"angle": 90,
|
||||
"data": [
|
||||
{ "thread": "M3", "diameter": 6.7 },
|
||||
{ "thread": "M4", "diameter": 9.0 },
|
||||
{ "thread": "M5", "diameter": 12.2 },
|
||||
{ "thread": "M6", "diameter": 13.5 },
|
||||
{ "thread": "M8", "diameter": 18.0 },
|
||||
{ "thread": "M10", "diameter": 22.4 },
|
||||
{ "thread": "M12", "diameter": 26.8 },
|
||||
{ "thread": "M14", "diameter": 30.9 },
|
||||
{ "thread": "M16", "diameter": 33.6 },
|
||||
{ "thread": "M20", "diameter": 40.3 }
|
||||
]
|
||||
}
|
||||
16
src/Mod/PartDesign/Resources/Hole/iso14583.json
Normal file
16
src/Mod/PartDesign/Resources/Hole/iso14583.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "ISO 14583",
|
||||
"cut_type": "counterbore",
|
||||
"thread_type": "metric",
|
||||
"data": [
|
||||
{ "thread": "M2", "diameter": 4.4, "depth": 2.0 },
|
||||
{ "thread": "M2.5", "diameter": 5.4, "depth": 2.5 },
|
||||
{ "thread": "M3", "diameter": 6.0, "depth": 2.8 },
|
||||
{ "thread": "M3.5", "diameter": 7.6, "depth": 3.0 },
|
||||
{ "thread": "M4", "diameter": 8.6, "depth": 3.5 },
|
||||
{ "thread": "M5", "diameter": 10.1, "depth": 4.1 },
|
||||
{ "thread": "M6", "diameter": 12.6, "depth": 5.0 },
|
||||
{ "thread": "M8", "diameter": 16.6, "depth": 6.6 },
|
||||
{ "thread": "M10", "diameter": 20.8, "depth": 8.1 }
|
||||
]
|
||||
}
|
||||
16
src/Mod/PartDesign/Resources/Hole/iso14583part.json
Normal file
16
src/Mod/PartDesign/Resources/Hole/iso14583part.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "ISO 14583 (partial)",
|
||||
"cut_type": "counterbore",
|
||||
"thread_type": "metric",
|
||||
"data": [
|
||||
{ "thread": "M2", "diameter": 4.4, "depth": 1.0 },
|
||||
{ "thread": "M2.5", "diameter": 5.4, "depth": 1.4 },
|
||||
{ "thread": "M3", "diameter": 6.0, "depth": 1.7 },
|
||||
{ "thread": "M3.5", "diameter": 7.6, "depth": 1.7 },
|
||||
{ "thread": "M4", "diameter": 8.6, "depth": 2.0 },
|
||||
{ "thread": "M5", "diameter": 10.1, "depth": 2.5 },
|
||||
{ "thread": "M6", "diameter": 12.6, "depth": 3.0 },
|
||||
{ "thread": "M8", "diameter": 16.6, "depth": 3.9 },
|
||||
{ "thread": "M10", "diameter": 20.8, "depth": 4.6 }
|
||||
]
|
||||
}
|
||||
30
src/Mod/PartDesign/Resources/Hole/iso4762.json
Normal file
30
src/Mod/PartDesign/Resources/Hole/iso4762.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "ISO 4762",
|
||||
"cut_type": "counterbore",
|
||||
"thread_type": "metric",
|
||||
"data": [
|
||||
{ "thread": "M1.6", "diameter": 3.5, "depth": 1.7 },
|
||||
{ "thread": "M2", "diameter": 4.4, "depth": 2.1 },
|
||||
{ "thread": "M2.5", "diameter": 5.5, "depth": 3.0 },
|
||||
{ "thread": "M3", "diameter": 6.5, "depth": 3.4 },
|
||||
{ "thread": "M3.5", "diameter": 6.5, "depth": 3.9 },
|
||||
{ "thread": "M4", "diameter": 8.0, "depth": 4.4 },
|
||||
{ "thread": "M5", "diameter": 10.0, "depth": 5.4 },
|
||||
{ "thread": "M6", "diameter": 11.0, "depth": 6.4 },
|
||||
{ "thread": "M8", "diameter": 15.0, "depth": 8.6 },
|
||||
{ "thread": "M10", "diameter": 18.0, "depth": 10.6 },
|
||||
{ "thread": "M12", "diameter": 20.0, "depth": 12.6 },
|
||||
{ "thread": "M14", "diameter": 24.0, "depth": 14.6 },
|
||||
{ "thread": "M16", "diameter": 26.0, "depth": 16.6 },
|
||||
{ "thread": "M18", "diameter": 30.0, "depth": 18.6 },
|
||||
{ "thread": "M20", "diameter": 33.0, "depth": 20.6 },
|
||||
{ "thread": "M22", "diameter": 36.0, "depth": 22.8 },
|
||||
{ "thread": "M24", "diameter": 40.0, "depth": 24.8 },
|
||||
{ "thread": "M27", "diameter": 46.0, "depth": 31.0 },
|
||||
{ "thread": "M30", "diameter": 50.0, "depth": 34.0 },
|
||||
{ "thread": "M33", "diameter": 54.0, "depth": 36.0 },
|
||||
{ "thread": "M36", "diameter": 58.0, "depth": 37.0 },
|
||||
{ "thread": "M42", "diameter": 69.0, "depth": 43.0 },
|
||||
{ "thread": "M48", "diameter": 78.0, "depth": 49.0 }
|
||||
]
|
||||
}
|
||||
27
src/Mod/PartDesign/Resources/Hole/iso4762_7089.json
Normal file
27
src/Mod/PartDesign/Resources/Hole/iso4762_7089.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "ISO 4762 + 7089",
|
||||
"cut_type": "counterbore",
|
||||
"thread_type": "metric",
|
||||
"data": [
|
||||
{ "thread": "M2", "diameter": 6.0, "depth": 2.4 },
|
||||
{ "thread": "M2.5","diameter": 7.0, "depth": 3.5 },
|
||||
{ "thread": "M3", "diameter": 9.0, "depth": 3.9 },
|
||||
{ "thread": "M3.5","diameter": 9.0, "depth": 4.4 },
|
||||
{ "thread": "M4", "diameter": 10.0, "depth": 5.2 },
|
||||
{ "thread": "M5", "diameter": 13.0, "depth": 6.4 },
|
||||
{ "thread": "M6", "diameter": 15.0, "depth": 8.0 },
|
||||
{ "thread": "M8", "diameter": 18.0, "depth": 10.2 },
|
||||
{ "thread": "M10", "diameter": 24.0, "depth": 12.6 },
|
||||
{ "thread": "M12", "diameter": 26.0, "depth": 15.1 },
|
||||
{ "thread": "M14", "diameter": 30.0, "depth": 17.1 },
|
||||
{ "thread": "M16", "diameter": 33.0, "depth": 16.6 },
|
||||
{ "thread": "M18", "diameter": 36.0, "depth": 21.6 },
|
||||
{ "thread": "M20", "diameter": 40.0, "depth": 23.6 },
|
||||
{ "thread": "M22", "diameter": 43.0, "depth": 25.8 },
|
||||
{ "thread": "M24", "diameter": 48.0, "depth": 29.8 },
|
||||
{ "thread": "M27", "diameter": 54.0, "depth": 35.0 },
|
||||
{ "thread": "M30", "diameter": 61.0, "depth": 38.0 },
|
||||
{ "thread": "M33", "diameter": 63.0, "depth": 41.0 },
|
||||
{ "thread": "M36", "diameter": 69.0, "depth": 42.0 }
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user