Jump to content

Updating Dates field in titleblock script


Recommended Posts

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

 

  • Like 1
Link to comment
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

Link to comment
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?

Link to comment

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?

Link to comment

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

Link to comment

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.

  • Like 1
Link to comment

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

Link to comment

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

Link to comment
  • 4 years later...
  • Vectorworks, Inc Employee
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.

  • Like 1
Link to comment
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.

 

Link to comment
  • Vectorworks, Inc Employee
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.

  • Like 1
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...