Design Review API and embedding in .net c# winform for automating local workflow

Design Review API and embedding in .net c# winform for automating local workflow

joseguiaCES
Participant Participant
771 Views
3 Replies
Message 1 of 4

Design Review API and embedding in .net c# winform for automating local workflow

joseguiaCES
Participant
Participant

This post is twofold: first, to share what I found (or rather, didn’t find) and second, for my future reference in case I need to recall how I did any of this.

I understand the migration to cloud-based solutions, but I don’t believe the cloud works for the type of workflow we need, or are currently using. There are too many factors as to why, and too many to list here. So, having said that…

With what seems to be the slow and silent death of ADR, there is little to no information out there on how to automate a DWFx workflow using the API for local use, file storage, etc. I spent way more time on this than I should have. But I did finally get something working that I can use at our firm in an automated process. How long this will work really depends on how long Autodesk allows the existing API calls to remain functional.

The Project

I created a WinForms app that can query our data systems, pull job info, and DWFx files generated from the latest releases of AutoCAD. The app lists open jobs that need processing. The designer can click the list, load the DWFx into the viewer, mark it up, and save it. The app then notifies another designer of the markups. The DWFx is loaded into the original DWG with the markup information ‘overlayed’ (or underlaid?) and the designer can use the markup palette in AutoCAD to process them. The process can be repeated or sent out. It’s fairly straightforward and, from my understanding, is exactly what the DWFx and ADR process was supposed to be.

The How

I tried everything I could—every blog, every hack, trick, and old blog post I could find. At one point, I even ended up on a shady Chinese site with what looked like an API reference PDF and some C# sample code. But no luck—just a handful of viruses and a new meme coin. Nothing worked on my state-of-the-art, bad-ass Dell with Visual Studio 2022, all the updates and patches, AutoCAD 2025, ADR 18 (or 24?). I even tried good ol' ChatGPT, Rufus, Dufus, Copilot—name it.

What I ended up doing was setting up a new 32-bit environment:

Test App:

  • I started a new WinForms C# desktop app using all the defaults (defaults to .NET Framework 4.5).
  • I used the trick you see everywhere: right-click your toolbox and choose "Add Items": C:\Program Files\Common Files\Autodesk Shared\DWF Common\AdView.dll

I was then able to drag the control onto the WinForm and wire things up for testing.

You may still encounter a crash if you click the control and mess with properties or the solution explorer, but I read somewhere that closing them out makes it a little more stable. That trick does work—of course, your mileage may vary.

I also changed the build to x86 from “Any CPU,” compiled it, copied it to my main PC, and boom, it all worked. Yay!

For completeness, I’m including the sample source code I used in my test app. It has a couple of buttons, a DataGridView, and the DWF control. Straightforward.

 

 

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PeekABoo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (dgvFiles.SelectedRows.Count > 0)
            {
                string filePath = dgvFiles.SelectedRows[0].Cells["FilePath"].Value.ToString();
                axCExpressViewerControl1.SourcePath = filePath;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            LoadDwfFiles();
        }

        private void LoadDwfFiles()
        {
            string folderPath = @"C:\Temp\dwfs"; // Change this path to where your DWF files are stored
            if (!Directory.Exists(folderPath)) return;

            var files = Directory.GetFiles(folderPath, "*.dwf")
                .Select(f => new { FileName = Path.GetFileName(f), FilePath = f })
                .ToList();

            dgvFiles.DataSource = files;
            dgvFiles.Columns["FilePath"].Visible = false; // Hide full path column
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.axCExpressViewerControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
        }
    }
}

 

 

 

0 Likes
772 Views
3 Replies
Replies (3)
Message 2 of 4

esimers
Enthusiast
Enthusiast

OMG.  This is what I think I am wanting.  I wanted to embed Design Viewer in a webapp.  Hook it to our vault to get dwfs that are already created on state change anyways.  Let the average shop floor workers markup this dwf push a button to envoke an automatic ECO creation,(which I finally do have).  And same time attach the markedup dwf.  I can make my auto ECO attach files now, that was a nightmare.  We are manufacturing based and we use more Inventor stuff, but we also use Autocad, among other things for different units.  

 

The eco workflow takes over for engineers/designers.  Revise, publish, repeat...  Why is this so hard to figure out.  Granted I'm not a Dev by trade, but I'm learning and I have almost 30years exp in CAD softwares, so I'm not exactly unfamiliar with how stuff generally works, and I'm also just an IT junkie by nature.

LOL, AI coders are stupid with Autodesk SDKs, I even pay for gemini and tried to create a trained bot, but never could get it to work.

why did you end up using 2013? Is this because Design Review is only 32bit? I am going to copy your code and see if I can modify it for our use case.  Do you have a github?  Anyways I'm off to test all this out now.  Thanks have a super awesome day!!

 

 

 

Message 3 of 4

joseguia
Contributor
Contributor

Esimers, 

 Howdy, I ended up using 2013 because of the COM integration I believe, I think 2015 wasn't fully able to load, cant recall exactly now. However I did manage to get 2015 VS Community working. I do have a github, however have not uploaded this test app to it. The majority of my git stuff is work related, so marked as private. I think I have a rewrite of Linq to Acad in there marked as public.

The latest ChatGPT 4.5 and 4.0 handle Autodesk SDK's a lot better, at least in my experience. If you haven't tried them out I'd give them a spin. Let me know if I can help in any way. I do intend to take a spin with integrating the web viewer, at some point. Just not quite yet. My goal is to provide an all local, closed loop solution, meaning no internet connection required. Our work often involves locales with spotty connections, so that's the challenge.

0 Likes
Message 4 of 4

esimers
Enthusiast
Enthusiast

We have tons of plugins/addins made in 2022 VS.  And I can test/debug within Visual Studio Pro.  

I however cannot use VScode because of some excel interop.  

Is there a plugin of Visual Studio Pro for GPT4.5? I only see 4.0 currently.  But I also don't have a paid sub to copilot.

I managed to muttle my way through the first part of using the APS.  I have a test viewer, now I somehow have to activate the markup saving then somehow integrate Vault...

I'm such a newb to coding, I'm very overwhelmed and possibly dangerous.  Tell me why Autodesk, doesn't have a full workflow for any process.  Like we can make drawings, save them made pdfs, but how do we not have a built in return data flow....and if I hear someone mention Fusion Manage I'm gonna loose my mind.  Why do we have to piece meal this together, Vault should do this period.

 

 

 

0 Likes