TextElement.GetMinimumAllowedWidth(Document, ElementId)
Method
Description:
Returns the minimum width a text element can be created with.
Returns the minimum width a text element can be created with.
Remarks:
Note that it is not necessarily a constant; it can be affected by properties of the text type, such as the width factor.
Note that it is not necessarily a constant; it can be affected by properties of the text type, such as the width factor.
Examples
public TextNote AddNewTextNote(UIDocument uiDoc)
{
Document doc = uiDoc.Document;
XYZ textLoc = uiDoc.Selection.PickPoint("Pick a point for sample text.");
ElementId defaultTextTypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType);
double noteWidth = .2;
// make sure note width works for the text type
double minWidth = TextNote.GetMinimumAllowedWidth(doc, defaultTextTypeId);
double maxWidth = TextNote.GetMaximumAllowedWidth(doc, defaultTextTypeId);
if (noteWidth < minWidth)
{
noteWidth = minWidth;
}
else if (noteWidth > maxWidth)
{
noteWidth = maxWidth;
}
TextNoteOptions opts = new TextNoteOptions(defaultTextTypeId);
opts.HorizontalAlignment = HorizontalTextAlignment.Left;
opts.Rotation = Math.PI / 4;
TextNote textNote = TextNote.Create(doc, doc.ActiveView.Id, textLoc, noteWidth, "New sample text", opts);
return textNote;
}
Parameters
Parameter | Type | Description |
---|---|---|
cdda | Document | A document containing the new text element's type |
typeId | ElementId | Id of the text type |
Return Value
Type | Description |
---|---|
Double | The minimum allowed width in paper space [ft]. |
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | A non-optional argument was null |