How can I edit note tail of weld symbol by API

How can I edit note tail of weld symbol by API

NhatHaBG
Participant Participant
1,127 Views
11 Replies
Message 1 of 12

How can I edit note tail of weld symbol by API

NhatHaBG
Participant
Participant

How can I edit note tail of weld symbol by API ?

huudvXLNYU_0-1697212892177.png

 

0 Likes
Accepted solutions (1)
1,128 Views
11 Replies
Replies (11)
Message 2 of 12

WCrihfield
Mentor
Mentor

Hi @NhatHaBG.  This is a pretty new capability, but they do have a VBA code example for creating a new one in a drawing.  The link to that example is below:

https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingWeldingSymbolCreation_Sample 

In that example, you can see the path for how to get to these objects.

Sheet.WeldingSymbols, which returns a DrawingWeldingSymbols collection object.  Then DrawingWeldingSymbols.Item() property can then be used to get a DrawingWeldingSymbol object by its Index number.  Then you can use DrawingWeldingSymbol.Definitions property to get a DrawingWeldingSymbolDefinitions object.  Then you can use DrawingWeldingSymbolDefinitions.Item property to get one of its DrawingWeldingSymbolDefinition objects.  Then you can use its DrawingWeldingSymbolDefinition.TailNote property, which is Read/Write, and contains a String.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 12

NhatHaBG
Participant
Participant
Thank you so much,
However, I want to edit note tail of weld symbol or make new weld symbol in 3D Assembly Enviroment by API
It is possible?
0 Likes
Message 4 of 12

bradeneuropeArthur
Mentor
Mentor

This will do.

First select the weld-symbols in the drawing and let then the code run.

Dim d As Inventor.DrawingDocument = ThisDrawing.Document
Dim s As Inventor.SelectSet = d.SelectSet
For Each oWeldingSymDef As Inventor.DrawingWeldingSymbol In s
	
	Dim dwd As Inventor.DrawingWeldingSymbolDefinitions = oWeldingSymDef.Definitions
dwd.Item(1).TailNote = "HOW CAN I EDIT THIS"
	Next

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 5 of 12

NhatHaBG
Participant
Participant

Sorry, however I can not find WeldSymDef object in inventor API 

NhatHaBG_0-1697336245309.png

 

0 Likes
Message 6 of 12

bradeneuropeArthur
Mentor
Mentor
It if only available from 2024 of Inventor!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 7 of 12

NhatHaBG
Participant
Participant

Oh this is new function, great

However, I can't find the welding symbol that is created in welds using the above method. 

Can you show me how to access it; Thanks

NhatHaBG_0-1697441781036.png

 

0 Likes
Message 8 of 12

bradeneuropeArthur
Mentor
Mentor
Accepted solution
My code is based on the drawing not the Weldment Assembly.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 9 of 12

WCrihfield
Mentor
Mentor

Hi @NhatHaBG.  I believe that accessing the WeldSymbol object on the model side may only be possible if you have created a 3D annotation for it.  You can create 3D annotations that are welding symbols from the Annotate tab of a model document.  The welding symbols you create that way can be accessed like the below example.  And the TailNote property is Read/Write here too.

Sub Main
	'if it is not a Weldment type Assembly, then let user know and exit rule
	If ThisDoc.Document.SubType <> "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then
		MsgBox("A Weldment type Assembly must be active for this rule to work. Exiting rule.", vbCritical, "iLogic")
		Exit Sub
	End If
	Dim oADoc As AssemblyDocument = ThisDoc.Document
	Dim oWeldmentDef As WeldmentComponentDefinition = oADoc.ComponentDefinition
	Dim oMWSs As ModelWeldingSymbols = oWeldmentDef.ModelAnnotations.ModelWeldingSymbols
	If oMWSs.Count > 0 Then
		For Each oMWS As ModelWeldingSymbol In oMWSs
			Logger.Info("Name = " & oMWS.Name)
			Dim oMWSDefs As ModelWeldingSymbolDefinitions = oMWS.Definitions
			For Each oMWSDef As ModelWeldingSymbolDefinition In oMWSDefs
				Logger.Info("TailNote = " & oMWSDef.TailNote)
				Dim oWS1 As WeldSymbol = oMWSDef.WeldSymbolOne
				Try : Logger.Info("WeldSymbol Above Ref Line Thickness = " & oWS1.Thickness) : Catch : End Try
				Dim oWS2 As WeldSymbol = oMWSDef.WeldSymbolTwo
				Try : Logger.Info("WeldSymbol Below Ref Line Thickness = " & oWS2.Thickness) : Catch : End Try
			Next
		Next 'oMWS
	Else
		Logger.Info("There were no ModelWeldingSymbols.")
	End If
End Sub

Those will be the ones you see inside the Annotations browser folder in your model browser tree.  But I do not believe we have direct access to the true weld symbols that are located below the 'Welds' folder in the model browser tree through the API yet.  We can access the information that is included within those 'real' symbols indirectly, but it is ReadOnly, and formatted with XML tags though.  The only WeldBead objects that will include any data within the WeldInfo property are the ones you have created 'real' weld symbols for.

Sub Main
	'if it is not a Weldment type Assembly, then let user know and exit rule
	If ThisDoc.Document.SubType <> "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then
		MsgBox("A Weldment type Assembly must be active for this rule to work. Exiting rule.", vbCritical, "iLogic")
		Exit Sub
	End If
	Dim oADoc As AssemblyDocument = ThisDoc.Document
	Dim oWeldmentDef As WeldmentComponentDefinition = oADoc.ComponentDefinition
	Dim oWeldsDef As WeldsComponentDefinition = oWeldmentDef.WeldsComponentDefinition
	Dim oWelds As Welds = oWeldmentDef.Welds
	Dim oBeads As WeldBeads = oWelds.WeldBeads
	For Each oBead As WeldBead In oBeads
		'Dim oSymAPoint As Point = oBead.SymbolAttachPoint 'ReadOnly
		'Dim oSymBPoint As Point = oBead.SymbolBreakPoint 'ReadOnly
		Logger.Info("oBead.Name = " & oBead.Name & vbCrLf & _
		"oBead.WeldInfo:" & vbCrLf & oBead.WeldInfo)
	Next 'oBead
End Sub

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 10 of 12

G.Binl
Advocate
Advocate

@bradeneuropeArthur 

How are you doing, this code works well and give some insight of how this command works. 

you can select all the welds and change them all at once. I have tried to modify this so that i can do a find and replace per sheet and for the life of me can not figure out how to do this.  we have many sheets and many welds that will be updated per job that is currently done manually. I would like to replace 1A with A for the whole sheet. leaving 008

example:

W-1A008 would be W-A008

W-1A009 Would be W-A009

GBinl_0-1701204540871.png

GBinl_1-1701204943342.png

I use this for user interface

Any help would be great.

0 Likes
Message 11 of 12

bradeneuropeArthur
Mentor
Mentor

Please send me a private message and we will have a look, for creating an add in with find and replace functionality.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 12 of 12

bradeneuropeArthur
Mentor
Mentor

Is this maybe coming close to what you need via an add-in?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes