Returns the minimum width a text element can be created with.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)
Since:
2016
Syntax
Visual Basic |
---|
Public Shared Function GetMinimumAllowedWidth ( _
cdda As Document, _
typeId As ElementId _
) As Double |
Visual C++ |
---|
public:
static double GetMinimumAllowedWidth(
Document^ cdda,
ElementId^ typeId
) |
Return Value
The minimum allowed width in paper space [ft].
Remarks
Examples
CopyC#
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;
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;
}
CopyVB.NET
Public Function AddNewTextNote(uiDoc As UIDocument) As TextNote
Dim doc As Document = uiDoc.Document
Dim textLoc As XYZ = uiDoc.Selection.PickPoint("Pick a point for sample text.")
Dim defaultTextTypeId As ElementId = doc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType)
Dim noteWidth As Double = 0.2
Dim minWidth As Double = TextNote.GetMinimumAllowedWidth(doc, defaultTextTypeId)
Dim maxWidth As Double = TextNote.GetMaximumAllowedWidth(doc, defaultTextTypeId)
If noteWidth < minWidth Then
noteWidth = minWidth
ElseIf noteWidth > maxWidth Then
noteWidth = maxWidth
End If
Dim opts As New TextNoteOptions(defaultTextTypeId)
opts.HorizontalAlignment = HorizontalTextAlignment.Left
opts.Rotation = Math.PI / 4
Dim textNote__1 As TextNote = TextNote.Create(doc, doc.ActiveView.Id, textLoc, noteWidth, "New sample text", opts)
Return textNote__1
End Function
Exceptions
See Also