Jump to content

Set multiple database headers in a worksheet to a layer with Script/ marionette


Recommended Posts

Just checking,

Is there a script/ marionette anywhere that can set the layer for multiple database headers within one worksheet without having to change it manually.

Just to select the worksheet run the script > Pop message shows up, select the layer> click ok > Done ??

 

 

Link to comment

I will wait a while to see if someone already has written this, but I think it could be done.

 

My biggest concern would be putting in enough error checking so that you only "fixed" the layer issue and not cause more problems. Example. What happens when you have a criteria that lists two different layers? Should it change both? Only the first? Only the second? Ignore both? Throw up its hands in disgust and crash VW? 😉 Now extrapolate that to a script with 3 or 5 to 20 layers specified. Every instance of a case like that pretty much needs to be considered to have a robust piece of code. Probably 10x as many lines as what is required to actually make the change.

 

I know you know exactly how you are using the worksheets. And that you will never, ever, ever, change the way you do it 😉 So a simple script would be fine with not code to catch error conditions like that. But the one time you run the simple versions on a worksheet that does not meet the criteria you are likely in for a long complicated problem of trying to figure out what happened.

 

Programming is easy. User proofing is much harder. 😉

 

Link to comment

Thank you for the reply, Ive just started to look into scripting. I understand worksheets/ functions and have made a number of intelligent worksheets for the company.

However i am not sure which scripting language to start with? Any recommendations? Ive tried to look on the forums for the answer yet nothings come up. 

As for the "User proofing" im starting to understand what you mean. So i wrote a statement to use as a method to work to. 

 

Statement as follows;

  1. Search selected 'Worksheet' for 'Database headers'
  2. Select 'Layer' (Message box shows - drop down box which shows all current layers within Vectorworks document.)
  3. Store [Inputted Layer]
  4. Search for first 'Database header' criteria
  5. If 'Database header' contains 'Layer' Criteria
  6. Then, If layer is different to [Inputted layer] replace layer criteria with [Inputted layer]
  7. Else, move to next "Database header"
  8. Once all "Database headers" have been checked 
  9. Message box "Worksheet database criteria amended"
  10. Click 'OK' to end script

I am hoping this is the right simple logic to start with. Thank you again.

Link to comment
  • 3 weeks later...

Hi again,

 

Would it be possible for someone to whip up a quick example of how to script this so i can start, ive been trying to understand scripting and i cant seem to get my head around it. Ive been trying to figure out how the scripting logic works and learning python from UDEMY however i feel i still have a long way to go. Any takers?

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