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



    « "AutoCAD: 10 easy ways to crash your AutoCAD addin" webcast recording available for download | Main | AU Handouts: Enriching Your DWF™ - Part 2 »

    October 26, 2007

    TrackBack

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

    Listed below are links to weblogs that reference AU Handouts: Enriching Your DWF™ - Part 1:

    Comments

    Thanks for this article. This was terrific. This is useful information in an easy to understand style.

    Thanks, Scott! Part 2 should be posted early next week...

    Kean

    You've been kicked (a good thing) - Trackback from CadKicks.com
    http://www.cadkicks.com/adkautocad/Enriching_Your_DWF_Part_1

    Hi Kean,

    I've got a small problem with this code. It's working fine on native AutoCAD objects, but I can't get it to extract any data from custom ARX objects based on AcadEntity. Can you kick me in the right direction please?

    Thanks,
    Piotr

    Hi Piotr,

    This code is set up to work specifically with Solid3d objects, although it's very easy to change it to handle any type of entity. I don't know what modifications you've tried, but this os the line to change:

    Solid3d solid = e.Entity as Solid3d;

    Regards,

    Kean

    Kean,

    Is there anyway to change the name of the the object - "Solid(3D)" name in the Model view dialog of the DWF Viewer in dot net? This solid object represents something like a part. I would like to name it "Part" when I pick on the solid.

    Robert

    Hi Robert,

    There isn't a way (that I know of) to customize the display of standard metadata (whether property name or value). You could modify the contents of the DWF file using the DWF Toolkit, but this could potentially lead to unpredictable behaviour, should an application depend on standard properties being there.

    If you're using AutoCAD to generate your DWF, I'd recommend using the API hooks (from .NET or ObjectARX) to add additional metadata reflecting the information you want to include.

    Regards,

    Kean

    Kean,

    I'm having problems with the code above crashing AutoCAD 2009 when I try to plot anything else (like a PDF). All you have to do is load the code above and then try to plot anything else. It crashes AutoCAD 2009. Any ideas?

    Thanks,

    Robert

    Robert,

    I just tested the code in 2009 and it appears to work fine. If you can give me more explicit instructions on how to reproduce the problem, I'll take another look.

    Regards,

    Kean

    Kean,

    First off - thanks!

    This problem happens with 2008 & 2009 across 3 different machines - AutoCAD 2008 & 2009 with ObjectARX 2008 & 2009.

    We created a simple project with just the code above (cut & paste) - nothing else. It works great with 3DDWF and the PUBLISH command. If I execute the PLOT command and plot to a PDF with this code loaded via NETLOAD, it crashes (even during the preview). It crashes before it enters the code above - therefore I cannot debug it.

    Thanks again,

    Robert

    Robert,

    I finally managed to reproduce the problem: it seems that if I call PUBLISH before PLOT, the problem doesn't appear - you have to call PLOT on its own to see the crash.

    The code shouldn't have any impact on PLOT - only PUBLISH - so I don't fully understand why there's a problem. One suggestion is to add/remove the event handlers on CommandWillStart/CommandEnded.

    Here are updated Initialize/Terminate functions I threw together quickly:

    public void Initialize()
    {
    Document doc =
    Application.DocumentManager.MdiActiveDocument;
    doc.CommandWillStart += delegate(object sender, CommandEventArgs e)
    {
    if (e.GlobalCommandName == "PUBLISH")
    {
    // Register for publishing events

    Publisher pb = Application.Publisher;
    pb.AboutToBeginPublishing +=
    new AboutToBeginPublishingEventHandler(
    OnAboutToBeginPublishing
    );
    pb.BeginEntity +=
    new BeginEntityEventHandler(
    OnBeginEntity
    );
    pb.BeginSheet +=
    new BeginSheetEventHandler(
    OnBeginSheet
    );
    }
    };

    doc.CommandEnded += new CommandEventHandler(doc_CommandEnded);
    doc.CommandFailed += new CommandEventHandler(doc_CommandEnded);
    doc.CommandCancelled += new CommandEventHandler(doc_CommandEnded);
    }

    void doc_CommandEnded(object sender, CommandEventArgs e)
    {
    if (e.GlobalCommandName == "PUBLISH")
    {
    // Unregister from publishing events

    Publisher pb = Application.Publisher;
    pb.AboutToBeginPublishing -=
    new AboutToBeginPublishingEventHandler(
    OnAboutToBeginPublishing
    );
    pb.BeginEntity -=
    new BeginEntityEventHandler(
    OnBeginEntity
    );
    pb.BeginSheet -=
    new BeginSheetEventHandler(
    OnBeginSheet
    );
    }
    }


    public void Terminate()
    {
    }

    Kean

    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