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

Converting Strings to Numbers

Recommended Posts

Hello Marionette lovers !

 

Is there anyway using existing nodes to convert strings (like the ones coming from the GetIFC Pset Value ... and many others from IPFC parameters...) into a number or Integer ?

Maybe the node Function could do this trick  ? (but was not capable to implement this properly ...) ?

 

Thanks for your valued inputs !

Share this post


Link to post

If the string is composed of entirely numbers, you can run it through the "float" node. It's a little trickier if you have units in the string, though, and those would require special handling.

Share this post


Link to post

Ok... got it. Tks Marissa !

Yes... i think that in case we do have units involved we better trying creating a custom node and do things in Python instead ... right ?

 

 

Share this post


Link to post

I would take the Function Node and use the formula x[:-2] (to remove the last to items of the string, or x[:-1] to remove the last one etc.). There will be other possibilities with other nodes but I first had to search the right ones.

 

 

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.

×