Jump to content
  • 4

Right-click Create Duplicate Worksheet Option


ericjhberg

Question

It would be awesome if you had the ability to right-click on a worksheet, placed anywhere in a drawing and have the option to create a duplicate instance of that worksheet in the resource manager/replace the selected worksheet with said duplicate.

 

This is a workflow that would be extremely helpful when creating duplicate sheets with different worksheet variations, each designed to total different quantities/data present on that sheet alone. Instead, when duplicated such a sheet/worksheet, the original worksheet and criteria are still present and require a cumbersome resource manager duplication and replacement workflow.

  • Like 2
Link to comment

5 answers to this question

Recommended Posts

  • 0

Ask and ye shall receive.

 

The following script will do what you want. If you don't like the amount the new worksheet image is offset, change the value in the Const Off=12"; line to whatever value you like.

 

Procedure DupeWSAndImage;
{©2024  Pat Stanford - pat@coviana.com}
{licensed under the Boost Software License 1.0}
{https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt}
{TL/DR Use as you want, attribution for source, No warranty}

CONST	Off=12";

VAR	H1,H2,H3,H4			:Handle;
	S1,S2				:String;
	X1,Y1,X2,Y2,R1		:Real;
	B1					:Boolean;
	
BEGIN
	ClrMessage;
	H1:=FSActLayer;
	If GetTypeN(H1) = 56 THEN
		BEGIN
			GetBBOX(H1, X1,Y1,X2,Y2);
			H2:=GetWSFromImage(H1);
			R1:=GetWSImageScaleF(H1);
			S1:=GetName(H2);
			B1:=True;
			While B1 DO
				BEGIN
					S2:=StrDialog('Enter the name for the duplicated WS. Must be unique in this file.', S1);
					If GetObject(S2)=Nil then B1:=False;
				End;
			H3:=HDuplicate(H2,0,0);
			RecalculateWS(H3);
			SetName(H3, S2);
			H4:=CreateWSImage(H3, X1+Off, Y1-Off);
			SetWSImageScaleF(H4,R1,True);

		End
	Else Message('First Selected Object must be a Worksheet Image.');
End;

Run(DupeWSAndImage);

 To add this to the right click menu you need to make a Plugin Command and add it to your workspace Context Menu.

 Tutorials for both are in this post:

 

  • Like 1
Link to comment
  • 0

I wrote a menu command script a while back that will replace the Worksheet that a Worksheet Data object is referencing.  It's attached to this message.

 

To install it, follow the instructions below:

  1. Download the attached Replace Worksheet.vsm file.
  2. Drop the file into the Plugins folder of your User Folder.  The easiest way to get to the User Folder is to open up the Vectorworks Preferences, open the User Folder tab, and press the Open in Finder / Explore button.  This will open up the User Folder in an Explorer or Finder window.
  3. Restart Vectorworks.
  4. Add the menu command into your Workspace by going to Tools - Workspaces - Edit Current Workspace.
  5. Select the Menus tab
  6. In the box on the right, find and expand the JNC category.
  7. In the box on the right, find a menu to drop the command in such as Edit or Modify.
  8. Click and drag the Replace Worksheet command from the box on the left to the desired menu in the box on the right.
  9. Click OK to finalize your Workspace.

Let me know if this breaks or doesn't work like it should.

Replace Worksheet.vsm

  • Like 2
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
Answer this question...

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