DomC Posted August 19, 2014 Share Posted August 19, 2014 (edited) Hello I wanted to port some of my Document-Based Pascal Scripts to Python. Not because it ist necessary, just to learn something. I tried just to build a Python example with some commands from the Vectorworks Namespace. def Test(): Text = 'Hello Vectorworks.' vs.AlrtDialog( Text+' This should work, or not?') vs.moveto(0,0) vs.Lineto(0,500) Test() The "AlrtDialog" seems to work. vs.moveto and vs.lineto do not want Many thanks for some ideas! Dom Error Message: Traceback (most recent call last): File "", line 7, in File "", line 5, in in Test AttributeError: 'module' object has no attribute 'moveto' Edited August 19, 2014 by DomC Quote Link to comment
Guest Jim Kelly Posted August 19, 2014 Share Posted August 19, 2014 It's a case sensitivity thing - notice that you have "moveto" as the method name and not "MoveTo" and "Lineto" and not "LineTo". Just ensure the case matches up here: http://developer.vectorworks.net/index.php/VS:Function_Reference You can also use the information at the bottom of here: http://developer.vectorworks.net/index.php/Python to use an IDE when developing that will autocomplete for you and/or do linting to tell you if a method doesn't exist. Quote Link to comment
DomC Posted August 19, 2014 Author Share Posted August 19, 2014 Wow, a stupid alpha error. (vectorscript is not case-sensitive) Thank you so much! Just to complete, the running code: import vs def Test(): Text = 'Hello Vectorworks.' vs.AlrtDialog( Text+' This should work, or not?') vs.MoveTo(0,0) vs.LineTo(0,500) Test() Quote Link to comment
Guest Jim Kelly Posted August 19, 2014 Share Posted August 19, 2014 Oh wow, actually that brings me back now that you mention it, because Pascal was my second programming language, and I guess now that you mention it, yes it wasn't case sensitive. Blast from the past. 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.