Geometry

  • When I woke up this morning I didn't expect to write a post on this topic, but then I found a kind email in my inbox from an old friend and colleague, Ishwar Nagwani, with some code he'd written and wanted to see posted. Ishwar had generated the test code in response to the following question from a member of the ADN team: This question is to get the corresponding Z of a surface/solid, given a point of XY. This refers to the absolute coordinate, instead of the point on param space. I seem not to find a direct way…

  • Gamification is happening all over the place. In case you've missed what it's all about, this short video should help. To get even more background, here's another from the same source on augmented reality games, which is a follow-on from this video on alternate reality games. After having managed to get Apollonian Packings brought into the very cool PointCloud Browser, I thought it'd be fun to integrate some of the code from another of the PointCloud Browser sample apps, creating a little augmented reality game. Here's the basic idea: each level consists of a packing brought into PointCloud Browser from…

  • After my initial (only partially successful) attempt, earlier in the week, to get 3D geometry from the Apollonian web-service into a PointCloud Browser session, I finally managed to get it working properly. Given the currently fairly light documentation available – especially for the Viper JavaScript namespace which gives access to the 3D rendering capabilities in the browser – I ended up posting a question to the PointCloud forum. The answer was very instructive – I was able not only to get spheres of different radii displayed using the same mesh… … but also to apply different colours to the same…

  • I first became aware of the work being done by 13th Lab a couple of years ago, but just last week someone pinged me about it again and re-triggered my interest (thanks, Jim :-). 13th Lab is a small Swedish company that has created some really interesting Augmented Reality technology. Many AR systems make use of fiduciary markers (which often look like sections of QR codes) to make it easier to determine where the 3D content should be positioned and visualized in the 2D image of the scene being fed from your device's camera. Ideally, though, you want a markerless…

  • I had this question come in via a blog comment. I would usually suggest asking this type of question on the relevant online forum, but something about it intrigued me: Now i would like to ask you that to post an item showing how to get the vertexs of 2d solid to create a boundary, could you add one which shows exporting the entity to other format like .shp.? My first thought was "wow – someone still uses 2D solid objects inside AutoCAD! I wonder what the Solid object's .NET API is like?". (Hopefully this comment doesn't start a flood…

  • After creating a frustum-shaped jig "manually", refactoring the code while introducing the idea of an "Entity Jig Framework and then updating the framework and providing a number of usage examples, today's post looks at a slightly more complex use-case: defining a jig to create a square (in X & Y) box by selecting opposing corners. It may sound simple, but it was actually harder that it sounds – especially when supporting the use of an arbitrary User Coordinate System. It also makes use of a "phase" type that we previously hadn't needed, as we require point input for our second…

  • In the last post I introduced a simple framework to make the definition of multi-input entity jigs more straightforward. A big thanks to Chuck Wilbur, who provided some feedback that has resulted in a nicer base implementation, which we'll take for a spin in today's post. Here's the updated C# framework code that makes use of a simple class hierarchy for our phase definitions: using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Geometry; using System.Collections.Generic; using System;   namespace JigFrameworks {   // Two abstract base classes: one for all phases...     public abstract class Phase   {     // Our member…

  • In the last post we saw some code to create a frustum-shaped Solid3d object inside AutoCAD. I mentioned at the bottom of that post that there seemed to be an opportunity to write a framework of some kind to abstract away some of the repetitive code needed to create a multi-input jig. I probably didn't say it in quite that way, but that was what I was getting at. 🙂 Anyway, after having looked at it some more, here's what I came up with: the EntityJigFramework. It's a class derived from EntityJig that encapsulates some of the common code you'd…

  • As promised, here's the cleaned-up code to jig a frustum inside AutoCAD. When I took on the task of writing this code – live, during the "AutoCAD Programming Gurus Go Head to Head" class at AU – I thought to myself "that should be easy enough – I'm sure I have some code to jig a solid on my blog". Well, I did, but it turned out the code showed how to jig a box, and the code was in Python and Ruby but not C#. So I ended up having to code for my supper, after all. 😉 One…

  • After introducing the work down by Carlos Paris on using AutoCAD to hunt prime numbers, we then looked at some DesignScript code that essentially recreates the core geometry Carlos used to visualize prime numbers. In this post, we'll create some .NET code that iterates through the visualization, gathering primes and tagging them with rays to make them easily locatable. Now use AutoCAD as a graphical hash-table in this way is not the way you're going to discover a billion-digit prime number, but the approach is interesting because it adds useful information to the primes visualization and also shows some potentially…