Jump to content
tsw

Wall type schedule to display component "Function"

Recommended Posts

Hello,

 

Is there a function to return a wall style component name using its "Function" attribute in a worksheet?

 

scrnsht.thumb.jpg.0388ca598db1a0b9faa5ad805d2e1ca2.jpg

 

I'd like to make a schedule similar to the image below. I can get close using a database header of =COMPONENTNAME(1), =COMPONENTNAME(2), etc... but it falls apart if I don't have exactly 3 components in a wall type.

 

552834378_wallschedule.thumb.JPG.aedd4f4b2e82127083273ae3cc795934.JPG
 

Thanks for suggestions!

 

Share this post


Link to post

The following worksheet script will return the component index of the first component in a wall that has the Function specified by the passed integer. Put this in a database and it will give you the Load-Bearing component of each wall. Use that returned value in a =ComponentName() function to get the name. You may want to put the Index into a column that can be hidden.

 

This script can be run in any file that it exists in. If you want to get fancy, you can slightly change the way the script is called and store it as a text file accessible from any VW file.

 

Copy and paste everything in the code block below into a new black script file (from the Resource Browser). Make sure the script is named ComponentIndex. Use the function =RunScript('ComponentIndex',1) to get the Load-Bearing component index. If you put this in database cell C3, then set C4 to =ComponentName(C3) to get the name of the component.

 

Ask again if you have more questions.

 

Procedure ComponentIndex;

{July 11, 2019}
{© 2019 Patrick Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}

{This is intended to be run as a worksheet script and to}
{return the first component number that has the function}
{indicated by the integer values below}
{That retuned component number can then be used to lookup}
{the ComponentName.}

{Run using a WS call of =RunScript(ComponentIndex,1) to return}
{the component number of the Load-Bearing component.}

{Pass the values below to the WSScript to get the componet with that function
0 - Other 
1 - Load-Bearing 
2 - Insulation 
3 - Inner Finish 
4 - Outer Finish 
5 - Air Gap
}

Var	WallH:Handle;
	B1:Boolean;
	NumComponents,N2:Integer;
	ComponentFunction:Integer;
	ThisFunction:Integer;
	
Begin
	WallH:=WSScript_GetObject;
	ComponentFunction:=WSScript_GetPrmInt(0);
	B1:=GetNumberOfComponents(WallH,NumComponents);
	
	For N2:= 1 to NumComponents do
		Begin
			B1:=GetComponentFunction(WallH,N2,ThisFunction);
			If (ThisFunction=ComponentFunction) then WSScript_SetResInt(N2);
		End;
End;

Run(ComponentIndex);		

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×