- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I hope someone can help me. I want to PDF mine .idw in multiple languages. All the text is placed in the borders & sketch symbols. For each sketch symbol I have the standard language set and some other sets. (For example sketch symbol 01Standard and 01Scandinavian, I used these also in the code to make it clear names, in reality these are more complex).
I already managed to create an form (see picture below). 'Get language options' button creates a multi value parameter with the language options (only needed the first time used in a drawing, or when an language is added). The idea is that you select the goal language and push 'Translate'. Translate rule should swap the borders and sketch symbols to the selected language. (Each sketch symbol and on each page)
I have already the code shown below. If a test separate parts it works, but as a whole I don't get it working. Also I struggle to add the "for each sheet".
Is there someone able to help me?
Sub Main
'check file type
If ThisDoc.Document.DocumentType <> kDrawingDocumentObject Then
MessageBox.Show("Document is not a drawing.", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
End If
'Sketch symbols swap to standard
If Parameter ("LanguageOptions") = "Standard"
For Each oSheet In oDrawDoc
'Define which symbol should be swapped by which one
SwapSymbols("01Scandinavian", "01Standard")
SwapSymbols("01Arabic", "01Standard")
SwapSymbols("02Scandinavian", "02Standard")
SwapSymbols("02Arabic", "02Standard")
Next
End If
'Sketch symbols swap to Arabic
'Sketch symbols swap to Scandinavian
'Title blocks swap to standard
'Title blocks swap to Arabic
'Title blocks swap to Scandinavian
End Sub
'Define the drawing document
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
'Define the drawing sheet
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
'create insertion point, coordinates - are cm
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oInsertionPoint As Point2d
Sub SwapSymbols (SymbolOriginal As String, SymbolTranslated As String)
For Each oSymbol In oDrawDoc.ActiveSheet.SketchedSymbols
'look for the symbol by name
If oSymbol.Name = SymbolOriginal Then
'get the symbol insert point
oSymbPoint = oSymbol.Position
oInsertionPoint = oTG.CreatePoint2d(oSymbPoint.X,oSymbPoint.Y)
'get the symbol scale
oSymbScale = oSymbol.Scale
'delete SymbolOriginal
oSymbol.Delete
'Place SymbolTranslated (name symbol, position, rotation, scale,
oSymbol_2 = oSheet.SketchedSymbols.Add(SymbolTranslated, oInsertionPoint, 0, oSymbScale, Nothing)
End If
Next
End Sub
Solved! Go to Solution.