rename sketched symbol in drawing resources. is it possible?

rename sketched symbol in drawing resources. is it possible?

Jakob_Hamburg
Advocate Advocate
275 Views
2 Replies
Message 1 of 3

rename sketched symbol in drawing resources. is it possible?

Jakob_Hamburg
Advocate
Advocate

Hi.
I am wondering if it is possible to rename a sketch symbol (which is used on the drawing) in the model browser (drawing resources).
I saw that one can rename a title block, but I also read that the sketch symbols "name" is "read only".

In this example a title block is renamed, is that also possible with a sketch symbol? I could not figure out how.

 

'rename the definition in the Drawing Resources folder
	        oTitleBlock.Definition.Name = "D titleblock" 

 

 

Background why I want to rename a sketch symbol:
We have 4 different sketch symbols for welding data. Lets call them "A", "B", "D" and "E".
Those welding data stamps contain different information for example for normal steel or stainless steel, and so on...
It is always only one of these symbols on a drawing and in the drawings resources folder.
But now we concluded that these symbols contain too much unnecessary information and all should be replaced by only one more basic symbol.
So I made a rule that will replace the existing sketch symbol "A" with the new very basic symbol "A" that is stored on a sketch library template (.idw).
In my rule the name of the existing and the new symbol from the template has to be "A".
I want to also replace "B", "D" and "E" with the new very basic symbol "A", therefor I want to first rename "B", "D" and "E" to "A".
I hope I could explain the background well enough.

 

PS: I am still using Inventor 2021

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

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Jakob_Hamburg.  Yes, we should be able to rename individual SketchedSymbolDefinition objects, which are directly obtained from the DrawingDocument.SketchedSymbolDefinitions property, which returns the SketchedSymbolDefinitions collection object.  Those are what we see in the drawing resources folder.  Then there are the individual SketchedSymbol objects, which are the individual 'placed instances' that are created from those definitions, and placed onto the sheets.  These are different objects than their definitions. 

 

SketchedSymbolDefinition.Name (a Read/Write property with a String type value)

Sheet.SketchedSymbols is a property of each Sheet object, representing the SketchedSymbols collection of them that have been placed on that specific Sheet, if any.  These are not the main definitions, but just 'placed instances' created from the main definition.

SketchedSymbol.Name (a Read/Write property with a String type value)

Just don't try to change the name of a definition that is currently being used by some existing placed instances which were created based upon that definition.  When there are placed instances referring to a definition, then you may have to delete all of those placed instances on all sheets first, before it will let you rename the definition that they were based on.  Plus, it most likely will not allow you to have two definitions with the same exact name, in the same drawing document.  But, you can replace an existing definition in your current drawing with one from the definitions template / library, with the same name.  Because the new one will be replacing the existing one, there will never be to of them in that drawing with the same name.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Jakob_Hamburg
Advocate
Advocate

Thank you very much for your explanation.

 

Now I managed to rename the welded symbol.

(If I rename it in the drawing resources folder luckily also the instance on the drawing sheet gets renamed by inventor. When I afterwards update the drawing symbol from my template, the sketch symbol gets updated/changed.) 

 

I just add my few lines of code to rename the sketch symbol here, maybe it is useful for someone.

Dim oDrawDoc As DrawingDocument = ThisDoc.Document 

'This is the name of the symbol
Dim SymbolName As String = "Welding Data"
Dim oldSymbolName As String = "Welding Data Stainless Steel"
'check file type 
If ThisDoc.Document.DocumentType <> kDrawingDocumentObject Then
Return
End If


Dim oSymbolDef As SketchedSymbolDefinition = Nothing
Try
	oSymbolDef = ThisDrawing.Document.SketchedSymbolDefinitions.Item(oldSymbolName)
	oSymbolDef.Name = SymbolName
	
Catch
	'MsgBox ("was no symbol there")
End Try

 

0 Likes