Assembly: Fix distance joints
This commit is contained in:
committed by
Chris Hennes
parent
5f74b4b299
commit
39c4e2e600
@@ -947,8 +947,8 @@ std::shared_ptr<ASMTJoint> AssemblyObject::makeMbdJointDistance(App::DocumentObj
|
||||
{
|
||||
DistanceType type = getDistanceType(joint);
|
||||
|
||||
const char* elt1 = getElementFromProp(joint, "Reference1");
|
||||
const char* elt2 = getElementFromProp(joint, "Reference2");
|
||||
std::string elt1 = getElementFromProp(joint, "Reference1");
|
||||
std::string elt2 = getElementFromProp(joint, "Reference2");
|
||||
auto* obj1 = getLinkedObjFromRef(joint, "Reference1");
|
||||
auto* obj2 = getLinkedObjFromRef(joint, "Reference2");
|
||||
|
||||
@@ -1740,13 +1740,13 @@ bool AssemblyObject::isFaceType(App::DocumentObject* obj,
|
||||
return false;
|
||||
}
|
||||
|
||||
double AssemblyObject::getFaceRadius(App::DocumentObject* obj, const char* elt)
|
||||
double AssemblyObject::getFaceRadius(App::DocumentObject* obj, std::string& elt)
|
||||
{
|
||||
auto base = static_cast<PartApp::Feature*>(obj);
|
||||
const PartApp::TopoShape& TopShape = base->Shape.getShape();
|
||||
|
||||
// Check for valid face types
|
||||
TopoDS_Face face = TopoDS::Face(TopShape.getSubShape(elt));
|
||||
TopoDS_Face face = TopoDS::Face(TopShape.getSubShape(elt.c_str()));
|
||||
BRepAdaptor_Surface sf(face);
|
||||
|
||||
if (sf.GetType() == GeomAbs_Cylinder) {
|
||||
@@ -1759,13 +1759,13 @@ double AssemblyObject::getFaceRadius(App::DocumentObject* obj, const char* elt)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double AssemblyObject::getEdgeRadius(App::DocumentObject* obj, const char* elt)
|
||||
double AssemblyObject::getEdgeRadius(App::DocumentObject* obj, std::string& elt)
|
||||
{
|
||||
auto base = static_cast<PartApp::Feature*>(obj);
|
||||
const PartApp::TopoShape& TopShape = base->Shape.getShape();
|
||||
|
||||
// Check for valid face types
|
||||
TopoDS_Edge edge = TopoDS::Edge(TopShape.getSubShape(elt));
|
||||
TopoDS_Edge edge = TopoDS::Edge(TopShape.getSubShape(elt.c_str()));
|
||||
BRepAdaptor_Curve sf(edge);
|
||||
|
||||
if (sf.GetType() == GeomAbs_Circle) {
|
||||
@@ -2145,7 +2145,7 @@ std::vector<std::string> AssemblyObject::splitSubName(const std::string& sub)
|
||||
return subNames;
|
||||
}
|
||||
|
||||
const char* AssemblyObject::getElementFromProp(App::DocumentObject* obj, const char* pName)
|
||||
std::string AssemblyObject::getElementFromProp(App::DocumentObject* obj, const char* pName)
|
||||
{
|
||||
std::vector<std::string> names = getSubAsList(obj, pName);
|
||||
|
||||
@@ -2153,14 +2153,14 @@ const char* AssemblyObject::getElementFromProp(App::DocumentObject* obj, const c
|
||||
return "";
|
||||
}
|
||||
|
||||
return names.back().c_str();
|
||||
return names.back();
|
||||
}
|
||||
|
||||
std::string AssemblyObject::getElementTypeFromProp(App::DocumentObject* obj, const char* propName)
|
||||
{
|
||||
// The prop is going to be something like 'Edge14' or 'Face7'. We need 'Edge' or 'Face'
|
||||
std::string elementType;
|
||||
for (char ch : std::string(getElementFromProp(obj, propName))) {
|
||||
for (char ch : getElementFromProp(obj, propName)) {
|
||||
if (std::isalpha(ch)) {
|
||||
elementType += ch;
|
||||
}
|
||||
|
||||
@@ -250,8 +250,8 @@ public:
|
||||
|
||||
static bool isEdgeType(App::DocumentObject* obj, std::string& elName, GeomAbs_CurveType type);
|
||||
static bool isFaceType(App::DocumentObject* obj, std::string& elName, GeomAbs_SurfaceType type);
|
||||
static double getFaceRadius(App::DocumentObject* obj, const char* elName);
|
||||
static double getEdgeRadius(App::DocumentObject* obj, const char* elName);
|
||||
static double getFaceRadius(App::DocumentObject* obj, std::string& elName);
|
||||
static double getEdgeRadius(App::DocumentObject* obj, std::string& elName);
|
||||
|
||||
static DistanceType getDistanceType(App::DocumentObject* joint);
|
||||
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
static double getJointDistance(App::DocumentObject* joint);
|
||||
static double getJointDistance2(App::DocumentObject* joint);
|
||||
static JointType getJointType(App::DocumentObject* joint);
|
||||
static const char* getElementFromProp(App::DocumentObject* obj, const char* propName);
|
||||
static std::string getElementFromProp(App::DocumentObject* obj, const char* propName);
|
||||
static std::string getElementTypeFromProp(App::DocumentObject* obj, const char* propName);
|
||||
static App::DocumentObject* getObjFromProp(App::DocumentObject* joint, const char* propName);
|
||||
static App::DocumentObject* getObjFromRef(App::PropertyXLinkSub* prop);
|
||||
|
||||
Reference in New Issue
Block a user