iLogic change the text for an existing symbol

iLogic change the text for an existing symbol

dusan.naus.trz
Advisor Advisor
618 Views
2 Replies
Message 1 of 3

iLogic change the text for an existing symbol

dusan.naus.trz
Advisor
Advisor

Hi,

How can I use ilogic to change the text for an existing symbol? No use of the text prompted entry.

Sketched Symbols Name = example

Sketched Symbols Text = test1

After using ilogic Change Sketched Symbols Text = test2

Thank you for answer.

 

0 Likes
619 Views
2 Replies
Replies (2)
Message 2 of 3

rhasell
Advisor
Advisor

Hi

 

I got the following bit of code from Curtis Waguespack. The only change I made from his original code is the loop at the end.

It will change everything based on your search string, but perhaps you can change it to suit your needs?

 

Sub MAIN ()
oDoc = ThisDoc.Document
Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim oGeneralNotes As GeneralNotes
Dim oGeneralNote As GeneralNote 
Dim oSymbol As SketchedSymbol
Dim oSymbols As SketchedSymbols
Dim oTitleBlock As TitleBlock 
'Dim oTestBox As TextBox

Dim TXT2Find As String
Dim NewTXT As String

'get user input
TXT2Find = InputBox("Enter Text To Find:", "iLogic", "XXX")
'look for blank value
If TXT2Find ="" Then
Return 'exit rule
Else 
'Continue rule
End If

NewTXT = InputBox("Enter Text To Replace   '"& TXT2Find _ 
& "'  with.", "iLogic", "****")
'look for blank value
If NewTXT ="" Then
Return 'exit rule
Else 
'Continue rule
End If

oSheets = oDoc.Sheets
For Each oSheet In oSheets

	'handle errors
	On Error Resume Next
	
	'look at gerenal notes
	oGeneralNotes = oSheet.DrawingNotes.GeneralNotes
	For Each oGeneralNote In oGeneralNotes
		If oGeneralNote.FormattedText = TXT2Find Then
		oGeneralNote.FormattedText = NewTXT 
		Else 
		End If        
	Next    
	
	'look at leader notes	
	oLeaderNotes = oSheet.DrawingNotes.LeaderNotes
	For Each oLeaderNote In oLeaderNotes
		If oLeaderNote.FormattedText = TXT2Find Then
		oLeaderNote.FormattedText = NewTXT 
		Else 
		End If        
	Next    
	
	'look at title blocks
	oTitleBlock = oSheet.TitleBlock
	For Each oTextBox In oTitleBlock.Definition.Sketch.TextBoxes
        	If oTitleBlock.GetResultText(oTextBox) = TXT2Find  Then
        	oTitleBlock.SetPromptResultText(oTextBox, NewTXT )
		Else
		End If
    	Next
    	
	'look at sketched symbols	
	oSymbols = oSheet.SketchedSymbols
    	For Each oSymbol In oSymbols
    		For Each oTextBox  In oSymbol.Definition.Sketch.TextBoxes
 			If oSymbol.GetResultText(oTextBox) = TXT2Find Then
 			oSymbol.SetPromptResultText (oTextBox, NewTXT)
    			Else 
			End If      
    		Next
        Next
Next
oAgain=MessageBox.Show("Again", "Rinse and Repeat",MessageBoxButtons.YesNo, MessageBoxIcon.Question) 'Added rev2
If oAgain=vbYes
AGAIN
End If
End Sub

Sub AGAIN
MAIN
End Sub
Reg
2026.1
0 Likes
Message 3 of 3

dusan.naus.trz
Advisor
Advisor

No, that's not the solution. This is not the case in the introduction.

0 Likes