[TD]expose dimension arrow position to Python
This commit is contained in:
@@ -1093,7 +1093,20 @@ bool DrawViewDimension::leaderIntersectsArc(Base::Vector3d s, Base::Vector3d poi
|
||||
return result;
|
||||
}
|
||||
|
||||
//are there non-blank references?
|
||||
void DrawViewDimension::saveArrowPositions(const Base::Vector2d positions[])
|
||||
{
|
||||
double scale = getViewPart()->getScale();
|
||||
m_arrowPositions.first = Base::Vector3d(positions[0].x, positions[0].y, 0.0) / scale;
|
||||
m_arrowPositions.second = Base::Vector3d(positions[1].x, positions[1].y, 0.0) / scale;
|
||||
}
|
||||
|
||||
//return position within parent view of dimension arrow heads/dimline endpoints
|
||||
//note positions are in apparent coord (inverted y).
|
||||
pointPair DrawViewDimension::getArrowPositions(void)
|
||||
{
|
||||
return m_arrowPositions;
|
||||
}
|
||||
|
||||
bool DrawViewDimension::has2DReferences(void) const
|
||||
{
|
||||
// Base::Console().Message("DVD::has2DReferences() - %s\n",getNameInDocument());
|
||||
|
||||
@@ -153,6 +153,9 @@ public:
|
||||
|
||||
bool isMultiValueSchema(void) const;
|
||||
|
||||
pointPair getArrowPositions(void);
|
||||
void saveArrowPositions(const Base::Vector2d positions[]);
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop) override;
|
||||
virtual void onDocumentRestored() override;
|
||||
@@ -174,6 +177,7 @@ protected:
|
||||
pointPair closestPoints(TopoDS_Shape s1,
|
||||
TopoDS_Shape s2) const;
|
||||
pointPair m_linearPoints;
|
||||
pointPair m_arrowPositions;
|
||||
|
||||
private:
|
||||
static const char* TypeEnums[];
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
<UserDocu>getAnglePoints() - returns list of points for angle Dimension</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getArrowPositions">
|
||||
<Documentation>
|
||||
<UserDocu>getArrowPositions() - returns list of locations or Dimension Arrowheads. Locations are in unscaled coordinates of parent View </UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<CustomAttributes />
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
@@ -99,6 +99,16 @@ PyObject* DrawViewDimensionPy::getAnglePoints(PyObject* args)
|
||||
return ret;
|
||||
}
|
||||
|
||||
PyObject* DrawViewDimensionPy::getArrowPositions(PyObject* args)
|
||||
{
|
||||
(void) args;
|
||||
DrawViewDimension* dvd = getDrawViewDimensionPtr();
|
||||
pointPair pts = dvd->getArrowPositions();
|
||||
PyObject* ret = PyList_New(0);
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.first)));
|
||||
PyList_Append(ret,new Base::VectorPy(new Base::Vector3d(pts.second)));
|
||||
return ret;
|
||||
}
|
||||
PyObject *DrawViewDimensionPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user