Change Sketch Symbol by Ilogic

Change Sketch Symbol by Ilogic

yohansampaio
Explorer Explorer
303 Views
2 Replies
Message 1 of 3

Change Sketch Symbol by Ilogic

yohansampaio
Explorer
Explorer

Hello,

I have a question about whether it's possible to change the text within a sketch symbol that exists in an existing detail.

In this case, I have a sketch symbol called "PA" with the text "Perfil Alto" inside.

I need a rule that changes the text from Perfil Alto to High Profile.

However, within the sketch symbol, the text is inserted as the requested input. (Property field: "OBSERVATIONS", VALUE: "PERFIL ALTO").

Can anyone help me?

 

SKETCHEDSYMBOL - ILOGIC.png

 

This code below is not working.

' Obter o documento de desenho atual
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.Sheets(1)

' Percorrer todos os símbolos da folha
Dim oSymbol
For Each oSymbol In oSheet.SketchedSymbols
    If oSymbol.Definition.Name = "PA" Then
        ' Substitui o valor do prompt chamado "OBSERVAÇÕES"
        oSymbol.SetPromptResultText("OBSERVAÇÕES", "HIGH PROFILE")
    End If
Next

0 Likes
Accepted solutions (1)
304 Views
2 Replies
Replies (2)
Message 2 of 3

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @yohansampaio .
To get and edit Property Field you need to use TextBoxes object. Below you can see an example of editing text according to your case.

' Obter o documento de desenho atual
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.Sheets(1)

' Percorrer todos os símbolos da folha
For Each oSymbol As SketchedSymbol In oSheet.SketchedSymbols
    If oSymbol.Definition.Name = "PA" Then
        ' Substitui o valor do prompt chamado "OBSERVAÇÕES"	
		Dim oTextBoxes As TextBoxes = oSymbol.Definition.Sketch.TextBoxes
		For Each oTBox As Inventor.TextBox In oTextBoxes
			If Not oTBox.Text = "OBSERVAÇÕES" Then Continue For
			If oSymbol.GetResultText(oTBox) = "PERFIL ALTO" Then
				oSymbol.SetPromptResultText(oTBox, "HIGH PROFILE")
				Exit For
			End If
		Next
    End If
Next

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

0 Likes
Message 3 of 3

yohansampaio
Explorer
Explorer
Thank you so much @Andrii_Humeniuk for your help.

It worked , and now I can adapt it to other situations.

 

0 Likes