Edit field text from sketch symbol after placing

Edit field text from sketch symbol after placing

WIRMNS
Enthusiast Enthusiast
450 Views
2 Replies
Message 1 of 3

Edit field text from sketch symbol after placing

WIRMNS
Enthusiast
Enthusiast

Hi,

I have a piece of code where I have a sketch symbol put in my drawing.

Part of the text is already pre-filled. This are prompted entry text.

I want after placing the symbol that the Edit property fields pop-up is comming.

What is the best way to do it?

 

 

Dim oSketchedSymbolDef As SketchedSymbolDefinition
oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item("Pos")
 
'Check To see If sketch symbol is on sheet
For Each actualSymbol As Inventor.SketchedSymbol In oDrawDoc.ActiveSheet.SketchedSymbols
' If sketched symbol is found
If (actualSymbol.Name = "Pos") Then
Return
Else 
 
End If
Next
 
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
 
Dim oPromptStrings(2) As String
oPromptStrings(0) = "1x" 'prompt 1
oPromptStrings(1) = "EN AW-5454" 'prompt 2
oPromptStrings(2) = "X" 'prompt 3
 
Dim oSketchedSymbol As SketchedSymbol
 
oSketchedSymbol = oSheet.SketchedSymbols.Add _
(oSketchedSymbolDef, oTG.CreatePoint2d(20.5, 4.5), 0, 1, oPromptStrings)
0 Likes
Accepted solutions (1)
451 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor
Accepted solution

The easiest way is to execute appropriate command

 

Dim oDrawDoc As DrawingDocument = ThisDoc.Document
dim oSheet as sheet = oDrawDoc.ActiveSheet

'Original code

Dim oSketchedSymbolDef As SketchedSymbolDefinition
oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item("Pos")

'Check To see If sketch symbol is on sheet
For Each actualSymbol As Inventor.SketchedSymbol In oDrawDoc.ActiveSheet.SketchedSymbols
	' If sketched symbol is found
	If (actualSymbol.Name = "Pos") Then
		Return
	Else

	End If
Next

Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry

Dim oPromptStrings(2) As String
oPromptStrings(0) = "1x" 'prompt 1
oPromptStrings(1) = "EN AW-5454" 'prompt 2
oPromptStrings(2) = "X" 'prompt 3

Dim oSketchedSymbol As SketchedSymbol

oSketchedSymbol = oSheet.SketchedSymbols.Add _
(oSketchedSymbolDef, oTG.CreatePoint2d(20.5, 4.5), 0, 1, oPromptStrings)

'End of Original code

oDrawDoc.SelectSet.Select(oSketchedSymbol)
ThisApplication.CommandManager.ControlDefinitions("DrawingEditFieldTextCmd").Execute

 

But cleaner than this solution is to implement your own edit dialog and update the prompted texts using API

0 Likes
Message 3 of 3

WIRMNS
Enthusiast
Enthusiast

Thanks! This is what I want.

0 Likes