0

I am currently triying to use an Inventor Automation to modify a drawing and then export it to the SVF Format for the Viewer. Therefore I used this sample project from an Autodesk developer:

https://github.com/akenson/da-extract-params

I tried the code for exporting a 3D Drawing as SVF and that works fine. But when I tried to export a 2D drawing (like a DWG) to SVF, the SVF Addin doesn't create a file.

The Problem appears in the Method CreateForgeViewable() in the SampleAutomation Class in the ExtractParamsPlugin Projekt. I think the problem could be the configuration of the options for the Addin... But I couldn't find a Documentation for the SVF Addin.

// Setup SVF options
if (oAddin.get_HasSaveCopyAsOptions(doc, oContext, oOptions))
    {
        oOptions.set_Value("GeometryType", 1);
        oOptions.set_Value("EnableExpressTranslation", true);
        oOptions.set_Value("SVFFileOutputDir", sessionDir);
        oOptions.set_Value("ExportFileProperties", false);
        oOptions.set_Value("ObfuscateLabels", true);
    }

Is there any parameter, that I should set for exporting a DWG to a SVF? Or is there somewhere a documentation for this Plugin?

I would be really thankfull for a reply.

Best regards

Sebastian

  • we only support SVF for 3D from Design Automation of Inventor (DA4I). If you want SVF for 2D DWG you can either go through Model Derivatives, or output to PDF by DA4I and use it in Forge Viewer (by pdf.js), or output DWG from DA4I and then go to Design Automation of AutoCAD (DA4A) to export. – Xiaodong Liang Feb 11 '20 at 09:20
  • Thanks for you reply. Then I think I'll solve my problem by creating an PDF and showing it in the viewer. – Sebastian König Feb 12 '20 at 10:13
  • Hi Sebastian, to make a higher search in the future if any other customers are also interested in, I posted my reply as an answer. could you accept it as an answer when you have time? Thank you! – Xiaodong Liang Feb 20 '20 at 01:39

2 Answers2

1

Currently, we only support SVF for 3D from Design Automation of Inventor (DA4I). If you want SVF for 2D DWG you can either go through Model Derivatives, or output to PDF by DA4I and use it in Forge Viewer (by pdf.js), or output DWG from DA4I and then go to Design Automation of AutoCAD (DA4A) to export.

Xiaodong Liang
  • 2,051
  • 2
  • 9
  • 14
0

Here is sample how you can use your Bundle to export IDW to PDF

    TranslatorAddIn PDFAddIn = (TranslatorAddIn)_inventorApplication.ApplicationAddIns.ItemById["{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}"];

    if (PDFAddIn != null)
    {
        TranslationContext context = _inventorApplication.TransientObjects.CreateTranslationContext();
        NameValueMap options = _inventorApplication.TransientObjects.CreateNameValueMap();
        if (PDFAddIn.HasSaveCopyAsOptions[doc, context, options])
        {
            context.Type = IOMechanismEnum.kFileBrowseIOMechanism;
            DataMedium dataMedium = _inventorApplication.TransientObjects.CreateDataMedium();
            options.Value["Sheet_Range"] = PrintRangeEnum.kPrintAllSheets;
            options.Value["Vector_Resolution"] = 300;
            options.Value["All_Color_AS_Black"] = false;
            options.Value["Sheets"] = GetSheetOptions(doc);

            dataMedium.FileName = exportFileName;
            PDFAddIn.SaveCopyAs(doc, context, options, dataMedium);
        }
    }

and then use PDF with Forge Viewer

viewer.loadExtension('Autodesk.PDF');
viewer.loadModel( [pdfUrl], { page: 1 }); // load page 1 by default