Jump to content
Developer Wiki and Function Reference Links ×

2018 Title Block fields?


danm01

Recommended Posts

I'm looking to modify the data contained in the revised Title Block tool via a script. In previous versions I had a worksheet embedded within my title blocks. In order to take advantage of the new field options I will need to modify a few scripts. Any help would be appreciated!

 

Thanks,

Dan

Link to comment

There are hidden records attached to each Title Block Border object:

Title Block Project Data

Title Block Sheet Data

Title Block Revision Data

Title Block Issue Data-x for each revision

 

I don't know to what extent the TBB error checks and refreshes according to the attached data, so be sure to do some testing.

 

Link to comment

OK, that was really helpful. Thanks! I had not realized that this was done with records.

 

In case this comes up for anyone else, this seems to work for me (Python script):

#User defined project name
strProjectName = vs.StrDialog('Set the project name','[changeme project name]');
#Sheet data record format and field
strRecordName = 'Title Block Project Data'
strRecordField = 'Project Name'

def SetRecord(h):
	vs.SetRField(h,strRecordName,strRecordField,strProjectName);
	vs.ResetObject(h);
	
criteria = '((R in [' + "'" + strRecordName + "'" + ']))';

vs.ForEachObject( SetRecord, criteria);

The key is to use the ResetObject function after setting the drawing border field. Otherwise the record gets set but it doesn't display correctly until the drawing border is edited again. This works with Sheet data as well, but I have not messed with Revision or Issue at this point.

 

Note that I'm a terrible coder, so there's no error checking or anything like that. But it does work!

 

-Dan

 

 

Link to comment
  • 1 month later...

Pat - thanks - yes, in fact, that is exactly right (per Josh's previous post). The difficulty I was having was to figure out the names each record and field but, for anyone else who is wondering, the record names are as follows:

recname:='Title Block Project Data'; 
recname:='Title Block Sheet Data';

etc.

Once the record name is identified, the field names are exactly per the list - eg. "Project Name"


I haven't got as far as looking at the revision numbers or some of the other features yet....

 

BTW - to use Get / Set RfField, a handle is required to the relevant object. In this case, the object is the title block. The way I was (and still am) getting the handle was via h1:= GetObject('Border'); having named the title block 'Border'. Is that the most efficient way to get a handle to it, I wonder or is there a better way to select the object, directly? (It is an '86' ie. PIO). It would be great to have your thoughts on this.

 

 

Link to comment

There is an undocumented Criteria  PON  that takes the name of a type of PlugIn Object.

 

So if you only have a single title block on a layer, then something like

 

H1:=GetObject(((PON='Title Block Border') & (L=GetLName(ActiveLayer)));

 

Should get you the handle to the title block.

 

Criteria with functions/variables sometimes don't work so well, so you may want to build all of the criteria into a single string that you then use in the GetObject function.  I recommend using CHR(39) if you need to embed single quotes. Others will comment that you can use multiple single quotes in a row to "escape" the quotes, but I can't see well enough to distinguish a single quote from a double single quote from a double quote.

 

S0:=GetLName(ActiveLayer);

S1:=Concat('(((PON=',chr(39),'Title Block Border'.Chr(39),') & (L=',chr(39),S0,chr(39),')))');

H1:=GetObject(S1);

 

The above has not been tested, so there may be typos, but it should get you close.

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...