Author: admin

  • In Process vs Out of Process

    There seems to be a lot of confusion with folks about the difference between using the AutoCAD .net API vs the COM Interop API. They both hope to do the same things, but via different ways. Given a choice, I’d always recommend using the .net API because it is much more powerful.

    In process – .net API

    This means that the user has to first open AutoCAD. i.e. double click on the AutoCAD icon and start up AutoCAD. once AutoCAD is open and a drawing is opened, then the user has to type in a command: “NETLOAD” and has to select the a file – the result of all your programming/coding efforts. once that file is selected the user then has to run the command “AddLine”. the command will run as you have coded it. in order to do it this way you will need the .AutoCAD net API

    Out of Process – COM InterOp

    In this case, you don’t necessarily have to manually open AutoCAD up. you create your own program, and you open it (much like you would open MS word etc) and your “AddLine” command would run without you, as a user, manually opening AutoCAD and netloading etc.. if you’re going down this path you need to use the COM interop API.

    Using Both

    If you really want to use the .net API, but did not want to manually netload, then you can use a combination of both of the above:

    From the documentation:

    If you need to create a stand-alone application to drive AutoCAD, it is best to create an application that uses the CreateObject and GetObject methods to create a new instance of an AutoCAD application or return one of the instances that is currently running. Once a reference to an AcadApplication is returned, you can then load your in-process .NET application into AutoCAD by using the SendCommand method that is a member of the ActiveDocumentproperty of the AcadApplication.

    As an alternative to executing your .NET application in-process, could use COM interop for your application.

    Hope this clear things up for you.

  • How to insert Reference Models into Tekla

    Wouldn’t it be handy if we could pro grammatically insert reference models into Tekla? Well you can now do so quite easily. And if you want to see a video demonstration, here it is:

    Here is the code which does the hard work. (You will of course add the appropriate references and directives):

  • Adding a Dimension to a Beam – Drawing – (Tekla Open API Tutorial)

    This is an example of a hello world program which dimensions a beam. I found this code in the Tekla Drawing Samples folder.

    You can see it in action here:

    How to dimension a beam using the Tekla Open API (c#)
    How to dimension a beam using the Tekla Open API (c#)

     

    Let’s walk through it:

    1. We have to get the relevant drawing.
    2. Then we have to get the relevant part we want to dimension.
    3. Then we get the view associated with the part.
    4. We save our current transformation plane, and we set a new transformation plane to the particular view’s display coordinate system.
    5. From here, get the part’s identifier and we select the ModelObject in the model itself – to get the relevant coordinates of the Beam we want to dimension.
    6. Once we’ve used the identifier to get the Beam we are after, and to get it’s relevant parts then we create the dimension.
    7. Remember to save back the original transformation plane.
    8. Note: if you insert the dimension then I obtained an exception. I don’t think you need to insert dimensions when working on drawings.
    9. Note 2: if you forget to save the transformation plane back to the original, then you will find that you dimensions will go wacky, next time you run the command. Always remember to leave things as you found them!
    10. Note 3: You have to have the beam in the same plane as your view otherwise it won’t draw the dimension.

     

    Here is the code for your benefit:

     

     

  • Stair Outline Routine (AutoCAD .net + Code attached)

    An example of the type of stairs we draw. We do a lot of stairs. Both AS 1428 and AS 1657 compliant stairs.
    An example of the type of stairs we draw. We do a lot of stairs. Both AS 1428 and AS 1657 compliant stairs.

     

    We continue delving into our discussion of stairs. The boss hates it when I do things like this – releasing code to the public. But it’s too good not to share. Below is a routine you might find useful. We use it to model stairs – it’s super fast, and efficient. It allows us to try different things out and to discard what doesn’t work with ease. I’ve gone to the effort of drawing up an entire flight of stairs and then realised that I’m missing a tread. Then I’d have to redo the whole thing from the beginning. Once you have this outline done, the a good chunk of the work is finished.

    One of our many, many versatile routines:

    Here is a gif of the project:

    A Stair AutoCAD Plugin
    A plugin I wrote for AutoCAD. Written using c#.

    And here is the code for the benefit of study.

    I suppose I should refactor it, but I don’t think I’ll be changing it any time soon. So why worry?

  • AS 1428 Stairs-Handrails – Tek1 Compliance Checklist

    We do a lot of work on handrails – both public access (AS 1428) and also private access (AS 1657).

    Anybody can draw a staircase – and if you’ve ever fallen down some stairs, or if you’ve ever walked up some stairs which do not comply to any standards – then you’ll immediately realise the importance of having stairs that actually comply. It’s paramount for safety.

    Designs of non-complying staircases is something that we see all too often. All the time. The costs of fabricating non-compliant staircases is monumental. We’ve invested a lot in training staff to ensure they follow the standards. And for the benefit of the industry, here is a cliff notes version that our guys use to remind them of the requirements needed for public access stair handrails.

    It is a first class precise that allows detailers to quickly check compliance without wading through reams and reams of legislative like prose within the AS 1428. This precise will be the norm in the industry and is worth its gold. It was made right here by Tek1.

    Please see the attached pdfs and drawings below.

     

     

     

     

  • Why do we set copy local to false?

    When you first get into .net API programming – for AutoCAD plugins, you learn this cardinal rule: make sure the three AutoCAD dlls you refer to have copy local set to false.

     

    Why exactly is this the case? I couldn’t find a better answer than the one offered by Fenton Webb. Here it is in full:

     

    Take a second to look at the AcMgd.dll and AcDbMgd.dll in this folder…. Do you notice that they are much smaller than the ones in the AutoCAD installation folder? There is a big reason for this which is that since the 2010 release of the ObjectARX SDK, we have “liposuctioned” the managed reference DLL’s. I say “liposuctioned” because we literally sucked out the body of the code from each function in the assembly DLL. What we did to create these DLL’s was to actually ILDASM (MSIL disassemble) the original DLL’s, strip all the body code from them and then reassembled them using ILASM (MSIL assembler). OK, now why on earth would we do that, right? Let me explain: the WPF UI designer (and indeed the WinForms designer) in Visual Studio is pretty cool in that it does a great job of showing the design of the UI on screen obviously. The problem is that the designer does like a half-hearted parse of the code behind that controls the UI in order to work out things like how it’s displayed for instance, which when we reference the external AutoCAD managed DLL’s can cause unresolved dependency errors and thus stop the VS Designer from working properly. These dependency errors are caused by the fact that the ac*mgd.dll’s depend on acad.exe which of course the VS Designer finds impossible to load in order to resolve the dependencies. By using the “liposuctioned” assemblies in your project, all of the object definitions are in place to resolve designer parsing issues. You’ll be glad to hear that it still compiles, and loads too! Just as long as you keep the Reference property “Copy Local” set to false for each DLL.

    (Taken from Fenton’s WPF AutoDesk University course notes).

  • Steel Detailing Tips: How to markup A Tekla BIMSight Model

    Download Tekla BIMSight

    Please watch this video on how to markup the Tekla BIMSight Model. It describes the 4 essential steps required to effectively markup a s bim sight model

    Most important is make your comment public, else when you send the BIMSight model, no one will be able to see your comments. Users can mark up the same model and return to you with their own comments.

     

    Watch the video below on how to send your marked up BIMSight Model to your clients.

  • Converting Engineering Components to Detailing Components

    What do we want to do?

    1. We have received a Tekla model from someone.
    2. The model we have received was built using an Engineering Modelling license.
    3. We have a full detailing license.
    4. There are components in this model, but we can’t number them because they were produced using an engineering license. If you want to number them, well they ought to have been created with a detailing license. So what do we do now?
    5. The only way to number these components is to first convert these components to a “detailing component”. The detailing component is a “type” of component.
    6. The problem is that there is no method exposed by the Tekla “Open” API which allows us to programmatically call this functionality. Also to make things more confusing: the nomenclature used in the user interface is different to the nomenclature used by the creators of the Open API.
    7. So what then is the solution?

    The Solution

    Here is a video explaining both the problem and demonstrating a solution:

     

    And here is the code which actually does the work:

     

    I hope you learned something!

  • How to avoid trouble in building and construction projects (Part II)

    (a) Watch out for situations where people start building from unapproved drawings. You don’t want to get involved in such projects.

    Friends, we’ve been in the game for almost a decade. We know the ropes when it comes to building and construction projects. Builders put pressure on fabricators to meet deadlines. Fabricators put pressure on the guys doing the shop drawings. And the guys doing the drawings are forced to come up with solutions……..but there’s a problem. The vast majority of the information required to make good and accurate shop drawings are missing. It’s just not there. You can ask for RFI answers but sometimes they’re just not forthcoming from the builders or the engineers or the architects. So what do you do?

    The client is demanding drawings.

    “Send me the unapproved drawings,” he says.

    When people say things like that: watch out! If the project goes well, then they take all the profits. But if it goes wrong, then you not only do not receive your fees, but you are forced to also wear the fabricator’s loss. It’s a lose-lose situation for you and a win-win situation for the fabricator.

    So you’ve got to make a decision: (I) either hold back the release of drawings till you have better information clarity, or (II) you release it making it explicitly clear that any risk is taken up by the fabricator if they build on drawings that weren’t issued for construction. Because at the end of the day, you don’t want to be carrying the can for someone else’s cock up.

    Ignore this advice at your peril.

    (b) Watch out for clients who offer to pay in cash

    In this day and age, especially with the sums involved, you gotta be extremely weary of clients who offer to pay in cash.

    Why would someone do that? Isn’t it much easier to make a bank transfer? Yes, but the reason why people deal in cash is probably to avoid paying tax, or even worse, it’s because the money is black. You don’t want to be involved in any activity like that. So the next time someone offers to pay you $15k in cash, thank him/her for the offer and politely tell him that such an arrangement will not do.

    If they insist on awarding you the work then quote a high price – really high. Change the economics of the situation such that it’s just easier to do everything legitimately.  And if a cash paying client insists on coming on board – without a good reason why they want to pay in cash – especially without bargaining – then you really have to really watch out: they probably have no intention of paying; so ask them to pay up front.

    As a general rule, you don’t want to get involved with clients who offer large sums of cash. I can’t think of a good reason for somebody walking around with $15 k in their pockets.

    (c) Quote High

    As a general rule, quote high. If the quality of your work is good then you’ll stay in business.

    We use genuine licenses. And they cost a fortune. So our rates reflect the need to recoup the license cost. But inevitably, someone will want us to lower our quote to the level of operators who don’t have licenses.

    We can’t compete with them. We can’t match their quotes. And we don’t even bother trying. As a general rule, these clients bargain for super low rates, and then find every excuse not to pay. Think about it: is it worthy putting your house on the line to pay for licenses and to then work for someone who doesn’t pay – or pays “if and when he gets paid”?

    No friends, charge high, and deliver good quality work. If your work is good, trust me, you’ll have more work then you can handle. When you’re in that situation, pick and choose the projects that will bolster your reputation, that will book your fast profits, and that will be of enormous benefit to your existing clients – and let other operators fall into projects which are poorly funded, planned and managed.