ASP.NET 2.0 Resources

Powered by Blogger

Troubles using Autodesk DFW viewer ActiveX 3D API

In past few days I was looking for a solution how to display and control 3D DWF files using Autodesk DWF viewer 6.5. I have faced so many problems and also found some solutins that I've decided to share with You. But first some background about DWF viewer for those who haven't seen it before.

Autodesk® DWF™ Viewer allows you to easily view and print 2D and 3D designs in the DWF format, the ideal way to accurately share design information with team members. DWF viewer is available for free download from Autodesk website. It allows you to...

  • Access data integral to engineering and architectural design review including drawing scale, precise design coordinates, sheet set details, and object and markup properties.
  • Easily view and navigate drawings, maps, and 3D models without the software that created them.
  • View and print engineering and architectural files accurately with the same rendering engine as AutoCAD® software.
Many Autodesk products support saving to DWF format: AutoCAD® 2006, Autodesk® Architectural Desktop 2006, Autodesk® Building Systems 2006, Autodesk® Civil 3D® 2006, Autodesk Inventor® 9 and 10, Autodesk® Land Desktop 2006, Autodesk® Mechanical Desktop® 2006, Autodesk® Revit® Building 8, Autodesk® Revit® Structure, Autodesk® VIZ 2006, Autodesk® 3ds Max® 8.

DWF viewer is also available as ActiveX plugin for Microsoft Internet Explorer. The plugin supports API interface, so you can control opened DWF file programmatically. This API documentation is far from complete, but lets start from the beginning. Integrating DWF viewer with your website is quite easy...

<object id="ADViewer" classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF"
 border="1" width="640" height="480">
    <param name="src" value="Engine.dwf">
    <param name="ToolbarVisible" value="False">
    <param name="UserInterfaceEnabled" value="False">

There are a few parameters that are worth mentioning. I was integrating DWF viewer with the following assumptions:

  • Hide all user control interfaces (the viewer will be controled from outside using javascript)
  • Establish two way communication channel between viewer and web application
So what those parameters mean. ToolbarVisible set to False hides user toolbar (on top of viewer), UserInterfaceEnabled parameter controls right mouse click context menu and src attribute points out to DWF file being visualized.

Autodesk DWF Viewer 6.5 contains new feature bottom navigation bar. This bar visibility cannot be controlled with object tag parameter, but luckily there is other way. This navbar can be disabled just after DWF document is loaded in viewer with following javascript code.

<script type="text/javascript" for="ADViewer"
    if (bstrItemName == "DOCUMENT")
        ADViewer.ExecuteCommandEx("NAVBAR", false);

The code listens for DOCUMENT OnLoad event for ADViewer object and sends NAVBAR disable command to it. This is not documented in official API and may change in feature releases of Autodesk DWF viewer. So are the following commands that we will use. The whole 3D API is not yet officially supported.

<script type="text/javascript">
function fitToWindow() {
function setView() {
function selectPart()    
    ADViewer.ExecuteCommandEx("INVERTSELECTION", 0);
    ADViewer.ExecuteCommandEx("HIDE", 0);
function showAll()    
    ADViewer.ExecuteCommandEx("SHOWALL", 0);

fitToWindow function is quite easy, it fits current object to occupate whole window. The setView functions sets standard camera view (Front Top Left) and showAll function shows all objects.

The last function selectPart is where i failed to find a solution. This function should select object by it's id or anything, hide all other objects and fit the selected object to whole window. I was able to programmatically hide other object when the object was already selected with mouse, I was able to fit the selected part to whole window. But there is no way to select single object (part) from javascript. There was rudimentary 3D API support in older Autodesk DWF viewer 6.0, but it has changed and I didn't find any usable API function in viewer 6.5.

I have spent almost all day diging into all ActiveX interfaces, searching over the internet with no luck. I didn't find solution for such simple task as selecting part from my javascript code (neither in official API /which does not exist for 3D files/ nor on the internet). There is a lot of discussin about lacking 3D support on Autodesk support forums, but without solutions. They always suggest to wait for feature version that might have 3D API support, but those discussions are dated from the year of 2003.


  • Did u get the solution?
    Im also need the same.

    Can u assist me?

    Thanks in adv.


    By Blogger Saaral Prian, at 11:21 AM  

  • Hi,
    Awsome blog.

    We are stuck with a similar issue. We need to open a dwf file in from an original dwg file which is on the server. Then put some markups to the same.
    We then need to save the dwf file back to the server as dwg file.
    Now some one else should also be able to open this dwf in asp.ent page review the markups, edit/delete the markups and save the dwf whic should inturn save the original dwg on the server.

    Is this possible if yes then how can we achieve this.

    By Blogger Rajesh Excelencia, at 7:18 AM  

  • what is tme mime type for .dwg in iis6. i used the same code i get 404 file not found error

    By Blogger prabahar, at 5:11 AM  

  • Hi,

    I am stuck at this point

    'object id="ADViewer" classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" border="1" width="100%" height="100%" VIEWASTEXT
    param name="ToolbarVisible" value="True"

    using the above, i can view the dwf file first time with toolbars(Home,MarkUp, Resoureces). But when i open it again that toolbar option is no more, i couldn't see that. I need to fix it,because without that couln't do any editing on dwf file. Please Help me out.


    By Blogger nobody, at 11:10 AM  

  • bila anda ingin cari tempat Jual mesin bordir komputer bekas murah di Surabaya mungkin kalian dapat berkunjung tempat kami. Kami memiliki mesin bordir komputer bekas dengan kualitas yang bagus dan kondisi yang baik. Mesin bordir bekas di tempat kami jual juga sudah memakai sistem komputer yang modern dan juga mempunyai kecepatan untuk proses jahit yang cepat. Mesin bordir bekas yang kami tawarkan selain memiliki kualitas mesin yang bagus tetapi juga mempunyai hasil bordir yang bagus juga
    Tempat menjual mesin bordir komputer bekas di tempat kami selain mempunyai kualitas yang bagus tetapi kami juga memiliki mesin bordir dengan harga yang cukup terjangkau. Kami mempunyai harga mesin bordir yang berbeda-beda yang dapat di sesuaikan dengan keinginan anda. Harga yang kami tawarkan juga dapat anda tanyakan langsung kepada kami.
    Tempat Jual mesin bordir komputer bekas di tempat kami juga mempunyai berbagai macam jenis merek mesin bordir terkenal dengan kualitas yang baik. Kami mempunyai merek mesin bordir komputer bekas seperti yaitu lung xiang , Fu hao, Feiya, Dahao, Xiong. Tidak hanya mempunyai kualitas yang baik, Semua jenis mesin bordir tersebut juga mempunyai harga yang berbeda-beda sesuai dengan keinginan anda.
    Tempat Jual mesin bordir komputer bekas di Surabaya pada tempat kami mempunyai 2 jenis mesin bordir komputer yaitu mesin bordir komputer jenis 6 kepala dan juga jenis 12 kepada yang bisa di sesuaikan dengan keinginan anda. jenis mesin bordir komputer di tempat kami memiliki kualitas yang sama baiknya dan juga masih mempunyai kondisi yang bagus. Anda bisa melihat langsung kondisi alat bordir bekas yang kami sediakan ke tempat milik kami yang terletak di daerah surabaya.
    Harga mesin bordir komputer bekas di Surabaya

    By Blogger Aneka Buku Yasin Berkualitas, at 3:45 AM  

    Thanks for sharing!

    By Blogger CGI Flythrough, at 11:47 AM  

Post a Comment

<< Home

Created dolly