Jump to content

Dieter @ DWorks

  • Posts

  • Joined

  • Last visited

Everything posted by Dieter @ DWorks

  1. Hi, I don't maintain it anymore because of medical reasons, but VW doesn't change that fast, and thus it should still work. If there are things not working, it will be somewhere on the developer guide on how to upgrade for the newer version. It's open source, so everyone can contribute to the code.
  2. I tried Tkinter before, and it doesn't work with VW. You should avoid it and use the VW dialog stuff, so it's also consistent for the user.
  3. You can test without VW if you mock the vs module. It's easy and straightforward to do. Though how easy it is depends on what exactly you are testing.... As for testing your script from within VW, take a look at DLibrary, which did this.
  4. Tools aren't objects. Tools are used to generate objects. For example, the rectangle tool will let you create a rectangle in different ways. The rectangle object is the result. The creation of it is what the tool does, and those two have no connection at all. An object should not know how it is created.
  5. Aha, so that could be the real problem! So P.... is cutting it off, and thus it's better to use GetRField for text fields... Hmmm. Need to test this and then add it as improvement to DLibrary!
  6. @JBenghiat, I use SetRField for the plugin instance parameter, and if I put anything greater than 256, it's get truncated. (I use Python). So I guess the unlimited storage only counts for normal records....
  7. There should be no limit, but there still is though.... Don't know if it's because of the calls, or the actual data storage, but I have had the limit with a plugin I made this summer... It's still 256
  8. A monster? That was a minimal version. You'll have to think differently in Python then you did in VectorScript. Working OOP, you can split things up in very small pieces, and then let them work together. Every piece has it's own responsibility, and this makes your code more clear and better to read. You only have to read the main flow, and if you are interested in the details, you can look deeper. For example, if you look at the run in it, you can read was is going on, without needing to know the details, you know what will be drawn, not how. If you want to know how, you can look deeper.
  9. Hi, for those interested, DLibrary is an open-source Python library to create VW plugins. I have moved the repo to github (still have to transfer the issues), as it has better collaboration support and a far better wiki system. https://github.com/dietergeerts/dlibrary. The main benefits of the library is that you can program OOP, plugin setup is a breeze, so are custom dialogs. Not all is already in there, but everyone is welcome to contribute. Just wanted to post this so that more people know of it's existence, and that it's still alive (and kicking).
  10. I see now, it's stated in the docs that script execution will not be blocked (like most other functions do): http://developer.vectorworks.net/index.php/VS:GetPt That means that you have to make sure that you first call that function, and that the callback is actually your main function to execute with everything in it.
  11. You could use http://developer.vectorworks.net/index.php/VS:ValidAngStr, which converst a string into a float angle. The same goes for distances in python, you can't use string, but they can be converted. I put this into dlibrary, so we can use strings like '5m', have a look, you should do something similar for angles: https://bitbucket.org/dieterdworks/vw-dlibrary/src/ac2110e58529cb69cede4a04a94219fc38634fd0/dlibrary/document.py?at=master&fileviewer=file-view-default
  12. Why not store it in a var of the containing scope? user_point = None def catch_point(pt): user_point = pt vs.GetPt(catch_point) vs.Locus(user_point) vs.Message(user_point[0],' ',user_point[1]) vs.ReDraw() Please take a look at https://bitbucket.org/dieterdworks/vw-dlibrary, this would be an ideal thing to put in it.
  13. Some tips: - A file is a module, which is a unit with stuff that work together. You'll never split it up. Things that belong together in a module should stay together. - Never use global variables, there are always better ways. Functions should almost always stand on their own, unless it's a function inside a class that needs the 'state' of the class. - use good names for your vars, so it's clear what they are, if you revisit your code years later, you want to know how it works, good naming will help with that. - use oop, so that the code is more clear and each thing is self-contained. It will make your code better, readable, etc.... Here is a better version of your code (at the top of my head, did not test it, depending on what you are trying to achieve, this could be made far better, some imports are missing, i'm not using my standard IDE right now.) import vs class Shape(object, metaclass=ABCMeta): def __init__(self, origin: tuple, width: float, height: float): """ :type origin: (float, float) """ self.__origin = {x: origin[0], y: origin[1]} self.__width = width self.__height = height @property def origin(self) -> dict: return self.__origin @property def width(self) -> float: return self.__width @property def height(self) -> float: return self.__height @abstractmethod def draw(self): pass class Rectangle(Shape): def draw(self): vs.Rect(self.origin.x, self.origin.y, self.origin.x + self.width, self.origin.y + self.height) class Oval(Shape): def draw(self): vs.Oval(self.origin.x, self.origin.y, self.origin.x + self.width, self.origin.y + self.height) def run(): plugin_length = vs.PLineLength plugin_height = vs.PBoxWidth x = 0 y = 0 - plugin_height / 2 vs.PenSize(2) if plugin_length == 6: vs.AlrtDialog('Hello world.') return my_shape_class = Rectangle if plugin_length < 6 else Oval my_shape = my_shape_class((x, y), plugin_length, plugin_height) my_shape.draw() # This should not be needed here, you can call it in your plugin file itself. run()
  14. Yup, I use those quarters from time to time, really handy! Those shortkeys are one of the few I do out of my head
  15. 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.
  16. @twk, I released an initial 2017 version, with an improved plugin setup, like you can see in the example: https://bitbucket.org/dieterdworks/vw-dlibrary/wiki/2017/examples/plugin_setup.py.
  17. yes, and so many others, level bounding for symbols, etc.... I was really surprised to see all these things they didn't mention, VW is on a good path again. Isn't there a list with ALL improvements and new things? I really hope for a continuous release of new features to know these improvements instead of one big one each year. (or one big one for the BIG sales stuff, and updates for all those smaller things)
  18. I have the Surface Pro 4 i7 16GB RAM 256 GB SSD, and I've tested VW2016 on it. It works great, though some renderings didn't work. I guess for all work, except rendering, this machine will do. The main reason I bought this, is because I wanted to use VW on the go and to show VW stuff to clients, and I was totally happy with my first Pro model. The pen is amazing! I would not recommend any such device as the main VW machine though. Still prefer to assemble my own setup for that.
  19. 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...
  20. @twk, most of the time when I encounter such bug, I just do a normal bug submit, after confirming on the scripting list that it's really a bug.
  21. So true, as this new layout may seem nice and modern at first, it's really terrible. The design is really bad, because you can't see the contexts well enough, which makes it hard to navigate and use the site. Also more color would be nice, maybe add some variable in the styling to change that color every year to reflect the new VW color?
  22. As it's VW that sets these values for you, it's a bug in VW, and you will not be able to do something about it.
  23. value = getattr(vs, 'P%s' % name) or shorter: vs.PYourParameterName [code]
  • Create New...