Author: admin

  • What are curve parameters? (AutoCAD .net API)

    A perusal of the .net Reference Guide reveals these types of functions:

    This is a snapshot of the .net API Reference guide.
    This is a snapshot of the .net API Reference guide.

     

    But as per usual, there is no explanation in the documentation as to what a exactly a parameter is. This is best explained by example. Stay with me here:

    • Suppose you have a curve (i.e. a polyline) that has n points. Or in this case, 10 points.
    • If you called `polyline.GetStartParam()` you’d get a value of 0. And if you called: `polyline.GetEndParam()` you’d get a value of 9. You’ve got 10 points of course, but remember,  you’d get a value of 9 because it’s all zero index based.

    Some Notable Exceptions:

    • Now you have to remember that Ellipses and Circles are also curves too. If you asked an arc or a circle a question about its parameter, then you are really asking it about the angle around the circle or arc (starting from 0). E.g. circle.GetPointAtParameter(0) should give you (100,0,0) and circle. GetPointAtParameter (2π) should give you (100,0,0).
    • Suppose you want to calculate the halfway distance between vertex 0 and vertex 1 for a polyline? Should you use polyline.GetPointAtParam(0.5)? The answer is: no! This is because the mapping between parameters and points need not be linear. To be safe you should use: getDistAtParam() to get the distances d0 and d1 and you should then use getPointAtDist( (d0 + d1) / 2 ).

  • BREP API – A Very Basic Primer (AutoCAD .net API)

    A very nice mesh surface of a face.
    A very nice mesh surface of a face.

     

    The boffins at AutoDesk have ported that which has existed in the ObjectARX API into .net – it’s basically a wrapper. And on a side-note – it is well worth reading the ObjectARX documentation for that very reason – let’s face it – the documentation for AutoCAD APIs are not very good. So definitely read the ObjectARX API.

    Here are some very useful resources that you will need in order to fully utilise this API:

    What is the BRep API all about?

    • Think of Breps as a novel way of representing shapes in a hierarchical way. This won’t make much sense to you – but consider the example below: re: traversal of this hierarchy.

    What is it useful for?

    Brep API is useful for: (i) traversing a hierarchy of shapes, (ii) Point Containment calculations and (iii) Meshing.

    (A) Traversing a hierarchy of shapes.

    Ok. When you think of a cube for example, you have a 3d object:

    • Cube (the cube can also be thought of as a shell – a set of connected faces).That cube is made up of 6 faces, all of which are squares.
      • Those faces are made up of 4 edges each.
        • Those edges are bade up of 2 vertexes bounded by a curve.

    All 3d objects can be broken down somewhat into a hierarchy of simpler objects. The BREP API allows you to traverse that hierarchy and make queries according to your particular requirements/needs/application.

    (B) Containment calculations

    Let’s suppose you have a sphere and you want to determine whether a point lies within the sphere or outside of it. You could use the Brep API to make this determination.

    (C) Drawing meshes to represent surfaces

    You could use the API to create meshes which can approximate a 3d surface or object.

  • Getting Started In AutoCAD .net Development

    Wanna be startin' something?
    Wanna be startin’ something?

    Simply check out the following links:

    • My first plug in training:

    http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=18162797

     

    • Download the .net Wizards, and the other resources on the AutoDesk website.
    • Download Visual Studio https://www.visualstudio.com/vs/community/

    Handy resources:

    https://www.theswamp.org/index.php?topic=32381.0

     

    • Popular blog:

    http://through-the-interface.typepad.com/

     

    • Documentation:

    http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA

    http://help.autodesk.com/view/OARX/2018/ENU/

    Our own blog – with code snippets and case studies:

    https://www.tek1.com.au/category/autocaddotnetapi
  • How To Make Alternate Dimension Units Appear Below the Primary Units (AutoCAD .net API)

    Showing many different dimension styles.
    Showing many different dimension styles.

    This was a question which someone asked.

    I accordingly answered it with a code example. The answer is simple:

    Ensure that you add `“\X”` as a suffix to the `DimStyleTableRecord.Dimpost` property.

    Here is a code example:

  • What is the difference between Freezing a layer vs Turning it off? (AutoCAD tips)

    Freezing improves performance. That's the difference.
    Freezing improves performance. That’s the difference.

    A tyro to AutoCAD will immediately notice that he or she has two options available to him – both of which ostensibly render similar results: freezing a layer and turning it off. But what is the real difference?

    • When you turn a layer off, it is still loaded into memory. AutoCAD is keeping track of it.
    • When you freeze a layer, then AutoCAD basically ignores that layer and everything on it. You should notice a slight increase in speed and performance when you freeze layers – especially if they contain hundreds of thousands of elements. That will give you a significant performance boost cf: if you simply turned that layer off.

    That’s the difference and I hope you learned something.

  • Identifying Duplicate Panel Names (+Video Demo)

    How are you going to identify one duplicate in a sea where everything looks the same?
    How are you going to identify one duplicate in a sea where everything looks the same?

    Duplicates are a problem – an expensive problem, especially if you are dealing with hundreds and perhaps even over a thousand panels. Somebody cocks up – usually on the client side – but how are you meant to identify it?

    You could manually do it, but then that will more than likely take a long time. Or you could just employ Tek1 to do that sort of thing for you. Here is a video demonstration:

    Identify Duplicate Panel Names In Precast Panel Detailing from Tek1 on Vimeo.

    Features:

    • It can work for all clients with only very minor modifications. Very well abstracted out in the code.
    • It is super fast. Comparing the thousands of elements in each drawing takes a bit of computing power – but with smart algorithms, you can cut down the time.
    • It can work in the marking plan and elevation or layout. The same code, the same command, but x3 the power.

     

    Example of Well Abstracted Code:

     

  • How to Save Views in AutoCAD (AutoCAD tips)

     

    Demonstrates how to save a view in AutoCAD - please watch this gif carefully. It's pretty self explanatory.
    Demonstrates how to save a view in AutoCAD – please watch this gif carefully. It’s pretty self explanatory.

    It can get pretty annoying zooming and moving back and forth between a panel and another panel. You can eliminate a lot of the panning involved by saving a “View”.

    1. Open the View Manager (e.g. type in “View” in the command line and press ENTER, or you can see another way of doing this in the gif image above.)
    2. Create a new View.
    3. Refer to it when required.
    4. AutoCAD will now automatically take you to what you want to se.

    The gif above will show you all.

    I hope you learned something!

  • Speed Up Working in DWG files with Partial Open

     

    Showing how to open limited geometries using partial open.
    Showing how to open limited geometries using partial open.

    Suppose your .dwg file has hundreds of thousands of entities all over the place – but you don’t want to see all of them at once – or load all of their geometries. This is especially the case when dealing with Bubble Deck layouts. You can only open the things that you need via a partial open. You can now choose and view only the stuff that you want to see. It’s quicker than otherwise.

     

     

     

     

     

     

     

  • Comparing Panels Demo – This Time from the Shop Drawing to the Elevation!

    Showing a sample elevation panel with deliberately misplaced panel elements.
    Showing a sample elevation panel with deliberately misplaced panel elements.

    This is big. Huuuuge! I’ve talked before about our ability to easily cross check between the Layout and Shop drawings. Now you can cross check from the other direction – when you are in the shop drawing, you can now check the corresponding panel which exists in the layout.

    You can clearly see any differences.

    So now if someone moves a ferrule or a cast in plate etc. you will be able to easily see those changes.

    It could save you from some expensive errors.
    Here is the demo. I hope you enjoy it!

    Compare and Import Difference From the Layout Into Shop Drawings from Tek1 on Vimeo.

    Features:

    • It can work for all clients with only very minor modifications. Very well abstracted out in the code.
    • It is super fast. Comparing the thousands of elements in each drawing takes a bit of computing power – but with smart algorithms, you can cut down the time.
    • It works for all sorts of edge cases – what if the panel was made up of arcs, polylines and straight lines – this plugin can handle all sorts of things. It can also handle voids.