Jump to content

Reasons for naming Viewports


Cory W.

Recommended Posts

Ok here goes...

 

The version of the script I'm using:

 

Procedure ViewportRename;
{Badly Scripted by Michael Klaers. Chopped around by TW 22 Sept 2023}
{This script will take all selected viewports and change the name of those viewports to be
        <Sheet Layer>/<Drawing Number> (<Drawing Title>)
This version tries to force the name to appear immediately 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, VPClass : String;    
    h,hh:  Handle;
    ViewportLayer: Handle;
    ViewportLayerString: String;
    Procedure RenameVP(h : HANDLE);
Begin                            {***********  BEGIN Procedure  ***********}    
    ViewportLayer:= GetLayer(h);
    ViewportLayerString:= GetLName(ViewportLayer);
    VPClass := GetClass(h);
    VPDwgTitle := GetObjectVariableString(h, 1032);
    VPNum := GetObjectVariableString(h, 1033);
    ResetObject(h);
    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) & (VSEL=TRUE))));
End;
Run(ViewportRename);

 

Hurrah!

Edited by Tom W.
  • Like 3
Link to comment
13 hours ago, Tom W. said:

Again out of interest, is there a programming reason you know of to explain why VW hasn't added the functionality to allow VPs to be created with the naming of our choice automatically from the outset?

There is no programming reason they could not do it since we have written many version of this script.

 

There is a customer service reason.  Almost everyone wants to do it THEIR way.  And that means that you need to have a huge number of options (what is included, what special characters to use, what order to put everything in, etc.) so if VW was to do the script it would not be one of our simple 20 line scripts to accomplish a basic function, it would rather be more like a 2000 (or more) line script with lots of options and error checking, that would still probably only satisfy 70% of the users as either it will be too complicated for most to see as worthwhile, or will not handle their specific desired configuration.

 

Think of something like the Data Tag editor.  It will need to be something like that to be moderately useful to a large swath of users.

  • Like 2
Link to comment
5 minutes ago, Pat Stanford said:

There is a customer service reason.  Almost everyone wants to do it THEIR way.  And that means that you need to have a huge number of options (what is included, what special characters to use, what order to put everything in, etc.) so if VW was to do the script it would not be one of our simple 20 line scripts to accomplish a basic function, it would rather be more like a 2000 (or more) line script with lots of options and error checking, that would still probably only satisfy 70% of the users as either it will be too complicated for most to see as worthwhile, or will not handle their specific desired configuration.

 

Thanks I thought it could just be like custom naming for file export where you can select fields from a list (sheet layer, drawing number, drawing title - what else?) in the order you want + add your own punctuation:

 

Screenshot2023-09-23at21_38_31.thumb.png.8937ee788d8fbcaf19c53f4489596388.png

 

Just need a few more options other than just 'drawing number/sheet number'. If someone wants something more complicated they'd still have the option of typing it in manually. 

  • Like 2
Link to comment

Thanks Michael. Tom, this did the trick for me. You could remove the spaces from ' - '

 

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);

	SetName(h, Date(2,2));
	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) & (SEL=TRUE))));

End;

Run(ViewportRename);

 

Link to comment

Three keys is the absolute maximum I can handle for keyboard shortcuts (🙂) but a dedicated menu is a very good idea! I only realised recently you could do that (duh). Do you rebuild your workspace from scratch each year though as I've been scared into doing? I've got about 200 screenshots to remind me what to do...

Link to comment
14 minutes ago, Tom W. said:

Three keys is the absolute maximum I can handle for keyboard shortcuts (🙂) but a dedicated menu is a very good idea! I only realised recently you could do that (duh). Do you rebuild your workspace from scratch each year though as I've been scared into doing? I've got about 200 screenshots to remind me what to do...

There's a secret keyboard combination for VW Mac users.  (Shout out to @Mark Aceto). There is no option in the workspace editor for Shift+Option+key.  Probably to ensure Windows compatibility.  But you can use the Mac OS System Settings to bind those keyboard shortcuts to menu commands.

 

Brings you back down to 3 keys!

  • Like 1
Link to comment
21 minutes ago, michaelk said:

Yes I rebuild from scratch.

 

If you don't it's easy to miss new tools and menus.

 

If you go to Tools > Workspaces… there is an export button to create a text file of all the menus and tools in your workspace.  It's a great way to make sure you don't forget something.

 

I've done that in the past but it just looked like gobbledegook to me I'll need to look closer...!

Link to comment
19 minutes ago, michaelk said:

There's a secret keyboard combination for VW Mac users.  (Shout out to @Mark Aceto). There is no option in the workspace editor for Shift+Option+key.  Probably to ensure Windows compatibility.  But you can use the Mac OS System Settings to bind those keyboard shortcuts to menu commands.

 

Brings you back down to 3 keys!

 

2's the key number here. Think about it. 2-Pac. 2 Fast 2 Furious. 2, man, that's the number. 2 chipmunks twirlin' on a branch, eatin' lots of sunflowers on my uncle's ranch. You know that old children's tale from the sea. It's like you're dreamin' about Gorgonzola cheese when it's clearly Brie time, baby. Step into my office.

 

Anyway, the shortcuts also magically appear throughout the VW UI (menus, etc). Nevertheless, this is gonna spectacularly backfire on me when I get a PC... 

 

Screenshot2023-09-25at11_53_16AM.png.f71453df0151b99b33e3917dbf456921.png

  • Like 1
Link to comment

I've scanned this and it is touched upon but not explicitly I think. I was taught this by @Helen Law at VWUK and use it extensively now.

Naming viewports allows you to link section viewports to design layers and viewports via section lines which appear automatically. Better still if you move the section line/s cut in the design layer they alter position automatically. More work up front but saves a lot of time in the long run. This can be activated by selecting  your Section viewport(s),  Going to the OI Pallette and clicking on section line instances (at bottom) within which you can nominate where you want the section lines to appear in both design layers and viewports. Cool!

image.png

Link to comment
  • 11 months later...
On 9/21/2023 at 5:26 PM, michaelk said:

 

There are several old versions of those scripts floating around.

 

These are the most recent versions of those two scripts turned into menu commands:

 

RenameVPs.vsm 5.35 kB · 15 downloads Renumber Sheet Layers.vsm 9.9 kB · 15 downloads


hello @michaelk 

I am trying to instal these VSM files, but this extension doesn't appear on the Add files on Plugins Manager:
image.thumb.png.3a1bf420688a9134c2f9c3216ec7267e.png

Can you help me? 
Search about instal VMS files doesn't have much results.

 

Link to comment

You don't need to use the plug-in manager.  Just manually put the files in the correct folder.

 

In Vectorworks go to Preferences > User Folders.  On the top right of the window will be a button that says Reveal in Finder for Macs and Reveal in Explorer for Windows.  

 

Click that button and it will open up your user folder.

 

In that folder will be a Plug-Ins folder.  Put the .vsm or .vso in that folder.

 

Restart Vectorworks.

 

Tools > Workspaces > Edit Current Workspace [OR] > Workspaces if you want to create a new workspace

 

Now you should be able to find the menu commands in the left column and move them to your workspace in the right column.

Link to comment
24 minutes ago, michaelk said:

You don't need to use the plug-in manager.  Just manually put the files in the correct folder.

 

In Vectorworks go to Preferences > User Folders.  On the top right of the window will be a button that says Reveal in Finder for Macs and Reveal in Explorer for Windows.  

 

Click that button and it will open up your user folder.

 

In that folder will be a Plug-Ins folder.  Put the .vsm or .vso in that folder.

 

Restart Vectorworks.

 

Tools > Workspaces > Edit Current Workspace [OR] > Workspaces if you want to create a new workspace

 

Now you should be able to find the menu commands in the left column and move them to your workspace in the right column.

Thank you @michaelk

 

Reset Vectorworks doesn't work. But I reboot the computer helps.
Everything was ok now.

One question:
I understand the plugin rename with: [Sheet Number] [Drawing Number] [Drawing Title]
How I can change the plugin to rename with: [Sheet Title] [Drawing Number] [Drawing Title]
Is it possible?

Link to comment

This should do it.

 

This file has one script.  Open that script, select the entire contents of the script and copy.

 

Got to Tools > Plug Ins > Plug In Manager

 

select the rename viewports menu command in the list

 

At the bottom click Edit Script.

 

Delete everything and paste the script from this file.

 

That should use the sheet layer title rather than the sheet layer name (which is usually a number 🙂 ).

Rename Viewport Sheet Title.vwx

  • Like 1
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...