Class DxfDBObject
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
An object of a DXF file, as AutoCAD's DBObject is one of a drawing: an entity, a table, a record of a table.
It has its handle, its owner's handle, its extended data and the handle of its extension dictionary, read from its
record as the file writes it.
public abstract class DxfDBObject
- Inheritance
-
DxfDBObject
- Derived
- Inherited Members
Remarks
Objects are used directly, as AutoCAD's are inside a transaction, with no ObjectId and no transaction: an object
read from a DxfDatabase is the same object each time it is reached, and a change to it is written into
its record at once, every other record of the file keeping its bytes.
An object made in code, such as new DxfLine(start, end), is in no file until it is added to one: it has no
handle and no owner then, and is given both when it is added.
Properties
- Annotative
Gets or sets whether the object is annotative, as AutoCAD's
Annotative: drawn at the size its scale gives it on the sheet, each scale it is shown at a context of its own (HasContext(DxfObjectContext)).
- ExtensionDictionary
Gets the object's extension dictionary, as AutoCAD's
ExtensionDictionarygives its id: the DICTIONARY of the OBJECTS section its group{ACAD_XDICTIONARYnames (360), which holds what applications keep with it; null where it has none, or names one the file has not.
- Handle
Gets the handle of the object (group 5, 105 for a DIMSTYLE) as the file writes it in hexadecimal, the spaces around it taken off, such as
2F; null for an object in no file, and in a file that writes none, as many of R12 do.
- IsErased
Gets whether the object has been erased from its file: it is read still, as it was, but is no longer saved and is not changed.
- OwnerHandle
Gets the handle of the object's owner (its first group 330, outside the groups of the applications): the BLOCK_RECORD of model space for an entity of model space, the table for a record of a table. Null for an object in no file, and in a file of R12, which writes no owners.
- PaperOrientation
Gets whether the object keeps the way up of the sheet, as AutoCAD's
PaperOrientation, its "match orientation to layout": for an annotative TEXT, MTEXT, attribute, text style or block, the first 1070 of its extended dataAcadAnnoPO, False where it has none or is not annotative; for an INSERT, that of its block; NotApplicable for every other object, as a line or a dimension.
- XData
Gets or sets the extended data of the object, as AutoCAD's
XDatadoes: each application's data opened by its name in a group 1001, then its groups 1000 to 1071, as the file writes them.
Methods
- AddContext(DxfObjectContext)
Makes the object shown at another scale, as AutoCAD's
ObjectContexts.AddContext(the command OBJECTSCALE, Add): a context of the scale is written next to the others under ACDB_ANNOTATIONSCALES of its extension dictionary, named*Aand one more than the highest number the object holds, not the default (290 of 0), and made from the default context as AutoCAD 2021 makes it (checked on a TEXT, an MTEXT, an ATTDEF, a HATCH and an INSERT of an annotative block drawn at 1:1 and 1:50): a TEXT and an attribute definition keep their point, angle and mode; an MTEXT keeps its place and direction and has its width, the height of its box and the width and height of its words (40, 41, 42, 43) multiplied by the default's scale over the new one's (an MTEXT 40 wide at 1:1 is 2000 wide at 1:50); a HATCH has the lines of its pattern (43, 44, 45, 46, 49) multiplied so, and 1 over the scale in its group 40 (50 at 1:50), and has its view context written first from its default context as it stands, replaced where it has one (KeepHatchView: a hatch moved by (100, 50) and then given 1:2 holds 43 of 100, 44 of 50 in its view, as -OBJECTSCALE Add writes it); an INSERT has its three factors multiplied so (50 at 1:50 for a 1 at 1:1) and each attribute of it that holds contexts is given one as well, its point moved out from the INSERT's by the same factor: the attribute at (300, 1003) of an INSERT at (300, 1000) is at (300, 1150) at 1:50. An INSERT that holds no context gets the scale as its one context, the default, its record's factors and those of the context multiplied by 1 over the scale, as AutoCAD 2021 gave it. A MULTILEADER holding text is laid out again: its scale (40) is 1 over the new scale's, its sizes (the text height, the arrowhead, the landing gap, the dogleg) multiplied by the default's scale over the new one's, the landing and its lines kept, and the content moved out from the landing by the new dogleg: text 0.2 high at 1:50 is 0.4 at 1:100, a dogleg of 0.36 is 0.72, and the words stand 9.72 right of the landing (check GHAN4). The record of the other kinds is kept: their size at the other scale is worked out from it.
- CreateExtensionDictionary()
Gives the object an extension dictionary, as AutoCAD's
CreateExtensionDictionary: an empty DICTIONARY at the end of the OBJECTS section, owned hard by the object (280 of 1) and naming it as its owner (330) but not as its reactor, its handle written into the object's record as the group{ACAD_XDICTIONARYstraight after its handle, before its reactors, as AutoCAD 2021 writes it for a LINE, a layer, a block, a table of the drawing and an object of the OBJECTS section alike. Nothing where it has one.
- Erase()
Erases the object from its file, as AutoCAD's
Erasedoes: an entity is taken out of its block with every record of it, as Erase() says; a layer, a linetype, a text style or a block nothing uses out of its table, as their ownErasesays; an XRECORD (DxfXrecord), a GROUP (DxfGroup) and a GEODATA (DxfGeoData) with the entry of the dictionary that names it.
- GetBinaryDataForKey(string)
Gets the bytes the object keeps under a key, as AutoCAD's
GetBinaryDataForKey: those of the XRECORD of that name in its extension dictionary, its groups 310 one after another.
- GetContexts()
Gets the scales the object is shown at, as AutoCAD's
ObjectContexts.GetContexts: the scale each context under ACDB_ANNOTATIONSCALES points at, in the order of its dictionary (the default first, as AutoCAD writes it), each a DxfAnnotationScale of the drawing's list. An INSERT of an annotative block, or an attribute of one, that holds no context is shown at the scale named 1:1 (HasContext(DxfObjectContext)), which this gives where the drawing's list has it. A text of two scales, 1:1 and 1:50, gives those two; an object that is not annotative gives none.
- GetField()
Gets the field of the object's words, as AutoCAD's
GetField(): that of the property TEXT, which a TEXT, an MTEXT, an attribute and a dimension keep their words' field under, as GetField(string) gives it.
- GetField(string)
Gets the field of a property of the object, as AutoCAD's
GetField(propertyName): the FIELD its extension dictionary's dictionary ACAD_FIELD names by the property's name, as AutoCAD keeps it.
- GetPersistentReactorIds()
Gets the handles of the object's reactors (the groups 330 of its
{ACAD_REACTORS), in the order of its record, as AutoCAD'sGetPersistentReactorIdsgives their ids: the DIMASSOC of each associative dimension tied to a line, the GROUPs it is in. Empty for an object in no file or with none; a new list on each call, read as it was for one erased.
- GetXDataForApplication(string)
Gets the extended data of one application, as AutoCAD's
GetXDataForApplicationdoes: its 1001 and the groups after it up to the next application's.
- HandOverTo(DxfDBObject, bool, bool)
Puts an object made in code in this one's place in the drawing, as AutoCAD's
HandOverTohands an object's id over: the new object's records written where this one's stand, in its block and at its place among the block's entities, with this one's handle, owner and reactors, so that what pointed at this one points at the new one; this one is in no file from then on, a copy of what it was with no handle and no owner, to be appended again or let go.
- HasContext(DxfObjectContext)
Gets whether the object is shown at a scale, as AutoCAD's
HasContext: whether a context under ACDB_ANNOTATIONSCALES of AcDbContextDataManager of its extension dictionary points at the scale's SCALE, by the first 340 of its subclass AcDbAnnotScaleObjectContextData, of any kind of context; never for an object that is never annotative (Annotative NotApplicable), as a LINE, a CIRCLE or a layer, whatever records it holds, as AutoCAD 2021 answered for eleven kinds of entity handed a TEXT's contexts by HandOverTo(DxfDBObject, bool, bool) (check D37), which keeps them. Those two groups, with the default flag (290 of AcDbObjectContextData), are all the library reads of a context, but for the placing of the context of a TEXT, an attribute or a definition, an MTEXT and an INSERT, which Position, Location and Position read and write; the rest of AutoCAD's record of it is kept as it is. A copy in no file (Clone()) carries the contexts of its original, and is shown at the scales of its original's drawing.
- ReleaseExtensionDictionary()
Takes out the object's extension dictionary where it is empty, as AutoCAD's
ReleaseExtensionDictionary: the DICTIONARY erased and the group{ACAD_XDICTIONARYtaken out of the object's record. Nothing where it has none.
- RemoveContext(DxfObjectContext)
Stops showing an annotative object at a scale, as AutoCAD's
RemoveContextand its OBJECTSCALE Delete do: its context of the scale erased with its entry of ACDB_ANNOTATIONSCALES, of any kind of object, every other context kept as it is; the picture block of a dimension's context goes with it, and an INSERT's attributes lose the scale too. Where the context is the default, the next in the order of the dictionary becomes it (its 290 of 1) and the record takes that context's data, as AutoCAD 2021 rewrites it: a TEXT of 125 at 1:50 with 1:100 beside it is 250 high once 1:50 is deleted, an MTEXT's width the context's, a HATCH's pattern lines, an INSERT's factors and place, a dimension's block and the middle of its words, and a multileader's context data those of the new default. The entry added after is named as AutoCAD names it within a session, one more than the highest number the dictionary has held: after *A2 was deleted, *A3. A scale the object is not shown at changes nothing.
- RemoveField()
Takes out the field of the object's words, as AutoCAD's
RemoveField(): that of the property TEXT, as RemoveField(string) takes one out.
- RemoveField(DxfField)
Takes out a field of the object, as AutoCAD's
RemoveField(fieldId): of the property it is the field of, as RemoveField(string) takes one out.
- RemoveField(string)
Takes out the field of a property of the object, as AutoCAD's
RemoveField(propertyName): its entry of the dictionary ACAD_FIELD taken out, the field erased with its children, they and it taken out of the drawing's list of fields (ACAD_FIELDLIST) where it has one, and the dictionary ACAD_FIELD taken out of the extension dictionary once it is empty. The object's words are kept as they are, the field's last value among them.
- SetBinaryDataForKey(string, byte[])
Keeps bytes with the object under a key, as AutoCAD's
SetBinaryDataForKey: an XRECORD of that name in its extension dictionary, made where it has none, its bytes written as groups 310 of 127 bytes each, as AutoCAD writes binary data; the bytes of an XRECORD of the name replaced. Bytes the same as those kept change nothing.
- SetField(DxfField)
Gives the object's words a field, as AutoCAD's
SetField(field): under the property TEXT, as SetField(string, DxfField) gives it.
- 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.
- SetFromStyle()
Takes away what the object holds of its own over its style, as AutoCAD's
SetFromStyle, so that it is drawn as its style draws it: a dimension and a leader lose their overrides of the dimension style (the list DSTYLE of their extended data of ACAD), a DxfDimension ofDimasz4.5 of its own over a style of 3.5 reading 3.5 again; a DxfMLeader takes the values of its multileader style, as its own SetFromStyle() says; a DxfTable loses its own overrides and its cells', as its own SetFromStyle() says. An object of no style changes nothing.
- XDataTransformBy(GeoTransform3)
Moves, turns, scales or mirrors the object's extended data by a transformation, as AutoCAD's
XDataTransformBy: a position of the world (1011, 1021, 1031) is moved, a displacement (1012) turned and scaled but not moved, a direction (1013) turned but kept its length, a distance (1041) and a scale factor (1042) scaled by the transformation's scale, the greatest stretch of its axes; a plain point (1010) and every other group kept, as AutoCAD keeps them. A value the transformation leaves as it was keeps its text, and an object whose data it leaves is not written.