AlanW Posted September 10, 2016 Share Posted September 10, 2016 Hi, could someone produce a node for vs.ClosestPoints please? Also maybe I can be pointed to the best source to learn to format these nodes correctly. Thanks Quote Link to comment
twk Posted September 10, 2016 Share Posted September 10, 2016 (edited) Hi Alan, below is a node layout that shows how you would write it in marionette. Marionette is basically a sort of wrapper for python, so most of the calls/syntax must adhere to python rules. Very briefly (Disclaimer: I am no Python expert, nor a Marionette one) 1. From the Dev Wiki : http://developer.vectorworks.net/index.php/VS:ClosestPoints vs.ClosestPoints(h1, h2): (pt1, pt2, touching) - th inputs are h1 and h2, object handles. So that means this function must receive handles to two separate vectorworks objects. -the 'return' displaying there is what this function outputs --> pt1 and pt2 are Pts that have xy components, where in python terms would be of type 'tuple' ie (x, y); touching is of type 'boolean' a true or false type variable. 2. Converting these into Marionette, you'd have to cater for these inputs and outputs. There are many ways to achieve this node, this is one of them. Edited September 10, 2016 by twk 1 Quote Link to comment
AlanW Posted September 10, 2016 Author Share Posted September 10, 2016 (edited) Thanks for this, I get most of the simple stuff and have written a few simple nodes but final end what can be combined etc is really looking at other nodes and trial and error. I need to learn the real logic to it. I guess I will have to continue with learning Python, which is fun but I think I need to be under pressure with a course to really learn it. Thanks again. Created the node, most I had correct but it was the ending I was getting stuck on. See attached. I have drawn a line between the 2 points but they are not the closest points and also when you move the objects to intersect the output is still false. Over to you, thanks Closest dist btw 2 objects.vwx Edited September 10, 2016 by Alan Woodwell add file Quote Link to comment
Kevin McAllister Posted September 10, 2016 Share Posted September 10, 2016 Alan, I think its because VW sees the "points" on a circle (and possibly a polyline) as the curve handles. I converted your circles to NURBS curves (I had to rename them as the names disappeared in the conversion) but now it finds the closest points as expected. Interestingly, if you use the Analysis tool which will also find the closest points between NURBS curves, the points by this script have a small margin of error. The loci in the second image are the points found by the Analysis tool.... Kevin 1 Quote Link to comment
AlanW Posted September 10, 2016 Author Share Posted September 10, 2016 (edited) Kevin, Thanks for this, all works fine now, even the true/false for intersecting. With naming I can see why you have added this to the troubleshooting post. Edited September 10, 2016 by Alan Woodwell Quote Link to comment
Recommended Posts
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.