Hello all,
After having learned some basic Python, I'm trying to get started with Python in Vectorworks.
As an exercise I'm trying to create a basic version of the existing 'Move by Points'-Tool:
Get two points (pt1 and pt2) clicked by the user and then move a previously selected object by (x2-x1, y2-y1) but I'm having problems getting the user input.
As I understood from previous posts, vs.GetPt() only works with commands but not with tools.
Instead, the function to use would be: vs.vstGetPt2D() http://developer.vectorworks.net/index.php/VS:vstGetPt2D
The script of my Tool-Plugin refers to _main.py as follows:
import _main
_main.execute()
_main.py looks like this:
import vs
def execute():
pt = vs.vstGetPt2D()
vs.Message(str(pt))
After starting the tool, no matter where I click, I get (1e+100, 1e+100) as a result.
Also I don't quite understand what the required parameters (inPtIndex, result) should be set to?
In the example above I just left them away which of course causes an Error (Invalid number of parameters...) but still prints the Message.
Setting them to something arbitrary like vs.vstGetPt2D(1, True) doesn't result in an Error but still prints the wrong coordinates.
Is the problem related to the parameters or what is it that I'm not getting?
Thanks in advance!
Daniel