Fields

  • Thanks to Wolfgang Ruthensteiner for suggesting this excellent topic a comment to this previous post. Here's Wonfgang's question: How do I read back the field code with C# (from an attribute e.g.)? I am linking room-label blocks with polylines, using fields inside an attribute to display the polyline's area property. Later I want to find out programatically, which polyline a certain block is linked to by evaluating the field in the attribute (extracting the objectId). This was actually quite tricky, and one I needed the help of our old friend, ArxDbg, to solve (see here for some information on this…

  • In the last post we looked at some code to create a table of attribute values for a particular block. In this post we'll extend that code and show how to use a formula to create a total of those values. Below is the C# code. I've numbered the lines, and those in red are new since the last post. The complete source file can be downloaded here. Firstly, a quick breakdown of the changes: Lines 60-81 deal with user input, and the forcing of the decision to "embed" rather than "link", if we're performing the total (table formulae do…

  • This post was inspired by suggestions from a few different people (you know who you are! :-). I'm going to take it in two parts: this post will focus on creating a table automatically that lists the values of attribute references included in block references in the modelspace that point to a particular block table record selected by the user. Phew. The next post will add some functionality to create a "total" of one of the columns in the table we create, by using a table formula that performs a sum of the appropriate cells. The below code is actually…

  • This post is in response to a few requests I've received to show how to embed fields in tables. It follows on from this previous post, where we looked at how to embed a block preview icon in a table. The technique I'm showing in this post is far from being specific to tables, however. You could very easily use it for any other text object that supports fields inside AutoCAD (MText, Text, Attributes, etc.) Fields are very cool objects: they allow you to access a very wide array of information and embed them inside textual objects in AutoCAD. A…