Jump to content
Sign in to follow this  
twk

Python vs C++ SDK

Recommended Posts

Greetings all, its been a while since I have posted here.

Have been developing some plugins for a while now in python, and the workflow has been quite good so far.

There are some roadblocks I have hit with regards to the internal workings of vectorworks (ability to add and delete control points on the fly for a PIO, show error messages in the task bar, and other Event related stuff).

My question is, is python a lesser able language than the C++ SDK? Will it be updated in the future to have more calls/functions to the VS SDK?

thanks

Tui

Share this post


Link to post

First, let me qualify that I am not a computer scientist, and these are possibly gross simplifications.

python as a language is has many differences from c++, and a google search can turn up numerous comparisons (most of which come out favoring Python). The ultimate difference is c++ precompiles the code and python compiles at run time.

If you are creating a script-like plug-in, coding in python is much faster to set up and re-work your code. c++ allows the IDE to link to a large number of classes and constants but only compile what you use into code. The resulting code is faster and smaller, which also allows it to load into persistent memory and run in the background. That means SDK plug-ins run faster, but also they can handle events via multithreading, as opposed to python or vs, which runs the entire script all the way through for each event. From a development perspective, the trade off is that setting up the compiler and structuring your code takes a lot more effort, and you need to restart VW after every code modification.

I would be surprised if adding control points on the fly would ever be supported, as python plug-ins aren't set up for dynamic data storage. Messages in the mode and task bar should be possible with python.

-Josh

Share this post


Link to post

Thanks for your comments Josh.

My question of whether python was a lesser able language than C++ was in the scope of its use/ability in Vectorworks and not the actual languages themselves. Which you addressed very well for me.

I started coding in VS object plugins and a couple of menu commands. And always wondering whether it was worth looking into C++. Hippothamus had started posting on his blog, steps for developing with the SDK and as I was starting to go through them , almost everything went over my head (Coming straight from VS). Then python got supported and, as you mentioned, coding in python is much faster to setup and rework your code with.

You did mention though, the payoff with C++ is that the actual code is faster/smaller and can handle multi-threading etc.

So would you know if there's a list anywhere of what the SDK can do that the basic python/vs modules can't?

Or maybe list out here ones that you know of? I'm really trying to see whether there are some things available there that makes it worth jumping into the C++/SDK world .

Thanks again

Tui

Share this post


Link to post

I started coding in VS object plugins and a couple of menu commands. And always wondering whether it was worth looking into C++. Hippothamus had started posting on his blog, steps for developing with the SDK and as I was starting to go through them , almost everything went over my head (Coming straight from VS). Then python got supported and, as you mentioned, coding in python is much faster to setup and rework your code with.

I admit it's quite overwhelming starting in C++ without experience. But just so you know, I didn't know much about it either and also made the switch coming from VS, without any blog posts available :sick: .

Once you can get one of the sample plug-ins working you will quickly learn how to extend these examples.

I made the switch because of limitations in VS. At that time, there was no python to choose from. My main reasons where extending tools and custom controlpoints.

Share this post


Link to post

You can check out the core API on the developer wiki http://developer.vectorworks.net/index.php/VCOM:VectorWorks:ISDK There are a handfull of calls that are SDK only.

The SDK has a few built in data types for points, lines, and boxes that can be really useful (but nothing you couldn't construct in python).

I think the biggest reasons to use the SDK are events and updaters. If you want to control exactly how a tool responds to actions or how a plug-in inserts in the drawing, the SDK is the only option. You can also use the SDK to listen to events from any plug-in (not just ones you control) and a huge array of UI actions and respond accordingly.

If unlimted control points is something you need, the SDK would be the way to go. If you can get by with creating a set number of CPs and just hiding the ones you don't need, you will certainly get your plug-in up and running faster.

-Josh

Share this post


Link to post

Thanks for the input guys,

-Hippo, the fact that you're created/learnt C++ with VW and no blog post to hold your hand, is beyond me. I salute you.

-Josh, I've gone through the SDK doc on the Dev Wiki and there are a good number of calls that are not available in the VS set.

I think at the moment I will be deveoping in Python until I have a more comfortable feel of the OOP overall; at the same time thanking Dieter with his awesome Python VW Library..

The journey continues..

Cheers,

Tui

Share this post


Link to post

Well if you want a taste of the SDK, my 2017 release will include an open source SDK project that is an extension of my module, with some of the code even open source.

It will also contain some public interfaces that can be used to extend/personalise the tools I've created even further.

Share this post


Link to post

That's awesome Hippothamus, looking forward to seeing it.

cheers

Tui

Share this post


Link to post
I think at the moment I will be deveoping in Python until I have a more comfortable feel of the OOP overall; at the same time thanking Dieter with his awesome Python VW Library..

Great to hear that others really benefit from it. I'm working on a better version of it, as I didn't got everything right from the start. (as is normal for every software thing). Even adding some more helpful docs to get you started as imho, there are some really helpful stuff in the library to setup your plugin very easily. Everyone is welcome to collaborate, even if it's just logging issues are wish list items etc...

Share this post


Link to post

Yea it's been a great insight into the workings of proper software/plugin development. I haven't been able to implement it properly (git forks/branching) as that is where I'm currently at in learning.

I'm an architectural designer by trade and have had a recent increase in interest of programming ever since dabbling in python scripting for vectorworks when it was introduced.

At the moment I've developed quite a few object plugins for our firm in-house with plans to release them for sale when I feel comfortable with their capabilities.

Going back to you library, before you had shared it, I had no idea that a git/version control system ever existed. So I've taken a break from writing plugins to get my head around Git/VCS's. There are other areas of python that also go over my head, such as singleton's, class methods/static methods when to use them and when not to, and the overshadowing plugin/packaging stage for public release..(read: daunting)

Seeing the potential though of learning code I'm almost considering switching professions! ha!

But again, thank you and to everyone who shares selflessly, the journey continues..

Share this post


Link to post
On 11/08/2016 at 7:25 PM, Dieter @ DWorks said:

Great to hear that others really benefit from it. I'm working on a better version of it, as I didn't got everything right from the start. (as is normal for every software thing). Even adding some more helpful docs to get you started as imho, there are some really helpful stuff in the library to setup your plugin very easily. Everyone is welcome to collaborate, even if it's just logging issues are wish list items etc...

Hi Dieter, are you still planning on an opensource-type library? As I would like to start contributing for the next vw2017 release. I feel a bit more comfortable now with Git and OOP.

cheers

Share this post


Link to post
On 9/15/2016 at 2:01 AM, twk said:

Hi Dieter, are you still planning on an opensource-type library? As I would like to start contributing for the next vw2017 release. I feel a bit more comfortable now with Git and OOP.

cheers

DLibrary is already opensource and anyone can contribute. Some parts can really be improved a lot. For the new VW2017 release, I have rewritten the Vectorworks module, so plugins can be more easily created with it, by using configuration. I'll also add examples etc... When contributing, just keep in mind that in one main version, no breaking changes are allowed, and between versions, try to keep them to a minimum.

So please do contribute on anything that's needed. And ask away if something isn't clear so we can improve the docs etc...

Share this post


Link to post

@Dieter @ DWorksgreat share!.. I may have opened my mouth too soon about contributing, seeing the VW2017 has just been released, our office is gearing up for the release here in NZ, and I'll be setting up the new templates etc.

What I had wanted to share though were mainly methods I had done for the Polygon methods, and some attributes that I've setup in our own library that could be used in the DLibrary opensource (attributes were open/closed,clockwise,vertexXY,vertexType etc.

I tried pulling a fork using PyCharm but I'm having trouble setting up the bitbucket plugin for PyCharm. Will try again and post back.

 

Share this post


Link to post
8 hours ago, twk said:

@Dieter @ DWorksgreat share!.. I may have opened my mouth too soon about contributing, seeing the VW2017 has just been released, our office is gearing up for the release here in NZ, and I'll be setting up the new templates etc.

What I had wanted to share though were mainly methods I had done for the Polygon methods, and some attributes that I've setup in our own library that could be used in the DLibrary opensource (attributes were open/closed,clockwise,vertexXY,vertexType etc.

I tried pulling a fork using PyCharm but I'm having trouble setting up the bitbucket plugin for PyCharm. Will try again and post back.

 

Just share when you're ready.

You don't need any plugin for PyCharm, version control is already baked in: https://www.jetbrains.com/help/pycharm/2016.1/version-control-with-pycharm.html.
Just check out the project, open it in PyCharm, and it should detect all, probably asking you what to do. Then you can just use the version control menu from then on.

Share this post


Link to post

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.

Sign in to follow this  

 

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.

×
×
  • Create New...