[TD]Allow override of dimension line angles
This commit is contained in:
committed by
WandererFan
parent
7ef448572d
commit
4da3c21dcf
@@ -584,7 +584,7 @@ bool DrawUtil::isBetween(const Base::Vector3d pt, const Base::Vector3d end1, con
|
||||
Base::Vector3d DrawUtil::Intersect2d(Base::Vector3d p1, Base::Vector3d d1,
|
||||
Base::Vector3d p2, Base::Vector3d d2)
|
||||
{
|
||||
Base::Vector3d result(0,0,0);
|
||||
Base::Vector3d result(0.0, 0.0, 0.0);
|
||||
Base::Vector3d p12(p1.x+d1.x, p1.y+d1.y, 0.0);
|
||||
double A1 = d1.y;
|
||||
double B1 = -d1.x;
|
||||
@@ -608,6 +608,34 @@ Base::Vector3d DrawUtil::Intersect2d(Base::Vector3d p1, Base::Vector3d d1,
|
||||
return result;
|
||||
}
|
||||
|
||||
Base::Vector2d DrawUtil::Intersect2d(Base::Vector2d p1, Base::Vector2d d1,
|
||||
Base::Vector2d p2, Base::Vector2d d2)
|
||||
{
|
||||
Base::Vector2d result(0.0, 0.0);
|
||||
Base::Vector2d p12(p1.x+d1.x, p1.y+d1.y);
|
||||
double A1 = d1.y;
|
||||
double B1 = -d1.x;
|
||||
double C1 = A1*p1.x + B1*p1.y;
|
||||
|
||||
Base::Vector2d p22(p2.x+d2.x, p2.y+d2.y);
|
||||
double A2 = d2.y;
|
||||
double B2 = -d2.x;
|
||||
double C2 = A2*p2.x + B2*p2.y;
|
||||
|
||||
double det = A1*B2 - A2*B1;
|
||||
if(det == 0){
|
||||
Base::Console().Message("Lines are parallel\n");
|
||||
}else{
|
||||
double x = (B2*C1 - B1*C2)/det;
|
||||
double y = (A1*C2 - A2*C1)/det;
|
||||
result.x = x;
|
||||
result.y = y;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::string DrawUtil::shapeToString(TopoDS_Shape s)
|
||||
{
|
||||
std::ostringstream buffer;
|
||||
|
||||
@@ -109,6 +109,8 @@ class TechDrawExport DrawUtil {
|
||||
//! find intersection in 2d for 2 lines in point+direction form
|
||||
static Base::Vector3d Intersect2d(Base::Vector3d p1, Base::Vector3d d1,
|
||||
Base::Vector3d p2, Base::Vector3d d2);
|
||||
static Base::Vector2d Intersect2d(Base::Vector2d p1, Base::Vector2d d1,
|
||||
Base::Vector2d p2, Base::Vector2d d2);
|
||||
static Base::Vector3d gpPnt2V3(const gp_Pnt gp) { return Base::Vector3d(gp.X(),gp.Y(),gp.Z()); }
|
||||
static gp_Pnt V32gpPnt(const Base::Vector3d v) { return gp_Pnt(v.x,v.y,v.z); }
|
||||
static std::string shapeToString(TopoDS_Shape s);
|
||||
|
||||
@@ -131,6 +131,10 @@ DrawViewDimension::DrawViewDimension(void)
|
||||
UnderTolerance.setConstraints(&ToleranceConstraint);
|
||||
ADD_PROPERTY_TYPE(Inverted, (false), "", App::Prop_Output, "The dimensional value is displayed inverted");
|
||||
|
||||
ADD_PROPERTY_TYPE(AngleOverride,(false), "Override", App::Prop_Output, "User specified angles");
|
||||
ADD_PROPERTY_TYPE(LineAngle,(0.0), "Override", App::Prop_Output, "Dimension line angle");
|
||||
ADD_PROPERTY_TYPE(ExtensionAngle,(0.0), "Override", App::Prop_Output, "Extension line angle");
|
||||
|
||||
// hide the DrawView properties that don't apply to Dimensions
|
||||
ScaleType.setStatus(App::Property::ReadOnly, true);
|
||||
ScaleType.setStatus(App::Property::Hidden, true);
|
||||
|
||||
@@ -110,6 +110,10 @@ public:
|
||||
App::PropertyQuantityConstraint OverTolerance;
|
||||
App::PropertyQuantityConstraint UnderTolerance;
|
||||
|
||||
App::PropertyBool AngleOverride;
|
||||
App::PropertyAngle LineAngle;
|
||||
App::PropertyAngle ExtensionAngle;
|
||||
|
||||
enum RefType{
|
||||
invalidRef,
|
||||
oneEdge,
|
||||
|
||||
Reference in New Issue
Block a user