On Land

Environment Information
At Rill Architects we run ArchiCAD on macOS. If you work at Rill, this is your stuff. If you don't, but you work in ArchiCAD, you may find something interesting. Anybody else, I don't know.
RSS

This object builds a model of any pen set in the project. Yes, a model. There is a block for each pen, which is the color of the pen, and the height of the block is the width of the pen enlarged from mm to meters.

Pen Sets Model

There is no REQUEST for pen set data in GDL. So to get the pen set data, we need to export it to XML from Attribute Manager.

Then we run a series of regex find/replace operations in BBEdit, using an Automator application. This strips out all the XML formatting, leaving only the pen set data, and then adds some GDL code.

These are the regex operations:

  1. Strips tabs
  2. Replaces empty description tag with <Description></Description> for symmetry with non-empty descriptions
  3. Reformats width but I don't see the effect; must be for special cases
  4. Reformats each pen block into one line of #, width, RGB
  5. Replaces "1," at the beginning of each pen set with "PUT 1,"
  6. Deletes other attribute types
  7. Deletes header stuff before the first PenTable
  8. Converts PenTable tag to ID and name, code to put ID and name into arrays
  9. Puts pen #, width, RGB into PenData array, after pen 255
  10. Deletes all closing tags

As you can see, I can't remember why we need step 3, but I was afraid to remove it.

Just for fun, here is the search string for step 8:

<PenTable Idx=".*" Name=".*">\n<OdbObj Mv=".*" Sv=".*">\n<OdbRef>\n<guid>.*</guid>\n</OdbRef>\n<CreaTime>.*</CreaTime>\n<ModiTime>.*</ModiTime>\n</OdbObj>\n<Name>(.*)</Name>\n<Index>(\d*)</Index>\n<Flags/>\n<ModiTime>.*</ModiTime>\n<RegMemoTable MemoNumber=".*" Mv=".*" Sv=".*"/>\n<ReadOnly>.*</ReadOnly>\n<Pens>

These get replaced with this:

IDseed = IDseed + 1\rsetID = \2 \rsetIDs[IDseed] = setID\rsetNames[IDseed] = `\1`

The resulting text, which is bunch of PUT statements and arrays being filled, is copy/pasted into the Master Script of the template model object.

So now we have an object that knows the name of every pen set, and the weight and RGB of every pen in each one.

The names go into a VALUES{2} parameter list so the user can choose the pen set by name. I'm sorry they're not in alphabetical order; I could probably fix that.

Pen Sets Model

The 3D script builds a matrix of blocks, each one with a custom material defined by the RGB of the pen.

The 2D is just a PROJECT2, making this, it just has to be, the most computationally intensive 2D pen table object anywhere.

You can graphically select the pen set using the slider marked with a plus sign at the bottom of the table.

Note: The object ignores the current model pen set. The colors and weights only come from the pasted data.

Requirements

Archicad 23 or 24
A Mac
BBEdit
Free Time

Instructions

In Attribute Manager, select all of the pen sets and copy them to the right by index. Export the XML attributes file. Drag the XML onto the Pen Data application icon. BBEdit will launch if it is not running, and the converted XML text will be presented in the front window, as well as copied to the clipboard.

Open the object and open its master script. Delete the sample text from between the two lines of asterisks. Paste the converted text here. Do a save as on the object. Place the object in the project. The pen set can be selected in settings, or by sliding the control at the bottom of the table.

Another idea: Graphically editing the weight of the pens via the height of the blocks, then rebuilding the XML file through crazy string operations, so we could import it back into Attribute Manager. This is not implemented at this time.

Download