_c_ Posted January 10, 2022 Share Posted January 10, 2022 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 _c_ Quote Link to comment
Antonio Landsberger Posted January 12, 2022 Share Posted January 12, 2022 Hi _c_, I can confirm: vs.GetPt doesn't work running it via Marionette Node in 2020 SP6, 2021 SP5 or 2022 SP2. But there is no crash at least. When I run the Node, vs.GetPt seems to be ignored. If this would work, you could do interesting things for sure. Regards, Antonio 2 Quote Link to comment
Vectorworks, Inc Employee K.Lalkovski Posted January 12, 2022 Vectorworks, Inc Employee Share Posted January 12, 2022 Hi _c_, I'll check why user interactions does not work. Regards, Konstantin 4 Quote Link to comment
_c_ Posted January 12, 2022 Author Share Posted January 12, 2022 Thank you @K.Lalkovski Quote Link to comment
Paolo Posted May 14, 2022 Share Posted May 14, 2022 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! 1 Quote Link to comment
_c_ Posted May 15, 2022 Author Share Posted May 15, 2022 Grazie Paolo, I try it now. 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.