Jump to content

Python scripts: lack of User Interaction (vs.GetPt, vs.TrackObjectN, etc.), how is the state now?


Recommended Posts

Like many before me, I am struggling to get any kind of User Interaction work in custom plug-ins. This is Vectorscript-Python only, Vectorscript-Pascal works flawlessly.

This affects routines like vs.GetPt, vs.GetPtLn, vs.GetPickObjectInfo, vs.TrackObjectN, etc.: there is no way to set global vars, and most attempts crash VW.

I read over and over all posts in the present list, I cannot get it done.


I am fairly new to Python, so first of all I ask: is anyone aware of a way to get above mentioned routines work in custom plug-ins?

If yes, please let me know how. Otherwise, I'd like to file bug reports. Hopefully we can get a fix at one point, since this problem is recorded since Python was introduced in VW.


There are two things discouraging users to switch from Pascal to Python: lack of user interaction support and weak code encryption.

If we could resolve the first it would be great.


Please @K.Lalkovski, can you help us there?


Thank you


Link to comment
  • 4 months later...

I get vs.GetPt() working in an event driven plugin object (VW2022 on MacOS) with this trick:


def PickPointCallback(pt):

      h = vs.PickObject(pt[0], pt[1])
      if h != None:
            resultStatus, parmName, parmHand, parmRecordHand, wallHand = vs.GetCustomObjectInfo()

          if parmHand != None:
              #do your things with the picked object
      #at the end of the callback function call this
      vs.SetObjPropVS(kObjXHasCustomWidgetVisibilities, True)
#plugin event loop
theEvent, theButton = vs.vsoGetEventInfo()

if theEvent == kObjOnInitXProperties:
elif theEvent == kObjOnAddState:
elif theEvent == kObjOnWidgetPrep:
#then in the button hit event, where the get point is called…
elif theEvent == kObjOnObjectUIButtonHit:
	if theButton == buttonID_2:
		#set widget visibility to false
        vs.SetObjPropVS(kObjXHasCustomWidgetVisibilities, False)
		vs.GetPt( PickPointCallback )

#finally the reset event
elif theEvent == kResetEventID:


Without setting custom widget visibilities, calling vs.GetPt() crashes Vectorworks!

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

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...