danm01 Posted September 25, 2017 Share Posted September 25, 2017 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 Quote Link to comment
JBenghiat Posted September 26, 2017 Share Posted September 26, 2017 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. Quote Link to comment
danm01 Posted September 27, 2017 Author Share Posted September 27, 2017 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 Quote Link to comment
Martin Tye Posted November 9, 2017 Share Posted November 9, 2017 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? Quote Link to comment
Pat Stanford Posted November 13, 2017 Share Posted November 13, 2017 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. Quote Link to comment
Martin Tye Posted November 13, 2017 Share Posted November 13, 2017 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. Quote Link to comment
Pat Stanford Posted November 13, 2017 Share Posted November 13, 2017 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. Quote Link to comment
Recommended Posts
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.