Jump to content

Remote Debugging


Recommended Posts

I am trying remotely debug a plugin with Eclipse and Pydevd on MAC OSX 10.15 and Landmark 2021. I have setup a 3.8 conda env for eclipse to match the native VW interpreter, and I can get the debugger to connect and break on a point. but after that it will just constanting freeze VW. im using pydevd 2.8.0 the latest version. Does anyone have any ideas?

Link to comment
  • 2 weeks later...
  • 3 months later...

Hi
I am using PyCharm CE and never tried remote debugging but it sounds interesting. I think there is improvement potential here, because honestly I do not know what a remote debugger would really improve and if it would be worth the effort 🙂

My (ammateur) Workflow:

1.  import the vs.py methods in PyCharm to have intellisense and error-redlining
2. I have a string list which I append frequently with line-Numbers, comments from the code which i can write to a log file. So I can later find where my script stucked and maybe add further comments for more detailed debugging.
3. Or I just make some vs.Message() or vs.AlrtDialog() inside the script for quick and dirty checks.
4. For Script with user interaction (RunTempTool etc. ) I embed the python code into a pascal Script. Because there seems no Events that can make a python script is waiting for VW or VW wait for debugger?. Don't know how that would work with remote-debugging.

Because I do not think a remote debugger can prevent from crashes (as example modification of a not anymore existing object-handle or similar.). Never tried myself to setup a remote debugger.
 

Link to comment

I guess no magic you do not already know.😉


image.thumb.png.8d4924f2c872daa6082fa1b79ba5f6bc.png


And this inside the python code:
image.png.55e34c5279dae7c6b2f963e1dd4bca18.png
Newly I found the method here in the forum to write the values directly to value repository. Which is more clean than values2python function.


What I did not used yet is go back to pascal and do further interactions and then start next python script. But I think this should work. While pascal seems to be nativ-integrated in VW, python have much more comfort to create code or access to OS.  So combining pascal and python seems to be very attractive for scripts.

Next step would be C++. But I am scared from having so much more "magic".
 

  • Like 2
Link to comment

This is very interesting, I've never thought to use the interaction tools like this.

Would this mean that we would have to run separate scripts lanuages for either operation? ie (pascal for interaction, python for everything else).

Link to comment
2 hours ago, twk said:

Would this mean that we would have to run separate scripts languages for either operation? ie (pascal for interaction, python for everything else).

I wish not that we need to do this but it seemed to be necessary if i have python scripts and wants to interact with Vectorworks while script is running. Theoretically is should work with a python script,  if we use the python script as a callback of the temp tool and additionally tweaks.


But that seems to be even more unstylish, then embed everything into pascal scripts which handle user interactions.
Can't estimate if this disadvantage of python code inside VW technically and reasonable at all can be eliminated.

Link to comment
  • 3 weeks later...

Thank you all for the responses! So it seems no one is having much luck with attaching a remote debugger to vectorworks. Twk mentioned being able to kill the debugger process on windows and it releasing Vectorworks. I have not had the same luck with MacOS unfortunately. Like DomC said, I have used vs.AlrtDialog to provide debugging hints, but it can get so painful while debugging loops since it creates sooo many alerts.  

Link to comment

@chrisgeorge292,

   If you are waiting for a specific occurrence in a loop, you can always nest the vs.AlrtDialog() call in an "if" statement. 

 

You can wait for the loop counter to reach a certain point, say 70:

for X in range [1, 81]:
	if X >= 70:
		vs.AlrtDialog(vs.Concat("I'm here: X= ", X))

 

or, an object to reach a certain type:

Hnd = vs.FSActLayer()
while Hnd != 0:
	if vs.GetType(Hnd) == 10:		# Text object
		vs.AlrtDialog(vs.GetText(Hnd))
	Hnd = vs.NextObj(Hnd)

 

   There are endless ways to configure a test for your stopping point. The filter condition can be simple, or complicated. Often the time you spend crafting a filter will save you stepping through a lot of unnecessary steps, especially if you have to run the code more than once. If it doesn't save you time, then don't do it.

 

HTH,

Raymond

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