Jump to content

Reasons for naming Viewports


CW2020

Recommended Posts

  • CW2020 changed the title to Reasons for naming Viewports

When you want to link a section line to section vp for example you need to scroll through a list of viewport names to select the one you want. Auto generated names like viewport 1 and viewport 234 aren't very helpful. I don't know why you can't but it would be nice if you could link by viewport drawing title instead.

 

I use a script to rename viewports rather than do this manually which would be very laborious.

  • Like 4
Link to comment

Actually - I think everyone is on to something.

Naming VPs can be a general nuisance - and without a systematic approach liable to be haphazard.

I didn't know about the script - but it sounds like a great idea. I'll have to look into that.

 

One step better would be that VW ingests the functionality of the script into the Create Viewport dialogue. On creation of the VP we would be offered a logical & customizable VP Name that can take advantage of the dynamic text available to Data Tags etc.

  • Like 2
Link to comment
29 minutes ago, bcd said:

One step better would be that VW ingests the functionality of the script into the Create Viewport dialogue. On creation of the VP we would be offered a logical & customizable VP Name

 

Absolutely. I don't really understand why it's not already like the custom naming scheme in the File Export Options where you can insert fields + whatever separators you want + then it gets saved in your preferences for future use.

Link to comment
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 · 5 downloads Renumber Sheet Layers.vsm 9.9 kB · 4 downloads

 

@michaelk just wanted to say your RenameVPs script is excellent thank you god knows why I didn't look at it earlier!

 

I wanted to edit the punctuation + realised that menu commands aren't editable so out of interest, is there a way to access the script in a menu command that I missed or is that just their nature, that they are locked inside + can't be accessed?

 

Instead I used one of the older scripts written out in the other thread: not sure if the version you posted above is better in some way but the one I used seems to be working fine.

Screenshot2023-09-23at08_09_52.png.0813fe954287b00f586a5c3804cdd113.png

 

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?

 

Thanks

  • Like 1
Link to comment

 

@Tom W. Glad you're finding it useful.  I use it almost everyday 🙂

 

Looks like you've already figured it out.  But just in case here is what I believe to be the most recent version of that script (8 years old!!). There's not much to it:

 

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

 

 

Look for the line with

 

SetName(h, CONCAT(ViewportLayerString,' ',VPNum,' ',VPDwgTitle));

 

You can add whatever punctuation you like inside the CONCAT function.  Just make sure it it separated by a comma and surrounded by single quotes.  Currently the "punctuation" is just a space. 

 

So yours might be

 

SetName(h, CONCAT(ViewportLayerString, '-', VPNum, ' (', VPDwgTitle, ')' ));

 

(I didn't test that!)

 

When you create a viewport you can name the viewport and the drawing name in the dialog box.  There is a checkbox (on by default?) that names the viewport as Drawing Number/Sheet Number.

 

I find that I often duplicate viewports, duplicate sheet layers, renumber sheets, move viewports to other sheets, etc.  So I started using the script rather than checking auto name.

 

 

 

 

 

  • Like 1
Link to comment

Thanks Michael! I can see that my version includes several references to class which are missing from the version above: this is because the most recent version posted on the other thread was one you did for @line-weight which included the class name of the VP... But the script seems to work fine nonetheless - unless you think I should clean it up to bring it in line with what you've posted above? My version also has VSEL=TRUE in the criteria - is this superfluous too or is ensuring only visible selected VPs are affected useful?

 

48 minutes ago, michaelk said:

When you create a viewport you can name the viewport and the drawing name in the dialog box.  There is a checkbox (on by default?) that names the viewport as Drawing Number/Sheet Number.

 

I have always left this off by default + been typing in the name in the 'Viewport Name' box. Until now that is!! Now I just ignore it + use your command on the sheet layer. But I wonder why 'Dwg no/sheet no' is the only option VW gives you + you can't build your own naming scheme like in the File Export Options?

Link to comment

I know!  That is super annoying.

 

Here's my guess at what's going on.

 

The software that VW uses to run this forum checks for dangerous things.  One of the things it doesn't like is C H R(#) code.  ( I put spaces between the letters to be able to post it here)

 

In my original code I had a debugging message that was commented out.  It used the C H R code to add a carriage return in the message to make it more readable.

 

If you delete the Message function and the curly brackets surrounding it you should be able to post it.

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