trashcan Posted May 20, 2022 Share Posted May 20, 2022 Am I the only one who is constantly changing my Viewport Name to match Drawing Titles? What is the use case for those being independent, discrete titles??? 1 Quote Link to comment
0 michaelk Posted August 21, 2022 Share Posted August 21, 2022 Here's a head start: I should have just done this in answer to your question. This file has this script in the Resource Manager, ready to import into whatever drawing you need. Rename All Viewports.vwx 2 Quote Link to comment
0 Mark Aceto Posted May 20, 2022 Share Posted May 20, 2022 @michaelkhas a great script for this that will surely get Sherlocked at some point 1 Quote Link to comment
0 michaelk Posted May 20, 2022 Share Posted May 20, 2022 1 hour ago, Mark Aceto said: @michaelkhas a great script for this that will surely get Sherlocked at some point I keep hoping! Quote Link to comment
0 Tom W. Posted May 20, 2022 Share Posted May 20, 2022 3 hours ago, trashcan said: Am I the only one who is constantly changing my Viewport Name to match Drawing Titles? What is the use case for those being independent, discrete titles??? I always name my viewports "Sheet No./Drawing No. (Drawing Title)". I am quite happy typing in the Drawing Title each time but would DEFINITELY like the Viewport Name to be generated automatically given that it's based on preexisting values. Would your script do this for me @michaelk...? Quote Link to comment
0 michaelk Posted May 20, 2022 Share Posted May 20, 2022 Wrote that years ago: There are several versions and forks fo the script floating around. Here's the one that is currently a menu command in my workspace. (Not saying it's the most recent version 🙂 Procedure ViewportRename; {Badly Scripted by Michael Klaers. Updated Aug 2, 2015} {This script will take all selected viewports and change the name of those viewports to be (Sheet Layer) (Drawing Number) (Drawing Name) This version tries to force the name to appear immeidately in the name field, data tab, OIP when only one VP is selected. Prior to this version the new name appeared immediately in the Nav Palette, but not in the name field.} Var VPDwgTitle,VPName,BText,VPNum : String; h,hh: Handle; ViewportLayer: Handle; ViewportLayerString: String; Procedure RenameVP(h : HANDLE); Begin {*********** BEGIN Procedure ***********} ViewportLayer:= GetLayer(h); ViewportLayerString:= GetLName(ViewportLayer); VPDwgTitle := GetObjectVariableString(h, 1032); VPNum := GetObjectVariableString(h, 1033); ResetObject(h); { Message('Viewport Handle: ',h,chr(13), 'Layer Handle: ',ViewportLayer,chr(13), 'Layer Name: ',ViewportLayerString,chr(13), 'VP Num: ',VPNum,chr(13), 'VP Name: ',VPDwgTitle); } SetName(h, CONCAT(ViewportLayerString,' ',VPNum,' ',VPDwgTitle)); SetDSelect(h); {These two commands are just here to force the new name to appear in the } SetSelect(h); {name field immediately. They can be deleted w/o consequence} End; {*********** END Procedure ***********} Begin {*********** Main Program ***********} ForEachObject(RenameVP,(((T=VIEWPORT)))); End; Run(ViewportRename); 3 Quote Link to comment
0 trashcan Posted June 2, 2022 Author Share Posted June 2, 2022 This is great. @Mark Aceto what does Sherlocked mean? noob vibes Quote Link to comment
0 Mark Aceto Posted June 2, 2022 Share Posted June 2, 2022 2 minutes ago, trashcan said: This is great. @Mark Aceto what does Sherlocked mean? noob vibes I could have some fun with this but I'll give you the straight story... Years ago, there was an indie app called Watson (RIP) which was a more powerful version of Apple's stock app, Sherlock. Apple began incorporating features from Watson into Sherlock until Watson no longer had a viable way forward because users could get most of the same features for free built into their OS. Since then, Apple have notoriously continued Sherlocking indie developers. Some others that come to mind are Flux, Moom and Astropad. In the spirit of truly getting Sherlocked, Flux and Moom are far superior to Nightshift and (Split View?) but for most people trapped in the walled garden, the stock diet versions are good enough. If we started a Sherlock pool, I'd put my money on 1Password as the next target (Apple have been nipping at their heels for the past few releases). 1 1 Quote Link to comment
0 michaelk Posted June 2, 2022 Share Posted June 2, 2022 On 5/19/2022 at 8:04 PM, trashcan said: What is the use case for those being independent, discrete titles??? There is actually a reason. Names in VW have to be unique (w/ very very few exceptions). The names of the viewports that appears in the Navigation Palette and in that dialog that assigns section lines to viewports have to be unique. Or chaos reigns. But you might have 10 viewports called "Section". The Drawing Title in the OIP can be anything and doesn't need to be unique. This script takes advantage of the fact that every viewport has a drawing number, even if you choose to not make it visible. And the numbers can't repeat on a sheet layer. Therefore (assuming Use Automatic Drawing Coordination Is checked - and why wouldn't it be?) even if every viewport on a sheet layer has the same drawing title, the viewport name will be unique because all the drawing numbers have to be unique. The Drawing Title is an outward facing label. Meant to be human readable to the viewer. The Viewport Name is inward facing. Just like nobody will ever know your design layer names, nobody will every know your viewport names. I find it helpful to organize them in a way that mimics the order they appear in the drawing. Which is why I wrote that script that I hope gets "Sherlocked" soon 🙂 1 Quote Link to comment
0 Anders Blomberg Posted August 19, 2022 Share Posted August 19, 2022 @michaelk, or anyone really, could you point me in a direction of how to use scripts, specifically this one? Haven't used such things before. Quote Link to comment
0 Popular Post michaelk Posted August 19, 2022 Popular Post Share Posted August 19, 2022 Absolutely! Scripts can be used in two ways. First as a script that lives in the resource browser. Think of it like a symbol. So it is another resource in the document that can be imported into other documents. The second way is as a menu command. This way it "lives" in the workspace and is available in any document as long as that workspace is active. And it can have a keyboard shortcut. First Method: 1. Copy the text in the post above. It's important that you get everything from the first P in Procedure to the last semicolon. There have been rare (as in I only know of 1 😀) cases of the chrome browser changing carriage returns to something else. If you have issues with the script running try using a different browser. 2. In Vectorworks open the Resource Manager. Set the top center pulldown menu to Scripts. Click the bottom left button New Script… VW will make you create a Script Palette. Scripts are the only resource in VW that MUST be in a folder. That folder is also a palette, like a tool palette that we will use in the very near future. Give the Folder/Palette a name. 3. In the next dialog box give the Script a name. 4. A script editor will open. Paste the script in there. Make sure the language at the top of the editor window is set to VectorScript. (the cool kids here in the forum use Python). Hit OK. You can now open the script palette by either a) Window > Script Palettes or by right clicking on the folder/palette in the resource manager and choosing Open. A floating palette will appear with the name of your new script. To run the script, just double click on the name in the palette. Second Method 1. Tools>Plug ins>Plug In Manager… Choose New in the bottom left. Give it a name. Select Command. 2. Back in the Plug-in Manager choose Edit Script… and paste the script as above. Exit the plug-in manager 3. Tools>Workspace either edit your current workspace or create a new one. Select the Menus tab. The plug-in you just created should be in Miscellaneous on the left. In the right column open the pull down menu you want to put it in and drag from the left column to the right column. Welcome to Vectorworks Scripts 🙂 Post back if you have any problems. Once you start using this script you will see opportunities for others. We will load you up with scripts. Then you will look at a script and think “They don’t look that hard to write …” Then the fun begins. 5 Quote Link to comment
0 Anders Blomberg Posted August 21, 2022 Share Posted August 21, 2022 Cool stuff! This is sure to save me some hours work. Quote Link to comment
Question
trashcan
Am I the only one who is constantly changing my Viewport Name to match Drawing Titles?
What is the use case for those being independent, discrete titles???
Link to comment
11 answers to this question
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.