The Hamma Posted July 29, 2020 Share Posted July 29, 2020 Does vs.SetCursor work in python scripts. I can't seem to make it work. Quote Link to comment
Pat Stanford Posted July 29, 2020 Share Posted July 29, 2020 I am not good enough in Python to know if it is a function problem or a python problem. The following seems like it should work, but the LgCrossC and ArrowC "constants" (defined internally to VS) don't seem to be recognized. import vs vs.SetCursor(LgCrossC); down =False while not down: down, pt=vs.MouseDown() vs.SetCursor(ArrowC); import vs vs.SetCursor(LgCrossC); down =False while not down: down, pt=vs.MouseDown() vs.SetCursor(ArrowC); Here is one that does work in VS. Procedure Test; Var X1,Y1: Real; Begin SetCursor(LgCrossC); While Not Mousedown(X1,Y1) do Begin End; SetCursor(ArrowC); End; Run(Test); Quote Link to comment
Peter Vandewalle Posted July 29, 2020 Share Posted July 29, 2020 I’m in the car right now so I can’t test but I would try with 0, 1, and so on. Or create a little loop with integers and an alert dialog... Quote Link to comment
The Hamma Posted July 29, 2020 Author Share Posted July 29, 2020 (edited) 1 hour ago, Pat Stanford said: SetCursor(LgCrossC) The python script it does not seem to accept the variable "LgCrossC" or "ArrowC" in python 1 hour ago, Peter Vandewalle said: I would try with 0, 1, and so on I tried with numbers and I did not see any change in the cursor appearance. import vs integer = 6 down =False while integer != 0: click = False #define click variable pt = 0 # define pt variable while not click: #waits for click click, pt = vs.MouseDown() #assigns coordinates to pt vs.SetCursor(integer) vs.Wait(2) vs.AlrtDialog(integer) integer = integer - 1 Also what does the "import vs" command do? I can't find any documentation. It doesn't seem necessary for the script to work. Edited July 29, 2020 by The Hamma Quote Link to comment
Pat Stanford Posted July 29, 2020 Share Posted July 29, 2020 I thought that import vs is needed to allow Python to see all of the vectroscript commands. But again, I am not at all a Python guy. Try: 1307 for LgCrossC 1308 for HandC 1309 for ArrowC 1310 for SmCrossC 1311 for WatchC 1312 for TextBarC At least 1307 and 1309 work for me. I got these from digging in the Vectorscript Reference.xml file that comes as part of the SDK. Quote Link to comment
The Hamma Posted July 29, 2020 Author Share Posted July 29, 2020 (edited) Yes that works. Thanks for the tip. I downloaded the SDK. Seems like this info should be written down in a better format thank looking through an XML file. Edited July 29, 2020 by The Hamma Quote Link to comment
Pat Stanford Posted July 29, 2020 Share Posted July 29, 2020 (edited) The 100 of us who are interested know where to look (or who to ask) so why document it better! ;-) Glad to help. EDIT:: [For anyone who did not get it, this comment was SARCASM. Document Everything. Helps the new and helps the old. Even helps the VW new employees. Document everything.] Edited July 30, 2020 by Pat Stanford Sarcasm 2 Quote Link to comment
The Hamma Posted July 29, 2020 Author Share Posted July 29, 2020 This will display each for two seconds although the watch cursor does not appear to work on windows. CrossInteger = 1307 Crossconfig = 'LgCrossC' vs.AlrtDialog('Hit ok to see ', CrossInteger , ' = ' , Crossconfig, ' for 2 seconds') vs.SetCursor(CrossInteger) vs.Wait(2) CrossInteger = 1308 Crossconfig = 'HandC' vs.AlrtDialog('Hit ok to see ', CrossInteger , ' = ' , Crossconfig, ' for 2 seconds') vs.SetCursor(CrossInteger) vs.Wait(2) CrossInteger = 1309 Crossconfig = 'ArrowC' vs.AlrtDialog('Hit ok to see ', CrossInteger , ' = ' , Crossconfig, ' for 2 seconds') vs.SetCursor(CrossInteger) vs.Wait(2) CrossInteger = 1310 Crossconfig = 'SmCross' vs.AlrtDialog('Hit ok to see ', CrossInteger , ' = ' , Crossconfig, ' for 2 seconds') vs.SetCursor(CrossInteger) vs.Wait(2) CrossInteger = 1311 Crossconfig = 'WatchC' vs.AlrtDialog('Hit ok to see ', CrossInteger , ' = ' , Crossconfig, ' for 2 seconds') vs.SetCursor(CrossInteger) vs.Wait(2) CrossInteger = 1312 Crossconfig = 'TextBarC' vs.AlrtDialog('Hit ok to see ', CrossInteger , ' = ' , Crossconfig, ' for 2 seconds') vs.SetCursor(CrossInteger) vs.Wait(2) Quote Link to comment
Sam Jones Posted July 29, 2020 Share Posted July 29, 2020 1 hour ago, Pat Stanford said: The 100 of us who are interested know where to look (or who to ask) so why document it better! ;-) Josh. Put him on salary. Quote Link to comment
The Hamma Posted July 30, 2020 Author Share Posted July 30, 2020 On 7/29/2020 at 12:22 PM, Pat Stanford said: I thought that import vs is needed to allow Python to see all of the vectroscript commands. I figured it out, if you run the python script as an external script that is imported via another script the "import vs" is needed, but when run directly from within vectorworks it is not. 1 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.