http://developer.vectorworks.net/api.php?action=feedcontributions&user=Fbrault&feedformat=atomVectorworks Developer - User contributions [en]2024-03-29T15:15:02ZUser contributionsMediaWiki 1.41.0http://developer.vectorworks.net/index.php?title=Python&diff=18099Python2014-01-02T22:37:14Z<p>Fbrault: /* Python 3 and Vectorworks */</p>
<hr />
<div>{{LocationMain|category=LocationPYSpecial|specific=}}<br />
<div class="rightmenu"><br />
__TOC__<br />
</div><br />
== What is Python ==<br />
<br />
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.<ref name="python">As described on the Python official website: http://www.python.org</ref><br />
<br />
Also, here is the article about Python in wikipedia: http://en.wikipedia.org/wiki/Python_(programming_language)<br />
<br />
More about Python can be found on the http://www.python.org/ website.<br />
<br />
== Python Version ==<br />
<br />
Python has two public versions Python 2.7 and Python 3.x.<br />
<br />
Vectorworks uses Python 3 language. This is very important when learning about the language and when writing code.<br />
<br />
== How to start with Python ==<br />
<br />
First of all you must learn the Python 3 language. The best place to start is the Python documentation page(http://www.python.org/doc/).<br />
<br />
The fastest way to learn the language is to read through Python Tutorial pages: http://docs.python.org/3/tutorial/<br />
<br />
== Python 3 and Vectorworks ==<br />
<br />
Scripting in Vectorworks with Python is very similar to the way [[VectorScript]] works in the software. All the existing APIs are available in the Python scripts inside the 'vs' namespace. Of course, all of the power of the Python engine is available, so that Python style type inference, classes, iterators, libraries, dictionaries, modules, packages sequence types like lists, tuples and ranges are available in the Vectorworks environment.<br />
<br />
To get started, here is a simple script in Python that displays an alert dialog looks like this:<br />
<br />
[[Image:SimplePythonInVectorworks.jpg]]<br />
<br />
# Right-click on the resource browser and create a new script<br />
# Choose language for the script to be 'Python'<br />
# Type the script<br />
<br />
When executed with a double-click on the script label in the resource browser, the alert dialog will be displayed.<br />
<br />
== Python API ==<br />
<br />
Full functional reference to the Python Vectorworks API can be found on this page [[VS:Function_Reference]].<br />
<br />
== Samples ==<br />
<br />
These are some introductory samples that demonstrate plug-ins for Vectorworks written in Python. They are with increasing difficulty and demonstrate different aspects in the plug-in development under Vectorworks:<br />
<br />
* Sample menu command: [[Python Sample Menu Command]]<br />
* Sample point object: [[Python Sample Point Object]]<br />
* Sample more complex point object: [[Python Sample Point Object (complex)]]<br />
* Sample 2D path object: [[Python Sample 2D Path Object]]<br />
* An object that display an image from the web: [[Python Sample WebLinkImage]]<br />
<br />
== IDE and Debugging Python Scripts ==<br />
<br />
Often users would use external IDE to edit the Python scripts that Vectorworks executes. Modern IDEs provide intelli-sense information (information about the semantics of the code while typing). To help intelli-sense for Vectorworks Python script APIs, you can point your IDE to the file [[File:vs.zip|vs.py (python file)]] (download, unzip, and place it appropriately so the IDE could find it). This way the IDE will know all Vectorworks Python functions and it would provide some information on the parameters and the behavior of the function. Note that those functions are empty and will not do anything if executed.<br />
<br />
It is possible to debug Python scripts in Vectorworks using a third-party application.<br />
<br />
See [[Python Debugging]] for more information.<br />
<br />
== Notes ==<br />
<br />
<references /></div>Fbraulthttp://developer.vectorworks.net/index.php?title=Vectorworks_Plugin_Localization&diff=18074Vectorworks Plugin Localization2013-10-29T22:12:24Z<p>Fbrault: Added a link to the localization webinar</p>
<hr />
<div>You can view a webinar on the localization process as it applies to scripting in Vectorworks at the link below:<br />
<br />
[https://s3.amazonaws.com/download2.nemetschek.net/webinars/vectorworks_developer_network/Globalizing-Your-Products-for-Vectorworks.mp4 Globalizing Your Products for Vectorworks]</div>Fbrault