Jump to content

Worksheet of Viewports and scale


Recommended Posts

  • 1 year later...
On 8/2/2020 at 10:04 PM, Boh said:

How bizzare! Yes I added a couple of columns and now it works. I then deleted both the columns and it still works. Bugsville!

 

How bizzare also that you managed to figure that out!!!!

 

 

On 1/9/2018 at 9:55 AM, Pat Stanford said:

OK, here you go.

 

There are two scripts attached. One that returns the scale as a real number, the other that returns it as a string showing as "1:Scale".

 

If you save these scripts into your file (any script palette will do), then you can call them in a worksheet by using a function of "=RunScript('ScriptName')". Where the script name is replaced by the name you are showing in the script palette. Copy everything in the code blocks below. You can name the scripts anything you want, but I named them "Get_VP_Scale" and "Get_VP_Scale_Text".

 

If you want to be able to use these across multiple files without having to have the script in each file, create a new VW file that contains the script(s) and save it in the Defaults folder for Reports and Schedules.  /Users/Your User Name/Library/Application Support/VectorWorks/2017/Libraries/Defaults/Reports_Schedules.  

 

Then modify the function in the worksheet to "=RunScript(120,'ScriptName')

 

If you need a different format, the scripts can be embellished as necessary to do other processing of the numbers/text to get the output you want.

 

Procedure Get_VP_Scale;

Var	H1:Handle;
	R1:Real;
	
	
Begin
	H1:=WSScript_GetObject;
	R1:=GetObjectVariableReal(H1,1003);
	WSScript_SetResReal(R1);  

End;

Run(Get_VP_Scale);

 

Procedure Get_VP_Scale_Text;

Var	H1,H2:Handle;
	N1:Integer;
	R1:Real;
	S1:String;
	
	
Begin
	H1:=WSScript_GetObject;
	R1:=GetObjectVariableReal(H1,1003);
	WSScript_SetResStr(Concat('1:',R1));  

End;

Run(Get_VP_Scale_Text);

 

 

On 8/2/2020 at 9:26 PM, Pat Stanford said:

The scripts were written in 2018, so they should work in 2019. Don't know what else to tell you.

 

I just downloaded VW2019.  You are correct. It is broken in 2019SP6.  😞

 

BUT, there seems to be a strange work around. If you add two blank columns to the right of the column(s) with the Runscript commands, then they calculate correctly.

 

VERY strange.

Hi 

 

On 1/9/2018 at 9:55 AM, Pat Stanford said:

OK, here you go.

 

There are two scripts attached. One that returns the scale as a real number, the other that returns it as a string showing as "1:Scale".

 

If you save these scripts into your file (any script palette will do), then you can call them in a worksheet by using a function of "=RunScript('ScriptName')". Where the script name is replaced by the name you are showing in the script palette. Copy everything in the code blocks below. You can name the scripts anything you want, but I named them "Get_VP_Scale" and "Get_VP_Scale_Text".

 

If you want to be able to use these across multiple files without having to have the script in each file, create a new VW file that contains the script(s) and save it in the Defaults folder for Reports and Schedules.  /Users/Your User Name/Library/Application Support/VectorWorks/2017/Libraries/Defaults/Reports_Schedules.  

 

Then modify the function in the worksheet to "=RunScript(120,'ScriptName')

 

If you need a different format, the scripts can be embellished as necessary to do other processing of the numbers/text to get the output you want.

 

Procedure Get_VP_Scale;

Var	H1:Handle;
	R1:Real;
	
	
Begin
	H1:=WSScript_GetObject;
	R1:=GetObjectVariableReal(H1,1003);
	WSScript_SetResReal(R1);  

End;

Run(Get_VP_Scale);

 

Procedure Get_VP_Scale_Text;

Var	H1,H2:Handle;
	N1:Integer;
	R1:Real;
	S1:String;
	
	
Begin
	H1:=WSScript_GetObject;
	R1:=GetObjectVariableReal(H1,1003);
	WSScript_SetResStr(Concat('1:',R1));  

End;

Run(Get_VP_Scale_Text);

 

Hi Pat, this works perfectly! How can I use this directly for my titleblock to update the sheet scales automatically?

Link to comment

If you are using the Title Block Border object I don't think you can use this at all. 

 

You might be able to use a worksheet script to store the value into a Record.Field attached to your title block and then possibly use that as a text field.

 

I don't think I fully understand what you want to be able to do.

  • Like 1
Link to comment
23 hours ago, Neda Roohnia said:

Hi Pat, this works perfectly! How can I use this directly for my titleblock to update the sheet scales automatically?

 

It's a logic problem. I have a friend that has been asking for this for years, and my response has always been the same, "How would VW manage that with more than 1 viewport on the same sheet layer but not all of the viewports are the same scale?"

  • Like 1
Link to comment
17 hours ago, Mark Aceto said:

 

It's a logic problem. I have a friend that has been asking for this for years, and my response has always been the same, "How would VW manage that with more than 1 viewport on the same sheet layer but not all of the viewports are the same scale?"

That's a very good point! They can set it up in a way that if there is more than one VP on the sheet layer the titleblock text show: N/A or something like that.

Link to comment
  • 1 month later...
On 4/13/2022 at 8:05 PM, Mark Aceto said:

 

It's a logic problem. I have a friend that has been asking for this for years, and my response has always been the same, "How would VW manage that with more than 1 viewport on the same sheet layer but not all of the viewports are the same scale?"

Agreed! But what if it asks for some more criteria like class etc.? Then it can filter the main one and get the scale. 

  • Like 1
Link to comment
On 4/13/2022 at 1:17 PM, Pat Stanford said:

If you are using the Title Block Border object I don't think you can use this at all. 

 

You might be able to use a worksheet script to store the value into a Record.Field attached to your title block and then possibly use that as a text field.

 

I don't think I fully understand what you want to be able to do.

Thanks a lot, Pat. I am exactly trying to do what you mentioned in here. Trying to use the worksheet to store the value into a Record.Field attached to my title block and use it there. I just don't know how to do 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...