Drawing structure

  • Happy New Year, everyone! As mentioned in the last post, I took a couple of weeks off over the holiday period, extending Autodesk's annual "week of rest" between Christmas and New Year to a full fortnight. This time of year clearly has religious significance for many. Some go to church, to temple or even to Stonehenge, some watch one or more of the Star Wars trilogies – arguably which they choose depends on how devout they are. I only ended up watching one Star Wars film, over the holiday period, and while it was from the Despecialized Edition, I don't…

  • Some time ago I posted about how to use Entity.Explode() to do something similar to AutoCAD's EXPLODE command. At the time it was mentioned in the comments that BlockReference.ExplodeToOwnerSpace() had some relative benefits, but it's taken me some time to code up a simple sample to show how you might use it (Patrick's recent comment reminded me I ought to, though). Anyway, to end the week I thought I'd throw together a quick sample. BlockReference.ExplodeToOwnerSpace() doesn't return a list of created objects, so I opted to capture this using a Database.ObjectAppended event handler and then recursively call our custom ExplodeBlock()…

  • Over the last few months I've had a number of people ask me for an update to this 6-year old post on implementing a CAD standards plugin for AutoCAD (which in turn was based on code from an older DevNote created from a much older VB6 sample). Augusto Gonçalves from the ADN team very kindly made a start on this while I was out on vacation, providing a basic port that I've now just put a few finishing touches on. Very few changes were actually needed from the code in the original post, thankfully. Also, I did do my best…

  • I had an interesting email last week from Josh Mathews: I'm having some trouble figuring out how to fix this problem I have and I'm not sure what the best way is to attack it. I have a large set of drawings that have these random strings of underscores strewn throughout the drawing (which look like random lines scattered all around when the drawing is printed – and make it confusing to look at), and so I'm trying to write a function that will iterate through the drawing and find all the text strings that contain ONLY underscores and then…

  • Before the break, I had a characteristically insightful comment from Gilles Chanteau on a post regarding the DGNPURGE implementation that was released as a Hotfix for AutoCAD 2013 and 2014. As usual with these things, sometimes you don't see the wood for the trees once you've started down a particular path. Here's the comment in question: Just a thought, you use: for (long i = 1; i < handseedTotal; i++) ... to scan the whole database, it's a nice way i use too searching for proxies for example. But here you're looking only for entities to check their owners. Won't…

  • I wasn't expecting to write a third part in this series of posts, but then Samir Bittar went and asked a follow-up question that I felt obliged to look into. Thanks for the suggestion, Samir! 🙂 Samir basically wanted to provide the user with more feedback as they're selecting the nested entity – so that the sub-entity gets highlighted, rather than the full block reference. This turned out to be quite a tricky scenario to address. The overall approach I used was to use a PointMonitor to perform a non-interactive, nested selection of the geometry beneath the cursor and then…

  • I was planning to post about Autodesk University 2013 today, but things have just been too hectic. I have a 3-hour layover in Heathrow on the journey home – which starts this evening – so I'll try to use that to post a summary of this year's AU as experienced by yours truly. In the last post we saw some code to move an entity – any entity, with text as the primary requirement – in a block. Here's a version of the C# code that shows the entity as it's being jigged across the screen to its new position.…

  • I had this question come in from Bruce Gordon by email a couple of weeks ago, and it seemed like a fun one to look at: Is it possible to write a utility to pick a text entity in a block reference and move it to a new location? As a first step, I put together some code that launches a nested entity selection and then performs a translation of the selected entity by a specified displacement from the picked point. Given the requirement in the original request, the code works "first time" for text entities (DBText and MText), but…

  • This request came in a few weeks ago regarding the source code for the recently posted DGN clean-up tool: Would you modify the tool so that it can be processed by the equivalent figure ObjectDBX (of course for AutoCAD, not RealDWG)? I would like to give the Database object to the function, and the tool would have to process them in batch (a tool for loading drawings on my side). It seemed like a reasonable enough request, so I spent some time putting together a version of the code that can be used on non-editor resident drawings. I changed the…

  • I'm just back from a relaxing week spent in Ried-Brig and Valsesia, two very interesting – and in many ways similar – Alpine locations in Switzerland and Italy respectively. We were travelling with close friends of ours – she's from Ried-Brig, he's from Valsesia – which meant the week was packed with interesting (and usually "off the beaten track") activities. For instance, here's a panoramic photo I shot from the top of the Sacro Monte in Varallo. Next week I'll be taking some time off to spend with old friends who are visiting from the UK, but in the meantime…