Method SetField
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
SetField(DxfField)
Gives the object's words a field, as AutoCAD's SetField(field): under the property TEXT, as
SetField(string, DxfField) gives it.
public DxfField SetField(DxfField field)
Parameters
fieldDxfFieldThe field, made in code and in no file yet.
Returns
- DxfField
The field, now in the object's file.
Exceptions
- ArgumentNullException
Thrown when the field is null.
- ArgumentException
Thrown when the field or a field it holds is in a file already, as the child of a field given to another object is; nothing is written then.
- InvalidOperationException
Thrown when the object is in no file, is erased, or its file is older than R2004, which brought fields.
SetField(string, DxfField)
Gives a property of the object a field, as AutoCAD's SetField(propertyName, field): the field and its children
written as FIELDs at the end of the OBJECTS section, named by the property's name in the dictionary ACAD_FIELD of the
object's extension dictionary, both made where the object has none, each owned hard by what holds it, in the layout the
DXF reference gives (not yet checked on a drawing AutoCAD saved, as DxfField says); the class FIELD listed
in the CLASSES section where it is not. A field the property had is erased with its
children. The object's words are not changed: AutoCAD writes the field's value in them when it evaluates it.
text.SetField(new DxfField("Drawn %<\AcVar Date>%", true)) gives a TEXT the date as a field.
public DxfField SetField(string propertyName, DxfField field)
Parameters
propertyNamestringThe name of the property: TEXT for the words of a text.
fieldDxfFieldThe field, made in code and in no file yet.
Returns
- DxfField
The field, now in the object's file.
Exceptions
- ArgumentNullException
Thrown when the name or the field is null.
- ArgumentException
Thrown when the name is empty or has a control character in it, or the field or a field it holds is in a file already, as the child of a field given to another object is; nothing is written then.
- InvalidOperationException
Thrown when the object is in no file, is erased, or its file is older than R2004, which brought fields; or its extension dictionary holds an ACAD_FIELD that is not a dictionary.