Gabriel Chan Posted April 11, 2017 Share Posted April 11, 2017 Hi all, Is there a way to vectorscript an automatic update of dates in the titleblock fields prior to publishing? I understand there is the data stamp tool available but it just seems more direct if there was a plugin to execute that targets the date field. Gabriel VW2017 Spotlight user MacOS 1 Quote Link to comment
Andrew Davies Posted April 11, 2017 Share Posted April 11, 2017 I just use the data stamp tool to be honest. Would like a better way of doing it but this is the most reliable way I've found. I use a specific font in my title blocks - but the date stamp doesn't allow for that font so it looks odd - but works. Quote Link to comment
michaelk Posted April 11, 2017 Share Posted April 11, 2017 And, by default, the data stamp updates when the the drawing prints or publishes. Kind of like having a script to update the date … mk Quote Link to comment
Gabriel Chan Posted April 12, 2017 Author Share Posted April 12, 2017 14 hours ago, Andrew Davies said: I just use the data stamp tool to be honest. Would like a better way of doing it but this is the most reliable way I've found. I use a specific font in my title blocks - but the date stamp doesn't allow for that font so it looks odd - but works. Hi guys, Thanks for the input. Yes I think the most reliable work around right now is the data stamp in titleblock. It's just less intuitive for me I think. Not just fonts Andrew, I think when we get to scaling titleblock say for different paper sizes, alignment can run as well. Right now I alternate between A3 through A1 prints so I scale my titleblocks between 0.7 and 1 - data stamp does not scale along so it barely fits some times. Gabriel Quote Link to comment
Hippocode Posted April 12, 2017 Share Posted April 12, 2017 I believe all the publish-like commands are available in vectorscript. You could create a script that updates each titleblok date field, next run the publish dialog in one command. Quote Link to comment
Gabriel Chan Posted April 13, 2017 Author Share Posted April 13, 2017 On 12/04/2017 at 1:49 PM, Hippocode said: I believe all the publish-like commands are available in vectorscript. You could create a script that updates each titleblok date field, next run the publish dialog in one command. Hi Hippocode, I'm fairy new to coding scripts. Would you be able to point me to some links for such resources? On the flip side, there's marionette and I'm wondering if that would be more intuitive for designers? Any upsides/downsides to either methods of scripting? Quote Link to comment
Pat Stanford Posted April 15, 2017 Share Posted April 15, 2017 My personal opinion is the Marionette is the best option for creating new geometry. For anything more complicated than a rectangle with some text in it, you are going to have a much easier time getting a Marionette network to do what you want than a script. For simple modifications to objects where you want them to remain as their original object type and not end up as a marionette object, then scripting is a better option. Passing an already existing object into a Marionette network is a non-trivial task for most real world uses. The options are to hard code an object name into the network (which means that you have to edit the network to make if work on a different object as only one object in a VW drawing can have a given name) or to Wrap the network and Convert to a Marionette Object and pass the data as part of what is called "Control Geometery." If there is more than one object to be passed in it must be grouped first and then ungrouped in the Marionette network to get the individual objects. Stacking order becomes very important. Manipulating data in records and fields as suggested by Hippocode above is certainly a better task for a script than for a Marionette. I ran out of time tonight, but I will see if I can put something together over the weekend. Can you post a VW file with your title block in it so I can see exactly how the fields are named? Quote Link to comment
Gabriel Chan Posted April 21, 2017 Author Share Posted April 21, 2017 Hi Pat, Thanks for offering to help. I've attached a sample title block file for your reference. My current workaround is that I place a data stamp with just the dates over the P_date text. The stamp updates itself every time I publish. I place it on a Titleblock-Stamp class so If I decide that I need to manually enter the date, I just turn off the class, and the "original" title block date field is unmasked. The downside to this is that the data stamp does not scale with the title block. So it sort of lives in the rectangle of the date field for a limited range of scales I apply to the title block. Gabriel VWX Sample Titleblock.vwx Quote Link to comment
Pat Stanford Posted April 21, 2017 Share Posted April 21, 2017 A couple of things. 1. The Custom Titleblock Record in the file you sent does not have a P_Date field, but rather an S_Date field. Which is fine, but it means that you will need to change the date on each sheet border separately. If you always want all the sheets to have the same date, the script can be modified to do that easily. If you want to set a non-explicit subset of the sheets, that will be harder. 2. The S_Date field is formatted at YYDM, This is very different than the way you have the date stamp formatted. 3. I know the attached file could be boiled down to a one-liner, but I needed the Begin/End for debugging and just left it. It will also make it easier to expand in the future to handle multiple sheets. Here is a script that will update a sheet border which is the first selected object on a layer (i.e. the only selected object on the layer as the stacking order determines which is first) that will update the S_Date field of a record named "Custom Titleblock Record" to the current system date. Procedure UpdateS_Date; Begin SetRField(FSActLayer,'Custom Titleblock Record','S_Date',Date(2,0)); End; Run(UpdateS_Date); Try this out and let me know what else you would like it to do. 1 Quote Link to comment
Gabriel Chan Posted April 22, 2017 Author Share Posted April 22, 2017 Hi Pat, The script works great! I think using the S_Date is more useful for my own application where individual sheets are updated separately as compared to using P_Date. Just out of curiosity and making infant steps in coding, is there some place that I can actually reference these coding vocabulary? i.e. Setting the record field = SetRField. I can't really figure out what FSActLayer does. Or am I approaching coding the wrong way to begin with? Gabriel Quote Link to comment
michaelk Posted April 22, 2017 Share Posted April 22, 2017 Check out the VectorScript Language Guide and the VectorScript Function Reference. You're in for hours / years of fun :-). FSActLayer is First Selected object on the Active Layer. Your first 20 scripts will use that function. hth mk Quote Link to comment
Gabriel Chan Posted April 22, 2017 Author Share Posted April 22, 2017 1 hour ago, michaelk said: Check out the VectorScript Language Guide and the VectorScript Function Reference. You're in for hours / years of fun :-). FSActLayer is First Selected object on the Active Layer. Your first 20 scripts will use that function. hth mk Thanks Michael for the treasure trove. I suspect years of fun... Just hoping to find that time! Gabriel Quote Link to comment
michaelk Posted April 22, 2017 Share Posted April 22, 2017 The Language Guide and the Function Reference will get you 80% - 90% of the way there. Asking questions here for Pat, Raymond, Josh, Orso, et. al. will get you the rest of the way. At least that was (and still is!) my experience. Can't believe how patient they are. mk Quote Link to comment
C. Andrew Dunning Posted November 18, 2021 Share Posted November 18, 2021 On 4/21/2017 at 4:32 PM, Pat Stanford said: Procedure UpdateS_Date; Begin SetRField(FSActLayer,'Custom Titleblock Record','S_Date',Date(2,0)); End; Run(UpdateS_Date); Try this out and let me know what else you would like it to do. What is the current syntax for using VS to write to fields in the newer (2021) format TB data format? Quote Link to comment
Vectorworks, Inc Employee Nikolay Zhelyazkov Posted November 24, 2021 Vectorworks, Inc Employee Share Posted November 24, 2021 On 11/18/2021 at 7:50 PM, C. Andrew Dunning said: What is the current syntax for using VS to write to fields in the newer (2021) format TB data format? In 2021 you can actually use the Current Plot Date field of the title block border which automatically updates on publish. I think that this should get the job done without the usage of any scripting. 1 Quote Link to comment
C. Andrew Dunning Posted November 24, 2021 Share Posted November 24, 2021 4 hours ago, Nikolay Zhelyazkov said: In 2021 you can actually use the Current Plot Date field of the title block border which automatically updates on publish. I think that this should get the job done without the usage of any scripting. Actually, I don't necessarily want this automated. I'd like to be able to control when this field (and, possibly, others) gets written/updated. Quote Link to comment
Vectorworks, Inc Employee Nikolay Zhelyazkov Posted November 24, 2021 Vectorworks, Inc Employee Share Posted November 24, 2021 1 minute ago, C. Andrew Dunning said: Actually, I don't necessarily want this automated. I'd like to be able to control when this field (and, possibly, others) gets written/updated. - If you set the Plot Date Format to Manual, then you can have the Current Plot Date not update when publishing. 1 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.