Jump to content

giez

Member
  • Posts

    3
  • Joined

  • Last visited

Reputation

0 Neutral

Personal Information

  • Location
    Afghanistan
  1. I've been experimenting around with vs.MouseDown(), too. It kind of works but it's of no practical use since snapping won't work anymore which makes precise drawing / moving impossible. It seems like simply getting a click from the user is not as obvious as I thought it'd be.. I'll probably stick to writing plug-ins as commands then. Thanks for your help!
  2. Thanks for your reply. As already mentioned, I can't get vs.GetPt() to work in a Plugin-Tool. The following code works perfectly fine as a Script or Plugin-Command but won't work when used in a Tool (i.e. nothing happens, no Message, no Error,...) import vs def callback(pt): vs.Message(str(pt)) vs.GetPt(callback)
  3. 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
×
×
  • Create New...