Comparing AutoCAD Drawings with Forge Design Automation -2

August 22, 2018
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 

Posts by author

Madhukar Moogala

A technology agnostic, constant learner, and a Forge advocate who works primarily on AutoCAD and Forge Design Automation using both desktop and cloud programming techniques. He has been with Autode