Jump to content
Developer Wiki and Function Reference Links ×

Measure between 2 3D points


AlanW

Recommended Posts

Alan,

Try this. I think the code above represents a function you would call to get a result. I took out that formatting and just made it the code of the node instead. It seems to work as expected

(The file also includes a version of the node where the function is called. I suspect in this case it should actually be cleaned up to remove the duplicate variable names etc.. The first version is way cleaner for a node.)

Kevin

 

Distance 3D KM.vwx

Edited by Kevin McAllister
Re-uploaded file to fix broken link issue
Link to comment

@Alan Woodwelldid you see this link to an article about vectors in Vectorscript? 

@MarissaFit would be great if there was a way to have some articles like this that relate to Marionette. I'm not sure what this resource actually is as its not the official Developer Wiki...

Kevin

Edited by Kevin McAllister
The link wasn't to the official Developer Wiki but some sort of third party Wiki....
Link to comment

With regards to the Vectorlab.info website; I myself had wondered what it was as well.

From the guy who created it :@orso b. schmid
 

Quote

No Tui, we are 'tolerated' by Nemetschek. Never acknowledged, not once. But never forget: initially all was done by Frank Brault, who moved on to other Nemetschek tasks.

Also we are tolerated because there is obviously no intention to compete with the Developer Wiki. I am myself a passionate (read obsessed) editor on dev, which I beg you to consult, when it's about the singular routines.

https://forum.vectorworks.net/index.php?/topic/42750-does-anybody-know-whats-on-with-vectorlabinfo/&do=findComment&comment=216461

It really is an invaluable resource, and in my opinion should be acknowledged at least by the Vectorworks Devs;

For example, on this page : http://www.vectorlab.info/index.php?title=Index_pitfalls; It clearly states the problems one might encounter with regards to Index and certain vectorscript/SDK calls(procedures/functions)..

  • Like 2
Link to comment
  • Marionette Maven

You guys put a lot more work into this than I have for getting a distance, haha

I usually just use the two points as input for a line (or NURBs curve) and use the length node from the object info category (I apologize if my node name/location are incorrect, I'm doing this by memory...). After I've returned the length, I just delete the line/NURBs. I guess it's the lazy in me!

  • Like 1
Link to comment

Thanks for sharing. I find it interesting to hear about all the different ways to do something. Marissa, your way is super simple!

In the end though, it is good to discover the most efficient way if you're using heavy VW files. Extra code, nodes or objects to delete could become a liability if there were 100 separate instances of your Marionette object in your 200mb file :D

Kevin

Link to comment

I'm not actively using marionette but isn't there a magnitude node present in the default nodes folder under "math" ?
I would be surprised if there isn't as this is a really basic math function.

As a general rule, I wouldn't create and delete objects for the sake of calculating something.
You might even run into objects being restated when you undo one step and this isn't a performance friendly solution. 

Magnitude |v| = √( x2 + y+ z2 )
The magnitude is calculated with the vector between your two points, being v2-v1.

  • Like 1
Link to comment

Ello, Where did you find this one??
Don't worry :) found it. And yes works a treat. The best thing about all these questions is gaining knowledge as to whats available to me  in the program when faced with a problem. More choices. Thanks to all for your comments and contributions.
Hippocode, what you have suggested is what is actually in the Distance node that DomC pointed out and the best  thing is I can see how to put that formulae into a Node (even though I don't understand it, LOL).
For those Noobs like me the second image explains it so now I understand.
Thanks

 

Capture.JPG

Capture.JPG

Edited by Alan Woodwell
Add image
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...