Set Block Attribute Text, either Command Line or Script?

Just upgraded to R8, playing with Block Attributes. If I make a block for a detail title, and have the Detail Number, Detail Name, and Detail Scale as attributes, is there a way to have the attributes automatically populate?

Workflow I was thinking:

  • Run a custom alias or script, it prompts to select a detail
  • Finds the lowest left point of the detail, uses that for block base point
  • Pulls the Object Name and scale from the detail view, populates the attributes
  • Inserts the block at the base point

I may just be drawing a blank on it…

1 Like

Might this functionality help? Rhino - Enhanced Text Fields

Hi Scott,

Cheers; that’s what I’m trying to use though, in a more automatic way. Maybe I’m using it backwards or trying to jump too far ahead in my eagerness…in the section where your detail title (“FURNITURE LAYOUT - OPTION 1”) pulls the scale from the detail and changes from 1/8"=1’-0" to 1/4"=1’-0" - is that title/scale text in a block?

If it’s a block, when I enter the attributes, can I drop in an ObjectName or DetailScale text field?

If so, is there a way to script that, so I can click a button/enter a command, then select the detail view, and have the detail title automatically placed and have the attributes populated?

Hopefully I’m making sense…

Hi Scott,
Typical block attributes are command line scriptable.
Like document number in this example:

Command: -Insert
Insert as ( Block )
Document Number <101>: 102
Insertion point ( Rotate Scale )
Scale factor <1.000> ( ReferencePoint XYZ Rotate )
Rotation angle <0.000> ( AxisAlign ReferencePoint )

This can go in a toolbar macro.

Details scale is text field is associate with a GUID (globally unique identifier) of a specific details.
It will likely not be possible to ever have the GUID when you inserting a title block.
Since layouts can have, details with different scale, associating the test with a specific detail is usually what is done.

One option is to add the Scale of the layout as a Layout User Text.
Then when you insert the title block and there is a text field that uses the Layout User Text line “layout scale”, then it will display in the title block.
image

Right click and copy key and value.
image

Right click and paste key and value to all Layouts…
image

Customize the value one layouts that are not primarily 1/4"=1’-0", or use a note like “Varies”.

Make text and pick Fx. Select Layout user text and the LayoutScale key.

Pick ok

Make a block and insert it on to the layouts.
The text field linked to the Layout User Text field updates automatically with each layout.
See how it is used here.

Just some input for your quest.
Sincerely,
Mary Ann Fugier

1 Like

OK, so disclaimer - I don’t know much Python, only enough to get myself into trouble, BUT…combine sheer stubbornness with Google-Fu, and I think I have a good start here.

It seems that you’re right, so I thought…how about after I insert the block? :wink:

Used Python/Rhinoscript to:

  • pick a detail view
  • Find the bottom left point of that detail view for title insertion
  • place the block with temporary placeholders for the attribute text
  • Select the block that was just placed
  • Use SetUserText to set the Title to %<ObjectName(guid text) and the scale to the DetailScale

Now if only I could get the line between the title and the scale to automatically be as long as the longest text attribute…next quest!

DetailTitle - Export.3dm (68.0 KB)
DetailTitleTest.py (518 Bytes)

1 Like