The new dynapi replaced the old dwg_api functions to access each object field. The old dwg_api functions
were deprecated, and need to be re-enabled by defining CFLAGS="-DUSE_DEPRECATED_API"
.
See see Objects for an description of each object and its fields..
For each of header, entity, common or subclass there is a function to get and set the value of any type, or converted utf8 string.
entity is of type dwg_ent_generic
, that is the pointer to the object specific struct.
dxfname is the dxfname of the object, fieldname is the field or property name of the field to be read from,
*out the result pointer and the optiona *fp is filled by the information for this field.
This accesses the common Dwg_Object_Object*
or Dwg_Object_Entity*
fields.
This accesses the Header (or sometimes also called Database) fields.
This accesses a subclass, a structure within the object.
The utf8text functions convert version-specific text strings to UTF-8 strings. Internally the dwg stores strings as TU (unicode) or TV (single-byte codepage). The API treats all strings as UTF-8, as with JSON, DXF or the add API.
isnewp is set to 1 f the string is a fresh copy, for unicode strings.
This accesses the Header (or sometimes also called Database) fields.
This accesses a subclass, a structure within the object.
The setters don’t differentiate between common values and strings.
Sets the ENTITY.fieldname to a value. A malloc’ed struct is passed by ptr, not by the content. A non-malloc’ed struct is set by content. Arrays or strings must be malloced before. We just set the new pointer, the old value will be freed. If is_utf8 is set, the given value is a UTF-8 string, and will be converted to TV or TU
See the sourcecode of the importers or programs for the usage of the API’s.