Annotation Text/Leader in Opennurbs 6


(Sandip Ichake) #1

Hi @dale,

I am looking for your help to understand following API’s:

  1. What is the new API to read the annotation text? older version contains annotation->UserText()/ TextValue()
  2. What is the new API for onLeader->Dim3dPoint()?
  3. What should be the parent_style while fetching information from annotation object like Font, TextHeight ?

Thank you in advance!

Thanks & Regards,
Sandip Ichake


(Dale Fugier) #2

@lowell, can you help with this?


(Lowell Walmsley) #3

For various versions of text in annotations:

/*
Returns:
Raw text that can contain rich text formatting instructions.
Fields are not evaluated.
*/
const ON_wString RichText() const;

/*
Returns:
Plain text information with any rich text formatting instructions removed.
The result string from evaluating fields is included
Field results may be cached from previous evaluation
/
const ON_wString PlainText() const;
/

Same as PlainText() but separated wrapped run lines with ‘\n’ for soft return
and ‘\r’’\n’ for hard returns
*/
const ON_wString WrappedPlainText() const;

/*
Returns:
Plain text information with any rich text formatting instructions removed.
Fields are not evaluated
/
const ON_wString PlainTextWithFields() const;
/

Same as PlainTextWithFields() but separated wrapped run lines with ‘\n’ for soft return
and ‘\r’’\n’ for hard returns
*/
const ON_wString WrappedPlainTextWithFields() const;

For dealing Leader with points:
ON__UINT32 PointCount() const;
void SetPoints2d(int count, const ON_2dPoint* points);
void SetPoints3d(int count, const ON_3dPoint* points);
bool SetPoint2d(int idx, ON_2dPoint point);
bool SetPoint3d(int idx, ON_3dPoint point);
void InsertPoint2d(int atidx, ON_2dPoint point);
void InsertPoint3d(int atidx, ON_3dPoint point);
void AppendPoint2d(ON_2dPoint point);
bool AppendPoint3d(ON_3dPoint point);
void RemovePoint(int idx);
bool Point2d(int idx, ON_2dPoint& point) const;
bool Point3d(int idx, ON_3dPoint& point) const;

For getting curve used by a leader, there is:
const ON_NurbsCurve* ON_Leader::Curve(const ON_DimStyle* dimstyle) const;

The properties of annotations are controlled by the parent dimstyle and any overrides that have been applied to the individual annotation.
The parent dimstyle is used for any properties that haven’t been overridden, so it should be whatever style you want to use to control how the annotation looks.