Rick Martin Posted March 31, 2005 Share Posted March 31, 2005 I'm looking for help in writing a script that will recall a saved view. I want to save it as a command plug-in so that I can use a shortcut to return to a specific saved view. Thanks in advance from a newbie, Quote Link to comment
mike m oz Posted April 1, 2005 Share Posted April 1, 2005 Rick - there is already a Saved View option in VW. A view can either be saved under the Page View or from the RH pop-up list on the drawing pane bottom bar. You can then return to these Saved Views by either selecting the required view from the bottom bar pop-up list or opening the saved view script pallette and just double clicking on the view you want. [ 03-31-2005, 08:26 PM: Message edited by: mike m oz ] Quote Link to comment
Rick Martin Posted April 1, 2005 Author Share Posted April 1, 2005 Hi Mike, Yes, but I'm trying to avoid going to a saved view by using the mouse. I'd like to, for example, assign command+option+P to a saved view script that would take me to the saved view "Plan" (with all it's specified layers, sheets, zoom, etc.) Any ideas? Thanks, Quote Link to comment
Rick Martin Posted April 1, 2005 Author Share Posted April 1, 2005 Thanks Jeff! This works like a charm. Quote Link to comment
Guest Posted April 2, 2005 Share Posted April 2, 2005 Try using the VectorScript routine VSave(name:String) to create a saved view and then later your script can call VRestore(name:String) to change the view back to the saved one. You could put the VRestore call into a VectorScript Plug-in Menu, add it to your workspace and assign it a shortcut key (like cmd+option+P) with Workspace Editor. Jeff Quote Link to comment
Sean R. Posted February 15, 2023 Share Posted February 15, 2023 On 4/1/2005 at 5:54 PM, Rick Martin said: Thanks Jeff! This works like a charm. Could you post the working script. I can't find how to use the routine and would like to see how you got it to work. Quote Link to comment
MullinRJ Posted February 15, 2023 Share Posted February 15, 2023 Hi Sean, It's a simple one-line script. It could be more complicated if you want, but if you have already saved a view by name, this one-line script will recall it. Since there are no variable names, the script does not need a PROCEDURE name; / BEGIN / END; / Run(name); structure. VRestore('Your Saved View Name Here'); HTH, Raymond 1 Quote Link to comment
Sean R. Posted February 15, 2023 Share Posted February 15, 2023 what If I need to create the saved view in the file still? I have saved views I use on my current template but on older drawings these don't exist. If I want to use them I have to build them from scratch. can you show me how to use vsave(name:string) to create a script of a current view in one file that I can recall in a different file (after updating the classes and layers manually to match the former file) Thanks Quote Link to comment
MullinRJ Posted February 15, 2023 Share Posted February 15, 2023 Hi Sean, Sadly, Saved Views cannot be Copy/Paste from one file to another; nor can they be Imported. With a bit of work, it is possible that most information from a Saved View could be "gathered" in one file, saved to a neutral domain, then recreated in a second file, utilizing two scripts. I don't know if anyone has published a solution over the years, so hopefully if it has been done, someone will chime in. This has been requested many times over the years, but never implemented. I've thought of doing it several times over the past decades, but my need has never been great enough to justify the time spent. How many files do you need to update? If it's in the dozens or more and you can't find an existing solution, you might consider contracting the job out. But if you have a LOT of time on your hands, you could learn some seriously good scripting skills in the effort. Before you go any further, have you searched this Forum for this topic. I know it has come up several times, but I don't remember if any solutions were put forward. @Pat Stanford, have you any recollection of a prior solution? Raymond Quote Link to comment
Pat Stanford Posted February 15, 2023 Share Posted February 15, 2023 Back in 2009 Wes Garner pointed out that you can copy and paste cameras between files. So one possible solution is to activate the saved view, place a camera object, copy the camera, paste into the other file, create a new saved view. I don't have anything in my files about saving and recreating Saved Views. My thought would be to create a big record format and attach it to an object. Two scripts, one to populate the record from the existing saved view, one to set the view in the second file to those settings. Then you could use DoMenuTextByName to call the Save View... command. You would still have to check and OK the dialog box. Quote Link to comment
Elite Exhibits Posted February 15, 2023 Share Posted February 15, 2023 Ray / Pat Did as quick test of the above (Long have we needed same Saved View in a different design) \ The Saved View add Camera Match Camera to view Copy Camera Past Camera in different drawing Activate Camera View Works great - Except ... Question: ¿ Camera does NOT like to do Top / Plan View ? (and the Class Layer settings of the Saved View...) Suggestions are appreciated. Peter Quote Link to comment
Elite Exhibits Posted February 15, 2023 Share Posted February 15, 2023 FYI One trick we have used successfully a few times Important Part: Old drawing (file without Saved Views) is very similar to new drawing (file with the desired Save Views). Duplicate new drawing. (This one has the desired Saved Views) Turn on all classes New & Old files Unlock all items New & Old files. Delete all items in this duplicate of the New file. Copy all items from Old file (one layer at a time if needed) Paste in Place into the duplicate New file. Layer and Class names should be the same Old / New files Select if Symbols, Textures etcetera, are the Old or New as needed (when prompted). ( May need to retain (locked) a reference locater as Paste in Place is not what it once was...) Group then Ungroup is also another way to keep from having a mess in the process. Old Drawing is now in a file with the Desired Saved Views from the New drawing Peter 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.