Geometry
-
In the last post we looked at some amazing visualizations of prime numbers created by Carlos Paris. I also mentioned I'd try my hand at replicating the basic visualization using DesignScript: it's a good fit for solving this kind of problem (we want to create lots of repeated geometry based on the results of mathematical expressions). Incidentally, some readers of this blog have expressed an interest in learning more about DesignScript. I've roped in Robert Aish and Luke Church to share some of their insights into the design of – and uses for – the language, and so they'll be…
-
As Shaan reported over on his blog, AutoCAD gets used in some very surprising ways. This "Hack A Day" article highlights the achievements of Carlos Paris, an HVAC engineer and AutoCAD user who found a novel way to visualize and understand prime numbers. Carlos originally believed he'd found an elusive proof for the twin prime conjecture, and while it turned out not to be the case he certainly found a novel way of representing a Sieve of Eratosthenes graphically. I really enjoyed watching Carlos's videos on YouTube, and thought I'd check in with him by email to see how he'd…
-
There was a follow-up comment on this previous post, requesting that it also create a rectangular boundary around selected geometry. This is a much simpler problem to solve that dealing with a minimum enclosing circle, so I was happy enough to oblige. 🙂 Rather than duplicate code from the previous implement, I went ahead and generalised it to contain a core set of functions that get called from different commands: MEC in the existing case where circular boundaries are required and MER for the new case of a rectangular polyline boundary. I've also adjusted the prompts and code to be…
-
It's been a hectic week and I haven't been able to find much time to work on a final post for today, so I had a quick delve in my "interesting" folder and found this little gem. Not long ago, someone asked me by email about the reason for making the various co-ordinate properties (X/Y/Z) of Autodesk.AutoCAD.Geometry.Point2d and Point3d read-only, essentially making these classes immutable. Being a big fan of functional programming, I can think of lots of good reasons for immutability, most of which (and more) have also been given to justify the logic behind making System.String an immutable…
-
I'm really excited about this. A new programming language and environment for AutoCAD is now available for download on Autodesk Labs (and here's the announcement on Scott's blog, in case, and you should also be aware of this login/download issue – something I just ran into myself). Way back when, I helped integrate the initial incarnation of DesignScript – although at the time we were using its working name, D# – inside AutoCAD. The father of the language, Robert Aish, was put in touch with me on October 17th 2008 and by the time I headed for Las Vegas on…
-
Since posting about the ability to display transient graphics as an ongoing feature that can react to mouse input, I've been thinking of the steps that would be needed to generate a custom gizmo comparable with AutoCAD's viewcube. The post starts to go in that direction by displaying a couple of types of transient graphics in AutoCAD as a "standard" feature: firstly we're going to show screen-fixed text (with code pulled directly from this post) and then we're going to place a a transient box in the drawing itself. This may be pre-cursor to displaying a box-like gizmo, but then…
-
Many, many thanks to Massimo Cicognani for contributing the code in today's post. Massimo contacted me as he was working through some issues with his implementation and then kindly offered to share it with this blog's readers. We've looked at a few different types of overrule on this blog, in the past, and even taken a look at a grip overrule or two. Massimo's much more advanced grip overrule works with a very particular type of polyline: those that alternate between straight and arc segments (with the first and last segments being straight). This might sound a touch specific, unless…
-
This question came in by email, last week: I'm trying to reverse the direction of a polyline thought the API, but I didn't find something in the documentation nor in the web. (Even nothing on your blog.) Can you help me? I also didn't find anything in the public API, although that doesn't mean there isn't something I've missed (I seem to be on a bit of a roll in that respect, lately :-S :-). A couple of thoughts/comments on this problem: Ideally we don't want to create a brand new object, as on the one hand there may be…
-
This is a really interesting topic. At least I think it is – hopefully at least some of you will agree. 🙂 The requirement was to create selectable – or at least manipulatable – transient graphics inside AutoCAD's drawing canvas. As many of you are probably aware, transient graphics are not hooked into AutoCAD's selection mechanism. This is mostly fine, but if you want to implement a ViewCube-like gizmo that manipulates the view or drawing settings in some way, it's hard to do so without the ability to react to the current cursor position is and what's happening with the…
-
To accompany the last post – which raised some questions around when and where to call Dispose() on objects created or accessed via AutoCAD's .NET API – today we're going to look at a few concrete examples. Thanks to Danny P for not only requesting some examples but also presenting some concrete areas he wasn't fully clear on. Let's start by looking at those (and feel free to compare the responses I've put below with the ones I made in direct response to Danny's original comment): Within a transaction where something is added to the database, some new objects (Xrecords,…