AutoCAD .NET
-
I'm still on pseudo-vacation. We really had a great week in the snow: sun during the day (everyday!) with the odd bit of fresh snow overnight on a couple of occasions. It's snowing again now, but unfortunately this time it's set to snow all the way through to the end of the day tomorrow, so it's quite possible we'll head home a little earlier than expected. Which, on the plus side, will allow me to do some prep-work for Monday's Geneva Motor Show project installation. Anyway, all this to say that I've written this post really quickly with plenty of…
-
I'm still mainly on holiday this week, so this is a really silly post that I don't realistically expect to be of use to anyone. But then you never know. ๐ A colleague in Product Support asked me for a quick way to cause AutoCAD to crash, the other day. I didn't ask too much about why he needed to โ I trusted he had his reasons โ and so went ahead and gave it a try. One very standard way to cause software to crash โ at least software that is either written using a pointer-friendly programming language or…
-
To follow on from yesterday's post, today we're going to look at an alternative implementation that โ rather than modifying the Edit shortcut menu that appears for all object types โ adds our custom menu item to the shortcut menu associated with a specific type of object. In our case we want to associate the menu item we introduced yesterday with Table objects. The way to associate shortcut menus in CUI with a particular object is to add an alias with "OBJECT_{DXFNAME}": in our case {DXFNAME} will be ACAD_TABLE, making the alias "OBJECT_ACAD_TABLE". You can also add an alias which…
-
A big thanks to Parrish Husband for both suggesting this topic and providing the majority of the code in this post. Parrish had been attempting to extend the technique shown in this aging post to include an icon with the content menu item. At least one person had done this before, according to the blog comments, but had found โ just as Parrish did โ that the added icon didn't line up with the others in the menu. In fact it completely messed up the alignment of all the other icons in the menu: less than ideal behaviour. So Parrish…
-
A colleague in our Product Support team came to my desk yesterday afternoon with a problem he thought I might find interesting. He was right. ๐ It turns out that AutoCAD tables containing Unicode characters don't export very well to CSV files (for later import into Excel, for instance). Here's a sample table with a number of Unicode characters in it: When exported to a CSV file using the standard right-click menu option it contains a bunch of ? characters: The good news is that it's easy to create your own version of the TABLEEXPORT command โ the one that…
-
I wasn't planning on covering this particular topic today, but then this comment came in overnight and I ended up taking a look into it. Paul has been trying to append a specific cell range to his connection string when creating a data-link for an Excel spreadsheet, adding to the code from this previous post. I gave it a try myself with a hardcoded cell range and it seemed to work fine, and so went ahead and modified the implementation of the TFS command to ask the user to enter their own cell range. What's probably most interesting about the…
-
To follow on from yesterday's post, today we're taking a look at a more interactive โ and iterative โ approach to getting the length of a pipe (defined by a surface generated from an imported SAT file, we're not talking about native Plant 3D objects). This is the second task discussed in the introductory post in this series. We're going to add a CTRLINES2 command that asks the user to select pipe section after pipe section, and will only generate the centreline for a newly-selected section if it's contiguous to the section of pipe that's being "managed" (i.e. whose length…
-
After introducing the series in the last post, today we're going to look at one potential approach for this problem: we will extract and create centrelines for surface objects created after an SAT from an external piping system has been imported into AutoCAD as well as providing a basic command to count their lengths. The code has evolved somewhat since we first saw it in this previous post: it now handles a number of previously problematic scenarios, such as the centrelines for pipe flanges being captured โ it now discards polylines that intersect any cross-section circles that get captured, as…
-
Since publishing this recent post to simplify the process of generating centrelines for surfaces representing pipes โ as imported from an external piping system that only generates SAT files โ I've been thinking on and off about how best to simplify the process of measuring the lengths of these various "pipes". Greg Robinson's comment over the weekend spurred me on even further (thanks, Greg! :-): I'm musing on how one might code up the logic of creating a single continuous 3D poly from the horrid collection of surfaces the step file (.sat) make. This is a daunting logic issue. As…
-
Another interesting question came in by email, this week. Fredrik Skeppstedt, a long-time user of the TXTEXP Express Tool, wanted to perform a similar operation using C#: to explode text objects โ as TXTEXP does โ but then be able to manipulate the resulting geometry from .NET. TXTEXP is an interesting command: in order to explode text objects, it actually exports them to a Windows Metafile (.WMF) using the WMFOUT command, and then reimports the file back in using WMFIN. This, in itself, is trickier than it sounds, as WMFOUT creates the graphics in the file relative to the top…