Turn off Sketch Symbol Leader

Turn off Sketch Symbol Leader

C_Haines_ENG
Collaborator Collaborator
513 Views
6 Replies
Message 1 of 7

Turn off Sketch Symbol Leader

C_Haines_ENG
Collaborator
Collaborator

Im looking for a way to toggle all sketch symbols leaders off. I have the code below to attempt this but the .Leader property is read only.

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oSketchedSymbols As SketchedSymbols = oSheet.SketchedSymbols

For Each oItem As SketchedSymbol In oSketchedSymbols
		
oItem.LeaderVisible = False
oItem.Leader 'THIS IS READ ONLY???
	
Next   

 Does anyone else know how to solve this?

0 Likes
Accepted solutions (1)
514 Views
6 Replies
Replies (6)
Message 2 of 7

mfoster9TD82
Advocate
Advocate

You may need to get the placement and sketch symbol definition from the existing sketch symbol, delete it and place another one using SketchedSymbols.Add(). It doesn't really looks like you can remove leaders from sketch symbols, but you can add them...


Edit:

I was mistaken. After fooling around with it more, you can delete the all the Nodes in the leader of each sketch symbol:

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oSketchedSymbols As SketchedSymbols = oSheet.SketchedSymbols

For Each oItem As SketchedSymbol In oSketchedSymbols
		
	If Not oItem.Leader Is Nothing AndAlso Not oItem.Leader.AllNodes Is Nothing Then
		While Not oItem.Leader.AllNodes Is Nothing AndAlso oItem.Leader.AllNodes.Count > 0 
			oItem.Leader.AllNodes(1).Delete
		End While
	End If
Next

 

edit2: code fix

 

0 Likes
Message 3 of 7

C_Haines_ENG
Collaborator
Collaborator

Inventor doesnt seem to like this line:

 

oItem.Leader.AllNodes(1).Delete

 

Class not registered, incorrect parameter, etc. 

0 Likes
Message 4 of 7

mfoster9TD82
Advocate
Advocate
What version of inventor are you using?
And are you getting that in a compiler error or a runtime error?
0 Likes
Message 5 of 7

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Dim d As DrawingDocument = ThisDrawing.Document
Dim s As Sheet = d.ActiveSheet
Dim sss As SketchedSymbols = s.SketchedSymbols

	For Each ss As SketchedSymbol In sss
	Try	
		ss.Leader.AllLeafNodes.Item(1).Delete
Catch
		
	End Try
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 6 of 7

A.Acheson
Mentor
Mentor

Hi @C_Haines_ENG 

Is your goal to switch off the leader visibility

You might want to put in an error trap for any that are off also. If you go about deleting then you have nothing to bind the symbol to the view.

Syntax

SketchedSymbol.LeaderVisible() As Boolean

Property Value

This is a read/write property whose value is a Boolean.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 7 of 7

C_Haines_ENG
Collaborator
Collaborator

Looks like the try line saved it from bugging out, thank you.

0 Likes