Jump to content

Using hoist data for stickers within VW rather than messing with mail merges


Recommended Posts

Hey guys, here's a new one maybe:

 

First: thank you VWX team for making the vanilla hoist system work well. It was pretty rough in 2021, but I really like the kinks you've worked out for 2022.

 

Anyway, here's my current workflow for printing layout stickers:

Make a VWX worksheet --> copy paste into a google sheets template that sorts and highlights the data nicely for me --> perform a mail merge into a doc for printing and touchups --> print

 

It works, but it's kind of a lot of steps and clunky to boot. I wonder if there's a way I can print my stickers straight out of Vector Works?

I know how to make a symbol and link the text within to a custom data record (thanks Pat). But is there a way I can do this where the text links to specified hoist data in a somewhat automated way? Maybe I have to type in the Hoist ID, but the rest of the the data then populates from the matching hoist? and then, is there a way I can easily print dozens-hundreds of these things straight from VWX?

 

Seems a tall order, unless there's some way that's already sort of built in? do it through the cable labeling function somehow?

 

Thank you!

Link to comment

Would you ever need to edit a specific sticker? Or would you just edit the hoist and regenerate the stickers from there? 

 

If you could just edit the hoist and then run a script to regenerate all of the stickers it would be pretty easy. You might have to manually choose the page you wanted to reprint, but the script should run pretty quickly.

 

My first thought is to create a Sheet Layer with as many pages as you need for all of your stickers with a paper size the same as the dimensions of what you print the stickers on.

Create a Symbol of the sticker with a Custom record attached and Link Text To Record set up for all of the fields you need. Include an extra field that you set to a "sticker locator" so that you will always have the same sticker object in the same place. I would use an incrementing number for this.

 

Write a script that will step through all of the hoist objects and fill an array with the data for each hoist that needs to go on the sticker. Sort the array, probably on the Hoist Number so when the stickers print there is some sense to the order they print in.  Store the data from the array into the custom record of each Sticker Symbol and you are set.

 

When you edit the hoists, run the script again and it will replace all of the previous sticker data and generate new stickers.

 

I would probably just manually layout a couple hundred stickers and give them the incrementing numbers. But you could also have the script delete all of the old stickers and place new symbols every time if you want to be sure that there is no chance of something being left behind.

 

Let me know if this sounds like it will work for you. I will be glad to help with at least the outline of the script.

Link to comment

Yeah Pat thank you. That sounds just about perfect. The idea is that I'd like everything to come from the drawing rather than bouncing around various office programs, so keeping everything I want to edit within the hoist symbols themselves is just fine, and you've nailed a good process... 

 

My experience with coding is being pretty serviceable writing functions in excel and knowing some basic java, but I haven't had a reason to dive into scripting in VWX yet, so it's a little intimidating, but this seems like a great excuse. But that's where I'm coming from so I might struggle a little with this...

 

Is there any link you might want me to read/study so that I don't waste your time getting me up to speed with basics?

 

Thank you so much!

Link to comment
  • 2 weeks later...

OK, here is a working outline. But I have left a lot of work to do.

 

You will need to edit the Sticker Format record format to include all of the fields you need to bring across to the sticker. Make all the fields text.

You will need to edit the Sticker Symbol to the correct size and layout for how you are going to print. If you are printing multiple stickers on each printer page, you will need to be careful with margins and sizes.

You will need to place as many instanced of the Sticker Symbol as you need in the correct places to print properly. Once you get them set I would Lock them. If you draw the stickers at 1:1, you can place them directly onto a sheet layer.

You will need to figure out how you are going to print, Does your printer go down the first column of multi-page layouts and then the second, etc. Or does it go across row by row? Use that information to determine which Symbol will have the lowest Record ID and which order you will increment the Record ID.

You will need to manually input the Record ID for each of the placed symbols.  I recommend starting at 1 and just incrementing from there.

You will need to manually attached the Symbol Format record to the symbol definition and  Link Text to Record each of the text blocks in the Sticker symbol to the appropriate field in the Sticker Format record.

You will need to edit the script and add all of the links between the Sticker Format field and the BrxHoist fields.

 

After you do all of the above, you should be able to run the script and have all the data move across.

 

The sort portion of the script is intended to help make sure the hoists end up in the same place in the array of stickers if you run the script a second time. But if you change the stacking order of the hoists, the order will change in the stickers.

 

You can use whatever field names you want when you edit the Sticker Format record format. If you use spaces in the names you have to surround the names in single quotes when you use them in the script. If you don't have spaces you don't need the quotes. Some of the BrxHoist field names do have spaces so there are quotes in at least some lines.

 

Ask if you need more help.

 

 

PTS Sticker test attempt.vwx

Link to comment
  • 11 months later...

  Thank you @Pat Stanford for putting this out there. I have picked up the ball and run with this one so I appreciate all your hard work and excellent script comments. I have tweaked the sticker symbol, added to the record format and the script, and everything is coming together swimmingly. The one stumper I can't get over is the SORT function. Is there any way to do the SortArray by HoistID? Could I or should I somehow add HoistID to the Structure? I'm stumped. Thanks in advance!

Link to comment

Not a lot of time to work on this this week.  After a quick look, I think the following will do it:

 

1. Change the Sticker Structure definition to include an extra field for the Hoist ID.  I will refer to this field as HoistID.

2. Add a line to the FillArray procedure to read the BrxHoist.HoistID and store it into the Sticker.HoistID field.  Something like:

  A1[N1].HoistID=GetRField(Hd1, 'BrxHoist', 'HoistID');

3. Change the third term of the SortArray procedure in the main program to be the number of the field in the Sticker Structure. Is you add the HoistID at the end it would need to be 3.

 

You have to do this to sort on the HoistID because you can't sort an array on data it does not contain.

 

HTH

  • Like 1
Link to comment
23 hours ago, Pat Stanford said:

1. Change the Sticker Structure definition to include an extra field for the Hoist ID.  I will refer to this field as HoistID.

2. Add a line to the FillArray procedure to read the BrxHoist.HoistID and store it into the Sticker.HoistID field.  Something like:

  A1[N1].HoistID=GetRField(Hd1, 'BrxHoist', 'HoistID');

3. Change the third term of the SortArray procedure in the main program to be the number of the field in the Sticker Structure. Is you add the HoistID at the end it would need to be 3.

 

Thanks again Pat. I mostly followed along....

Step 1, I added a field to the structure type String. When I had it as a Integer type, I got an error.

Step 2, I needed to add a colon before the = in the procedure but other than that no errors.

Step 3, I modified SortArray and it does change the sort, just not by hoist ID... I can't tell what it's sorting from.

 

Thoughts?

Ben

Link to comment

The last term in SortArray is the "field" that should be sorted on. Take a look at the order you created the fields in the Structure and make sure you are referencing the correct field.  I am not sure if the count is zero based (first item is number 0) or one based (first item is number 1). Try them both to get what you need. Or send me a test file with your script and I will take a look.

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...