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: 

WriteDataToFile ouputs Incorrect Drawing Sheet Titles while writing to DWF.

1 REPLY 1
Reply
Message 1 of 2
mbathala
378 Views, 1 Reply

WriteDataToFile ouputs Incorrect Drawing Sheet Titles while writing to DWF.

I created a Multisheet drawing file.(.idw)

 

While the file to DWF format with WriteDataToFile, the Title Block shows wrong Sheet number.

 

For a 5 Sheet drawing, the output DWF files contain following Titles:

1 of 2

2 of 3

3 of 4

4 of 5

5 of 5

 

Whereas expected titles should be:

1 of 5

2 of 5

3 of 5

4 of 5

5 of 5

 

Interestingly, if I create a multisheet Drawing and Activate all sheets one by one before saving it.

The DWF files outputted show correct Titles.

 

Hence in the first case, I used Activate() on all sheets before writing them with WriteDataToFile. But could not get correct Titles.

 

Seems like a issue with WriteDataToFile()

1 REPLY 1
Message 2 of 2
xiaodong_liang
in reply to: mbathala

Hi,

 

I maybe missed something, but it looks only Sheet has DataIO, which means you have to output them to DWF one by one. But it looks you output them in one DWF? Could you share your code?

 

In addition, if this is really a problem, I'd suggest you give it a try with TranslatorAddin of DWF, which maybe work as you expected. 

 

by the way, this is the code I am using with WriteDataToFile 

 

Sub xxx()
 
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    
    Dim i As Integer
    i = 1
    For Each oSheet In oDoc.Sheets
     
        Dim oDataIO As DataIO
        Set oDataIO = oSheet.DataIO
        
        Dim Formats() As String
        Dim StorageTypes() As StorageTypeEnum
        
        oDataIO.GetOutputFormats Formats, StorageTypes
        
        Dim FullFileName As String
        FullFileName = oDoc.FullFileName
        
        Dim NewFileName As String
        Dim pos As Integer
        
        'set the file name
        pos = InStrRev(FullFileName, ".")
        NewFileName = Left(FullFileName, pos - 1)
        NewFileName = NewFileName & "_" & i & ".dwf"
        
        oDataIO.WriteDataToFile "DWF", NewFileName

        i = i + 1
    Next
    
End Sub

 

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

Post to forums  

Autodesk Design & Make Report