Click or drag to resize

TextFieldsTryFormat Method (String, RhinoDoc, RhinoObject, RhinoObject, InstanceObject, String)

Formats the contents of a text string with field expressions and returns the result, evaluating it against a specific object and the block instances that enclose it.

Namespace:  Rhino.Runtime
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 9.0
Syntax
public static bool TryFormat(
	string text,
	RhinoDoc doc,
	RhinoObject obj,
	RhinoObject topParent,
	InstanceObject immediateParent,
	out string result
)

Parameters

text
Type: SystemString
The text formula to format
doc
Type: RhinoRhinoDoc
The Rhino document to evaluate
obj
Type: Rhino.DocObjectsRhinoObject
The object the text belongs to, or null. Fields that read the object itself, such as its user text, need this.
topParent
Type: Rhino.DocObjectsRhinoObject
The top level object the text belongs to, or null to use obj.
immediateParent
Type: Rhino.DocObjectsInstanceObject
The block instance directly containing obj, or null. Fields that read user text off the enclosing instance need this.
result
Type: SystemString
The result of the formatted expression. Otherwise, if the text is null or the evaluation process fails, the result will be empty.

Return Value

Type: Boolean
Returns True if the expression is formatted properly; Otherwise False.
See Also