Kean Walmsley

July 2009

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Twitter Updates

    follow me on Twitter



    « Adding custom properties to AutoCAD's rollover tooltip and its quick properties panel | Main | Adding a custom tab to AutoCAD's options dialog using .NET - Part 2 »

    November 19, 2008

    TrackBack

    TrackBack URL for this entry:
    http://www.typepad.com/services/trackback/6a00d83452464869e2010535fb57a9970c

    Listed below are links to weblogs that reference Adding a custom tab to AutoCAD's options dialog using .NET - Part 1:

    Comments

    Hi Kean,

    For this posting, would you be willing to post the entire solution? I am having difficulties understanding the various source files that are involved and how everything ties together.

    Ron

    Hi Ron,

    Certainly - the link is in the post, but here it is again.

    Regards,

    Kean

    Hi Kean,

    I was wondering about testing of AutoCAD plug-ins in general. How do you write unit tests if you depend on the AutoCAD API which doesn't run independently of AutoCAD? In general, what's your recommended strategy for testing a plug-in?

    Thanks.

    Hi Kean,

    I've just started Autocad automation with C# and I've got a question. Is there a way to get the max X, minX, max Y and min Y values of all entities within a drawing?

    Imagine I have a drawing with some entities like arcs, lines or even polylines. I'd like to know what are those values so I could draw a rectangle to fit all entities within it. Did you get it?

    Tks

    Kean,
    Thanks for keeping up the interesting posts.
    Regards
    kwb

    @Tks,

    You can use the property GeometricExtents of an entity. If you have a list of entities, you can easily loop through them to figure out the bounding box. Here is an example in F#.

    Hi Nada,

    Thanks for responding to Filipe's question.

    We (meaning Autodesk) use various methods to test our software, but for unit testing we have a large set of scripts that exercise the various APIs. These have to run within AutoCAD, of course.

    Having some kind of test suite for your own internal methods would seem a logical way to approach this, from my perspective.

    I'd be interested to hear how others approach this.

    Kean

    Thanks a lot guys! And Kean, you're doing such a great job over here.
    Thanks again.

    Hi, when are providing an article on status bar i.e trayitem on pene custom icons. I haveen trying the following code without sucess. The icon gets loaded but disappears after working with cad eg aftaer minimizing the drawing.

    attached code..
    Imports Autodesk.AutoCAD.ApplicationServices
    Imports Autodesk.AutoCAD.Runtime
    Public Class Class1
    Implements Autodesk.AutoCAD.Runtime.IExtensionApplication
    Overridable Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize
    AddTrayItems()
    End Sub

    Function GetEmbeddedIcon(ByVal strName As String) As Drawing.Icon
    Return New Drawing.Icon(System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(strName))
    End Function

    Sub AddTrayItems()
    Try
    Dim doc As Document = Application.DocumentManager.MdiActiveDocument
    Dim ti As New TrayItem()
    ti.ToolTipText = "MyCadAddon Info"
    ti.Icon = GetEmbeddedIcon("MyCadAddon.blue.ico")
    Application.StatusBar.TrayItems.Add(ti)
    Dim bw As New TrayItemBubbleWindow()
    bw.Title = "MyCadAddon Application:"
    'bw.HyperText = ""
    ' bw.HyperLink = ""
    bw.Text = "This application has been loaded sucessfully"
    bw.IconType = IconType.Information
    ti.ShowBubbleWindow(bw)
    Catch

    End Try

    End Sub


    Overridable Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate

    End Sub

    End Class

    Sorry - I don't have time to look into this. Perhaps someone on the AutoCAD .NET Discussion Group can help (or the ADN team, if you're a member).

    It looks as though you adapted the technique from this previous post. I assume you're not also implementing the Closed event handler, which removes the icon in that example?

    Kean

    About the unit testing:

    A tool exists, Gallio that (among many other features) runs MbUnit tests in the AutoCAD context.
    I have not yet had the time to look into it, but it seems interesting. The documentation on AutoCAD integration is scarce though, so trying it out is the only way to go right now.

    Another option, from my point of view, 'Contracting' all your functionality. This means writing interfaces for the self-written functionality, and mocking it in the unit tests.

    This way you don't need to use the acad dll's, but it does create a LOT of overhead for your code. It means proxying all acad-functionality you need, again in your own code.

    If anyone has any other options (or links), please share...

    Verify your Comment

    Previewing your Comment

    This is only a preview. Your comment has not yet been posted.

    Working...
    Your comment could not be posted. Error type:
    Your comment has been posted. Post another comment

    The letters and numbers you entered did not match the image. Please try again.

    As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

    Having trouble reading this image? View an alternate.

    Working...

    Post a comment

    Feed & Share

    Search