Export data from a SketchedSymbols

Export data from a SketchedSymbols

Anonymous
Not applicable
426 Views
0 Replies
Message 1 of 1

Export data from a SketchedSymbols

Anonymous
Not applicable

Hello:

I leave you a code to export data from a SketchedSymbols.

 

SyntaxEditor Code Snippet:

 

Imports System.io

Sub Main
    ' the name of the symbol is defined.
    SymbolName =InputBox("Simbol Name", "Export data symbol", "Symbol Name")
    readData(SymbolName)
End Sub

''' Symbol data is read.
Sub readData(SymbolName As String)
    Dim oIDW As DrawingDocument
    Dim oSheet As Sheet
    Dim oSheets As Sheets
    Dim oSymbol As SketchedSymbol
    Dim oSymbols As SketchedSymbols
    
    oIDW = ThisApplication.ActiveDocument
    oSheets = oIDW.Sheets
    
    For Each oSheet In oSheets
        For Each oSymbol In oSheet.SketchedSymbols
            If oSymbol.Name = SymbolName Then
            Dim strtexts As TextBoxes
            strtexts = oSymbol.Definition.Sketch.TextBoxes
            For Each strText In strtexts
                WriteFile(strText.text)
            Next
        End If
        Next
    Next
End Sub

''' Data is written to the file defined in the parameter "FicheroDatos"
Sub WriteFile(strContent As String)
    Dim fichero As  System.io.streamwriter
    
    ' Add text to file defined in parameter "FicheroDatos".
    fichero = IO.File.AppendText(FicheroDatos)
    fichero.WriteLine(strContent)
    fichero.Flush()
    fichero.Close()
End Sub

 

 

I hope will be useful.

0 Likes
427 Views
0 Replies
Replies (0)