Python

  • An interesting post over on the DynamoBIM forum was brought to my attention, and I felt it worth reproducing it here. The Dynamo team have found a way to avoid the need to manually dispose of geometry when creating it from Python or C# – as many package developers do – which they believe will help avoid a whole lot of crashes when working with large geometry sets. If you suspect you're hitting these issues – due to your own code or a package you use – and can help test this new capability, we'd really appeciate you getting in…

  • Colleagues in Autodesk's Office of the CTO (OCTO) – who work in the robotics lab on Pier 9 – have just released the code for a new tool called Mimic. Mimic is an open source plugin – with the Python code posted on GitHub – that allows you to simulate and control the use of a number of industrial robots (including various robots from ABB and KUKA). Here's a screenshot: I'm really happy to see OCTO releasing open source projects in this way. If you're interested in contributing to the project, be sure to check out the developer notes. There's…

  • Over the weekend I managed to complete the BerkeleyX Foundations of Computer Graphics class. This was really an excellent class, both in terms of the structure of the lectures and the homework assignments, which actually scaled in a non-linear way (the last assignment took as much time to complete as the previous three combined). But you were eased into it and didn't strictly need to do the last piece of homework (which was to write a ray-tracer from scratch) to get a "pass" on the course. What's nice about these MOOCs is that – in order to scale, putting the…

  • I've been looking for an interesting problem to solve using MapReduce for some time now. I've been curious about the paradigm and how it can be applied to churn through large sets of data across multiple processing cores: something that's especially relevant as we need to distribute processing – whether to cores that are local or up in the cloud – in order to improve software performance. I talked about much of this when I looked at F#'s Asynchronous Workflows way back when (nearly 6 years ago – ouch). MapReduce frameworks – and there are a number out there: in…

  • So after several posts leading up to the big reveal, as it were, in today's post we're going to see the full "De-skew Raster" application in action – and give you the complete source to fool around with. The main addition over where we were in the last post is the HTML5 and JavaScript UI implementation, as well as the new C# command – called DESKEW – that loads and displays it: Our JavaScript code uses the new JavaScript API in AutoCAD 2014 to execute the other command (DESKEW_IMAGE, which we saw implemented last time) that drives the core Python…

  • In this previous post, we saw some of the issues around executing standard Python code to de-skew raster images inside IronPython (and the effects those differences can have on the results). In this post, we're going to build the ability to execute our Python code from a .NET module loaded inside AutoCAD with the help of IronPython. The next step will be to add in an HTML5 user interface that calls into AutoCAD using the JavaScript API introduced in AutoCAD 2014. Things have changed a bit since we first saw IronPython inside AutoCAD, most notably the additional of the dynamic…

  • As part of the project I'm working on to deskew perspective images and insert them as RasterImage entities inside AutoCAD, I spent quite some time migrating pure Python code – a good deal of which I had to create for various assignments as part of the linear algebra class I've now finished – for it to work inside IronPython. For those of you who aren't familiar with it, IronPython is a variant of Python that works with .NET via the Dynamic Language Runtime. Making it really easy to integrate with AutoCAD. The code as it stood previously was working inside…

  • After getting the basic tasks worked out for the project to de-skew perspective images and attach them inside AutoCAD, I went ahead and got cracking on the next one. I'd already knocked off 1 & 2, and so decided to have a go at task 5. Why task 5? Mainly because I realised I was impatient to put some code together that writes images directly to file, if nothing else to prove that it can be solved in Python with tolerable performance. The way the overall project works is that it holds pixel information in a couple of matrices: one…

  • I'm sitting at Geneva airport, waiting to board a Swiss flight to the UK. I've been hacking away in Python – and now IronPython – for the last few days, which has been very interesting. Here's a quick update on that… I'm now managing to save out PNGs of the de-skewed portions of perspective photographs with a high degree of quality, if not with exceptional speed. I'll post a little on the approaches I tried out – and settled on – when I get the chance. It's now time to get the code working inside AutoCAD: I have the basic…

  • I've managed to find the time to make good progress on my linear algebra class, which means I have an update to share on the image deskewing project I mentioned last week. Thanks to all of you who provided comments on that post, by the way: there's some really valuable information there. The current implementation has been developed in Python and runs completely separately from AutoCAD. Here's my rough integration plan to get it working in an AutoCAD plug-in: Adapt the code to make sure it can easily be applied to other images. Remove any dependencies that might stop the…