Jump to content

vs.SetCursor


Recommended Posts

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);

 

Link to comment
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 by The Hamma
Link to comment

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.

 

Link to comment

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 by Pat Stanford
Sarcasm
  • Like 2
Link to comment

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)

 

Link to comment
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.  

  • Like 1
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...