Xdata primer for attaching data to CAD objects

BricsCAD and AutoCAD and Extended Data

The thing with LISP is that most people code what is needed and learn only what is needed to achieve that. Like automating the creation of a geometry of a product. The result is that some powerful possibilities are simply ignored and extended entity data - or xdata - is one of them and not many skilled LISP programmers use them.

What is it?

If you draw a line from A to B, it is written in the database in .dwg format - a drawing is a database. That database contains records for blocks, texts, dimensions, lines and so on. So a record of that line looks like: entity type name is "line", from point is "A", end point is "B", layer is "0", linetype is "continuous" and the list goes on until the entity is fully defined.

But this is not the end, you can also add custom information. How about a block with release date is "20180708"? If someone deletes it and replaces it with a new block - without that release date, those changes can be tracked. This way you could do some form of version control.

Context and examples

Version control is an example. More general, adding extra information can be performed by adding a layer with "sticky notes", set to no printing, using attributes and xdata. The advantage of xdata over attributes is that it can be used for every entity type and that it is not limited to blocks. A "sticky notes" layer has the disadvantage that everyone can read it.

The example below uses xdata for attaching bolt information to products but uses are limited only by your mind.

How about attaching price information? Service exchange dates? Weight? You name it. I even heard about a teacher attaching student information to entities they create in order to prevent copy paste homework. Of course you need some program to attach, read and change xdata. See below. That program needs to be registered in the drawing once and it is a good habit to use a unique name for it, like name-number.

Learning to code

Kenny Ramage wrote a good article where he attached extended entity data to holes (circles). The holes contain information about bolts to use: bolt size, bolt length and bolt grades. Yet another interesting application. See http://www.afralisp.net/autolisp/tutorials/extended-entity-data-part-1.php for the coding basics.

This site is hosted by NedCAD.

De inhoud van deze site wordt aangeboden zoals het is, zonder enige vorm van garantie en heeft verschillende licenties. Meer informatie over licenties staat hier.