Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

2 Neutral

About Benedick_Miller

  • Rank

Personal Information

  • Occupation
    Lighting Designer
  • Homepage
  • Hobbies
    lighting design, Scuba Diving, Running
  • Location
    London, UK

Recent Profile Visitors

426 profile views
  1. Benedick_Miller

    Number stamp tool with python - how?

    Hi Silas, thanks for trying and replying. As you say - "in Python this function will NOT block execution. It will execute a callback function with the resulted point" - I did read that but i was hoping there was some way around that. I'll stick to Vectorscript for now for this tool.
  2. Benedick_Miller

    Number stamp tool with python - how?

    Hi, Some years ago I wrote a few tools in Vectorscript based on a number stamp. The idea is simple enough: enter a starting number in a dialog, start clicking, the number increments and is "printed" in the drawing on each mouse click. In the actual implementation there is other stuff going on too, but it's just this part I need help with at the moment. The Vectorscript tools work fine, but now I would like to re-write them in Python, but I can't get it working at all! This is because I am probably too stupid to understand what I need to do, but also it is because of the way GetPt() seems to works in Python. Also I don't get how to use KeyDown() in Python. I am open to any suggestion on how to do this in python in any way it works: Enter a starting number in a dialog Start clicking to add numbers (as text) that increment with each mouse click. It seems like this should be simple enough, but I have been trying to get it to work for a while and i can't! Any help would be much appreciated. Here, below, is a simplified version of my Vectorscript that works fine, and below that one example of how I have tried (and failed miserably) to translate it to Python: { V4 Simple Number Stamp Tool By: Benedick Miller Date: 2014-10-06 } Procedure SimpleNumberStamp; VAR n,i,keyhit:INTEGER; pt:POINT; t:STRING; BEGIN n:=IntDialog('Enter the starting number','1'); IF NOT DidCancel THEN keyhit:=27; i:=1; DSelectAll; while not keydown(keyhit) do begin t:=num2Str(0,n); getpt(pt.x,pt.y); TextOrigin(pt.x,pt.y); CreateText(t); n:=n+i; redrawall; end; END; Run(SimpleNumberStamp); And the Python translation: # Print Incremental Numbers on each mouse click until [Esc] # NOT WORKING!!! import vs def label(pt): vs.TextOrigin(pt[0],pt[1]) vs.CreateText(str(n)) vs.ReDraw() def kdwn(): k=vs.KeyDown() return k[1] keyhit = 27 i = 1 n = 1 vs.DSelectAll() n = vs.IntDialog('Enter the starting number', n ) if not vs.DidCancel(): while not kdwn() == keyhit: vs.GetPt(label) n = n + i
  3. OK - thanks - I'll give it a try.
  4. @Dieter @ DWorks Hi, I am new to Python, I am updating some old VS scripts to python, for Vectorworks 2019. Your Library looks great, but is it still being maintained? Can I expect it to work with Vectorworks 2019?
  5. Benedick_Miller

    how to use vs.py in visual studio code

    @twk thanks again for your help. I have switched to PyCharm Community Edition now, thanks for the tip 😀
  6. Benedick_Miller

    Python message box inside Vectorworks

    continued... @DomC - thank for this example, it's really helpful for learning. However there seems to be a mistake in the indenting in your example code, which of course with python is deadly! I got it to work like this: import codecs import os.path import os homeDir = os.path.join(os.path.expanduser("~")) Pfad = '{}/Documents/TempVWFiles'.format(homeDir) FileName=vs.GetFName() File = homeDir+'/Documents/TempVWFiles/'+'Klassenliste_'+FileName+'.txt' d = os.path.dirname(Pfad) if not os.path.isdir(Pfad): os.mkdir(Pfad) KlassenAnzahl=vs.ClassNum() f = codecs.open(File, "w", "utf-8") x = 1 while x <= KlassenAnzahl: Klasse = vs.ClassList(x) x= x+1 f.write('\''+Klasse+'\''+',') f.close() vs.AlrtDialog('Die Datei wurde an folgende Stelle gespeichert:'+File) import subprocess import sys path=Pfad if sys.platform == 'darwin': def openFolder(path): subprocess.check_call(['open', '--', path]) elif sys.platform == 'linux2': def openFolder(path): subprocess.check_call(['gnome-open', '--', path]) elif sys.platform == 'win32': def openFolder(path): subprocess.check_call(['explorer', path]) openFolder(path)
  7. Benedick_Miller

    Python message box inside Vectorworks

    answering my own question above: import codecs - works fine now - the problem was caused with copy /paste (for some reason) - I had to re-write the script by hand to get it to work.
  8. Benedick_Miller

    Vectorworks Abbreviations' Glossary

    thank you for this! PIO was killing me!
  9. Benedick_Miller

    comfy w/ vectorscript lost w/ python

    @twk the link you posted above no longer works - can you post an updated link? the original link: https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&amp;Number=220857#Post220857 links to a nice message: "The Vectorworks Community Board has been upgraded with a bunch of great new features and moved to this location. But don’t worry — ALL of the content has been migrated along with it, so anything that was on the old forum is still available for you to use and reference." but a search for #Post220857 just leads me back to this thread, which ain't much use!
  10. Benedick_Miller

    comfy w/ vectorscript lost w/ python

    @JBenghiat this is perhaps the most helpful single post I have seen on the topic of transitioning from VS to Python. Thank you! - could you please get this posted on the first page of the developer wiki : http://developer.vectorworks.net/index.php/Python - which is extremely terse for a beginner.
  11. Benedick_Miller

    Python message box inside Vectorworks

    I care! - I have old tools I wrote in Vector-script which I need to update, so I am learning python.This looks like a good learning script, but I get an error: File "<string>", line 1 import codecs I am using Vectorworks 2019 on MacOS 10.14.2
  12. Benedick_Miller

    how to use vs.py in visual studio code

    hi twk, thank you very much for this, very helpful. I will try this later. It makes sense. Sorry for "dumb" questions - I am trying to teach myself Python at the same time as learning how to use VS code, so I can update my ancient Vectorscript plugins. All the help in this forum is much appreciated.
  13. Benedick_Miller

    how to use vs.py in visual studio code

    Thanks for the reply. The trouble is I don't know how, or where, to edit the VS Studio search paths. I'll keep trying!
  14. Hi, I am just starting off with python for Vectorworks - I use Visual Studio Code (VS Code) as my IDE on a Mac (MacOS 10.13) I have downloaded vs.py but I have no idea how to set up VS Code to "see" vs.py for intelli-sense or linting The instructions: "To help intelli-sense for Vectorworks Python script APIs, you can point your IDE to the file File:Vs.zip (download, unzip, and place it appropriately so the IDE could find it)" don't help me much. Can anyone explain the steps needed to point VS Code to vs.py (or an alternative)?
  15. Benedick_Miller

    Edit lighting instruments INSTANT CRASH

    Hi Tcourse, when you say the RuntimeCache folder does not exist: how far along the path do you get? Here is the full path on my machine: /Users/*myUserName*/Library/Application Support/Vectorworks/2017/Plug-ins/RuntimeCache/


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.