danm01

2018 Title Block fields?

7 posts in this topic

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

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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

 

 

Share this post


Link to post
Share on other sites

Hi

I wonder if there might be some more concrete examples of how to populate the new title block fields via vectorscript - I'm struggling to make much sense of it. Does anyone have any useful info on this please?

Share this post


Link to post
Share on other sites

I have not played with it much, and not at all in Vectorscript, but it appears that there are a bunch of hidden records attached to the Title Block Object. you should be able to handle them the same way as any other Record.Field combination using GetRField and SetRField.

 

5a09d046cfbe6_ScreenShot2017-11-13at8_58_08AM.thumb.png.36e51133a841043f1904433927a7ac92.png

Share this post


Link to post
Share on other sites

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.

 

 

Share this post


Link to post
Share on other sites

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.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now