Jump to content
Developer Wiki and Function Reference Links Read more... ×
jcbarnes75

Get area in square feet independent of document units

Recommended Posts

I am trying to calculate the area of a 2D polygon in square feet, independent of whatever the document units are. The "area" node only returns a value in the document units. Is there a way to specify the units independent of the document settings?

Share this post


Link to post

Hello,

 

the function vs.GetUnits() returns a variable that tells how many units are one inch:

 

fraction, display, format, upi, name, squareName = vs.GetUnits()

 

You can create a node that returns this value. The rest should be straight forward.

 

regards,

Patrick

Share this post


Link to post

You don't have to create a new node from nothing.

I simply hijacked the any-node. 

@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
	this = Marionette.Node( 'UnitsPerInch' )
	v = Marionette.PortOut()
	v.SetDescription('The resulting value')

def RunNode(self):
	fraction, display, format, upi, name, squareName = vs.GetUnits() 
	
	self.Params.v.value = upi

 

 

  • Like 1

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.

×