Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Saving an IDW as a DWG

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
400 Views, 4 Replies

Saving an IDW as a DWG

I need to save all of my IDW files to DWG format for my customers. When I do this I loose the colors and blocks. Does anyone have a plug in or macro that would fix this problem?

4 REPLIES 4
Message 2 of 5
YuhanZhang
in reply to: Anonymous

Can you explain more about the problem? Do you save the IDW to Inventor DWG or AutoCAD DWG? And can you provide a data sample to reproduce the color&block missing issue?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 5
Anonymous
in reply to: YuhanZhang

I need to save the files to an Autocad 2010 format. I need the files to maintain color and create blocks so the files can be worked with by my customers. When I save the IDW files to and Autocad file they are all white in color and the blocks are limited to geometry and title block. With the large assemblies I need the files to be more functional.

Message 4 of 5
YuhanZhang
in reply to: Anonymous

Can you try to use the DWG File Export Options when save the IDW to AutoCAD DWG to check if it can solve the problems? The API does not do anything more than the UI functions.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 5 of 5

As Rocky mentioned, the API has no more functionalities than the UI, so you should first check if that's doable from UI. If not, you will have to process the dwg either with AutoCAD API or RealDWG.

 

Here is a sample that illustrates how to retrieve all export options for the DWG translator:

 

Public Sub GetTranslatorSaveAsOptions()

    Dim clsId As String
    clsId = "{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}"

    Dim oTranslator As TranslatorAddIn
    Set oTranslator = ThisApplication.ApplicationAddIns.ItemById(clsId)
    
    Dim Context As TranslationContext
    Set Context = ThisApplication.TransientObjects.CreateTranslationContext
    Context.Type = kFileBrowseIOMechanism
    
    Dim options As NameValueMap
    Set options = ThisApplication.TransientObjects.CreateNameValueMap
    
    Dim sourceObject As Object
    Set sourceObject = ThisApplication.ActiveDocument

    Dim index As Integer
    If oTranslator.HasSaveCopyAsOptions(sourceObject, Context, options) Then
    
        For index = 1 To options.count
            Debug.Print options.Name(index) & " = " & options.value(options.Name(index))
        Next
        
    End If
    
End Sub

 

This is the output of that code:

 

Publish_All_Sheets = 0
Publish_3D_Models = 0
Launch_Viewer = 0
Password = 
Publish_Mode = 62721
Enable_Large_Assembly_Mode = 0
Enable_Measure = 1
Enable_Printing = 1
Enable_Markups = 1
Enable_Markup_Edits = 1
Output_Path = 
Include_Sheet_Tables = 1
Sheet_Metal_Flat_Pattern = 0
Sheet_Metal_Style_Information = 0
Sheet_Metal_Part = 1
Weldment_Preparation = 0
Weldment_Symbol = 0
BOM_Structured = 1
BOM_Parts_Only = 1
Animations = 0
Instructions = 0
iAssembly_All_Members = 0
iAssembly_3D_Models = 0
iPart_All_Members = 0
iPart_3D_Models = 0
Publish_Component_Props = 1
Publish_Mass_Props = 1
Include_Empty_Properties = 0
Publish_Screenshot = 0
Screenshot_DPI = 96
Facet_Quality = 69379
Force_Facet_Recompute = 0
Facet_Recompute_Tolerance = 0.001
Override_Sheet_Color = 0
Sheet_Color = 0
Sheet_Range = 14081
Custom_Begin_Sheet = 1
Custom_End_Sheet = -1
All_Color_AS_Black = 0
Remove_Line_Weights = 0
Vector_Resolution = 400
TranscriptAPICall = 0

 And here an example from the help files on how to use options with PDF translator:

Public Sub PublishPDF()
    ' Get the PDF translator Add-In.
    Dim PDFAddIn As TranslatorAddIn
    Set PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

    'Set a reference to the active document (the document to be published).
    Dim oDocument As Document
    Set oDocument = ThisApplication.ActiveDocument

    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism

    ' Create a NameValueMap object
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap

    ' Create a DataMedium object
    Dim oDataMedium As DataMedium
    Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

    ' Check whether the translator has 'SaveCopyAs' options
    If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then

        ' Options for drawings...

        oOptions.Value("All_Color_AS_Black") = 0

        'oOptions.Value("Remove_Line_Weights") = 0
        'oOptions.Value("Vector_Resolution") = 400
        'oOptions.Value("Sheet_Range") = kPrintAllSheets
        'oOptions.Value("Custom_Begin_Sheet") = 2
        'oOptions.Value("Custom_End_Sheet") = 4
    End If

    'Set the destination file name
    oDataMedium.FileName = "c:\temp\test.pdf"

    'Publish document.
    Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub

Hope that helps,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report