August 22, 2018

Comparing AutoCAD Drawings with Forge Design Automation -2

AutoCAD Drawing Compare

A sample workflow of application

This post is a continuation to my earlier post

This sample uses AWS S3 storage to host client files and initiates forge design automation to compare two AutoCAD drawings, results the output drawing back to client, the output drawing contains visual graphical difference.

Set up AWS S3 , the uploaded files are public readable, look at the 'acl' object.

const uploadToAws = multer({
    storage: multerS3({
        s3: s3,
        acl: 'public-read',
        bucket: config.credentials.aws_bucketname,
        key: function (req, file, cb) {
            cb(null, file.originalname); //use for unique file keys


Processing upload files to S3.'/upload', uploadToAws.array('upl1', 2), (req, res, next) => {
        res.on('finish', () => {
        console.log('response sent');
    if (typeof req.files !== 'undefined' && req.files.length > 0) {
        dwgFiles.dwg1 = req.files[0].location;
        dwgFiles.dwg2 = req.files[1].location;        

Once the files are uploaded to S3, pass them on to Forge Design Automation'/creatWorkItem',function(req,res){
        .then(function (credentials) {
            submitWorkItem(dwgFiles, oAuth2TwoLegged, credentials)
            .then(function (workItemResp){
                console.log("*** workitem post response:", workItemResp.body);
                var workItemId = workItemResp.body.Id;
                res.json({ success: true, message: 'Submitted WorkItem Successfully!', workItemId: workItemId });
            .catch(function (error){
                res.json({ success: false, message: 'Submitted WorkItem Failed!' });
                res.status (500).end () ;
            res.status(500).end() ;

Full sample is available on github and see live demo 

Related Posts

April 18, 2019

Learn about the Forge Design Automation API for Inventor

Are you a developer working with the Inventor API, or building Inventor apps? Come join us on Tuesday, May 7, at 8:00 am Pacific to learn how to apply the

Read More

April 1, 2019

Publicly share models in customized Viewer

When on any of the Autodesk Storage solutions (A360, Fusion Team, etc) then you have the option to share your models publ

Read More