- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Inventor doesnt seem to like this line:
oItem.Leader.AllNodes(1).Delete
Class not registered, incorrect parameter, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
And are you getting that in a compiler error or a runtime error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
SyntaxSketchedSymbol.LeaderVisible() As Boolean
Property ValueThis is a read/write property whose value is a Boolean.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report