
We want a selection filter which simply ignores certain types of colors.
Here is the ‘simple’ result I came up with:
I am going to post a series of articles which attempts to explain complicated ideas in a simple fashion.
Ok, so we’ve done some significant refactoring.
We’ve considered a lot of things. Some things still to be improved:
Here is the code thus far:
Ok, that’s certainly a bit better. Still the namining of the classes is quite poor; and we have the dependency inversion issues that we need to fix. Also is there any need to pass in the beams object direction when at the end of the day, we are converting it to a data structure which the printer can understand? Perhaps we should just pass in the printed data structure? We will address these concerns in Part 3 of our refactoring.

WARNING: The code is very dirty. There’s a lot of repetition here. And I’ve gone up some cul de sacs incorrectly. But that’s ok. It’s code which works. We can worry about refactoring for another day – in fact, that will make for a very good exercise. Here is a link to where I document the refactoring process.
I’ll walk you through the code:
Here is the full code unencumbered by commentary:

A nifty little tool that automatically inserts trusses into bubble deck panels depending on:
And also their:
Please remember to select all the panel lines.
You can see a video demo here:
Create Truss – Tek1 Tools for BubbleDeck from Tek1 on Vimeo.

In the last part we left off having obtained all the bolt distance and placing them in a domain object. In this instalment we will try to export all that data into an Excel Spreadsheet. Please note that the following code is untested – unfortunately there was a lightening storm in Melbourne which short circuited my flux capacitor which means I cannot connect to the TeklaServer – so rather than wait, I thought to get this code out to you.
There are many libraries out there: XLS compatible and not:
The consensus is that the worst of the above is still better than using Microsoft’s office interop dll. If you use that approach, you will need to ensure that MS Office is installed in your deployment machine, and secondly, be sure to dispose of all relevant objects. If you forget, then you’ll be leaking memory. This is a very important point.
* A significant change has been made – we are now filtering the SinglePartDrawings based on: (i) whether they are beams or not and (ii) whether they have the relevant profile – a reader wrote an email asking for this version of the code. I have left the previous version out there as well.
* I’m not an expert with ClosedXML – I just wanted to get the code out there. So it’s a very hackish and non-elegant solution, but I hope it serves to illustrate the point.

The problem with using a database, when you have another primary source of information, is that the database needs to be updated. Constantly. If someone forgets to update the database, then you will be relying on information that is old/erroneous and not updated. That’s a huge risk. It’s the type of thing that you want to do only if your staff are disciplined, and the gravity of failure is low, should they forget. But if the reverse is true, then you’re sure to eat humble pie, and cause a lot of needless trouble and expense for yourself and all you deal with.
There was a political war over the implementation: I was for using the original database, and the boss was for creating a new one. Accuracy vs speed. Speed won the victory. And I must oblige by constantly updating a database with panel information.
Anyways enough with the back ground. [Here’s how you do it.]( https://forums.mysql.com/read.php?174,601264,601264)
And I’ll paste it in below, just in case the link fails, as it is wont to do, inevitably – at some time in the future.

In the last part, we left off having collected the relevant Single Part Drawings that we were after. Hopefully we have applied the correct property to filter out the ‘HEA’, ‘IPE’ and ‘CC’ drawings. We will now focus on part II – extracting the distance of the bolts from the beam’s start position.
I did refactor the code a little bit, so it might not look exactly the same as the last version. The code is pretty self explanatory. But you will note that:
Here is the code in all it’s glory – simply follow the well detailed comments and it should be fairly straightforward. As always, any questions, feel free to ask.
We now have extracted the relevant information. Part III will delve into extracting this data in an Excel format. We will most likely use an OpenXML on other such library for that purpose. That post will come shortly, when I get a spare moment. Till that time, enjoy the following – or perhaps it can be left as an exercise for the user?!

Every now and again we obtain a request from our readership to tackle a problem. If it is of general interest to the public and given our commitments we do sometimes oblige. Here is one such interesting problem. We will tackle this in three parts, and will focus on part 1 in this blog post.
The first part is easy enough – and the code is pretty self-explanatory. We want to iterate through all the drawings and filter for the specific drawings that we are after.
In the next part, we will look at obtaining the relevant parts that we want and calculating the bolt distances from the start and end points. And finally, we will look at refactoring the code, because it is a little slow, and also from a maintainability point of view.
An Addendum