Transfering Sketched Symbols to new drawing

Transfering Sketched Symbols to new drawing

Anonymous
Not applicable
1,659 Views
23 Replies
Message 1 of 24

Transfering Sketched Symbols to new drawing

Anonymous
Not applicable

I haven't done much programming at all in the last 10 years, so I am probably missing something simple here, but I don't understand why this is failing on the AddChild call

 

Any help appreciated. 

Public Sub Test_SketchedSyms()

    Dim oDestinationdoc As DrawingDocument
    Set oDestinationdoc = ThisApplication.ActiveDocument

    Dim oSourceDoc As DrawingDocument
    Set oSourceDoc = ThisApplication.Documents.Open("C:\Test.idw", False)
    
    Dim oSketchSymNodes As ObjectCollection
    Set oSketchSymNodes = ThisApplication.TransientObjects.CreateObjectCollection

    Dim oSourcePane As BrowserPane
    Set oSourcePane = oSourceDoc.BrowserPanes.ActivePane
    
    Dim oDestinationPane As BrowserPane
    Set oDestinationPane = oDestinationdoc.BrowserPanes.ActivePane

    Dim oSourceSketchSyms As BrowserNode
    Set oSourceSketchSyms = oSourcePane.TopNode.BrowserNodes("Drawing Resources").BrowserNodes.Item("Sketch Symbols")
    
    Dim oDestinationSketchSyms As BrowserNode
    Set oDestinationSketchSyms = oDestinationPane.TopNode.BrowserNodes("Drawing Resources").BrowserNodes.Item("Sketch Symbols")

    Dim oBrowserNode As BrowserNode
    For Each oBrowserNode In oSourceSketchSyms.BrowserNodes
        Debug.Print oBrowserNode.FullPath
        oSketchSymNodes.Add oBrowserNode
        
    Next
    Dim oNode As BrowserNode

    For Each oNode In oSketchSymNodes
        oDestinationSketchSyms.AddChild oNode
    Next

End Sub

0 Likes
Accepted solutions (1)
1,660 Views
23 Replies
Replies (23)
Message 2 of 24

bradeneuropeArthur
Mentor
Mentor
What version of inventor do you use.
I understood that this is possible with inventor 2016 and up...

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 3 of 24

Anonymous
Not applicable

Sorry I should have said, I use 2018.

0 Likes
Message 4 of 24

bradeneuropeArthur
Mentor
Mentor
You can already do that with the new library sketches!

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 24

bradeneuropeArthur
Mentor
Mentor
If you need to know how. Please let me know.

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 24

Anonymous
Not applicable

Thanks Bradeneurope,   I wasn't aware of the sketched symbol library.  Best I have been able to figure out so far is that the library entries don't show up in the browser, you have to access them via the insert sketch symbol dialog?  Everyone I know uses the browser 10x to the dialog box.  Is there a way to get them to show in the browser that I am missing?

0 Likes
Message 7 of 24

bradeneuropeArthur
Mentor
Mentor
Than import these from the library into your drawing!

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 8 of 24

Anonymous
Not applicable

Thanks again, but I am not seeing anything about import for sketch libraries.  Can it be done through code, so it happens automatically?

0 Likes
Message 9 of 24

bradeneuropeArthur
Mentor
Mentor
You can add the sketches to the drawing. From the library

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 10 of 24

bradeneuropeArthur
Mentor
Mentor
But this can also by coding. I have this. But I am not at my desk right now. Asap

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 11 of 24

Anonymous
Not applicable

I talked to the person I am helping with this code, and they don't want to use the Library, mainly because it messes with the order of items.  So I am back to trying to figure out transferring from a template drawing.

 

Once again, I am missing something obvious I think.  I shrunk this down to the absolute minimum and it fails to create the folder. 

 

    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument

    Dim oPane As BrowserPane
    Set oPane = oDoc.BrowserPanes.ActivePane

    Dim oFolder As BrowserFolder
    Set oFolder = oPane.AddBrowserFolder("Test")
0 Likes
Message 12 of 24

bradeneuropeArthur
Mentor
Mentor

What are you trying to do with:

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oPane As BrowserPane
Set oPane = oDoc.BrowserPanes.ActivePane

Dim oFolder As BrowserFolder
Set oFolder = oPane.AddBrowserFolder("Test")

 

Think you need the drawing sketches!?

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 13 of 24

bradeneuropeArthur
Mentor
Mentor

This should guide you in the right direction:

Public Sub dwgs()

Dim a As Application
Set a = ThisApplication

Dim b As DrawingDocument
Set b = a.ActiveDocument

Dim c As DrawingSketches

Dim d As DrawingSketches

MsgBox b.SketchedSymbolDefinitions.Count
b.SketchedSymbolDefinitions.Add (" SKETCH TO BE ADDED")
End Sub

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 14 of 24

Anonymous
Not applicable

Thanks Brad, but the goal is to copy the sketched symbols folders and their sketched symbols in the same order from a template drawing to an open drawing.   

 

The last code I posted is basically the Help Sample code converted from an assembly document to a drawing document and trying to just create a empty folder. 

0 Likes
Message 15 of 24

Anonymous
Not applicable

What I am seeing is that the Browsernodes variant is required if the the file is a drawing when calling Addbrowserfolder.  If it is a part or assembly it isn't required. If I am correct in that, shouldn't it be documented in the  help file?

 

I don't yet have the code for what I want figured out, but at least I can quit trying to create a empty folder for a test. 

0 Likes
Message 16 of 24

marcin_otręba
Advisor
Advisor

Hi,

 

you always can copy sketchsymbols each by each:

 

Dim sketch_symbol As SketchedSymbolDefinition
For i = 1 To doc.SketchedSymbolDefinitions.Count
sketch_symbol = doc.SketchedSymbolDefinitions.Item(i)
sketch_symbol.CopyTo (targetdocument as DrawingDocument, replace existing as Boolean)
Next

 

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 17 of 24

bradeneuropeArthur
Mentor
Mentor
That's what I already tried to tell in my previous post too.......
Isn't that what you need?

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 18 of 24

marcin_otręba
Advisor
Advisor
I only add that IT (copyto function) works with all drawing resources.. SO you can write your own drawingtransfer utility without aby limits like one folder at time

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 19 of 24

Anonymous
Not applicable

Thanks for the replies, but unless I am missing something the copyto method doesn't bring folders. 

 

The whole point is to bring the folder structure and sketched symbols from a template drawing to the current drawing in the same order (folders and sketched symbols ) as in the template drawing. 

 

Now that I know I have to have browsernodes in the Addbrowserfolder call for my testing, I am to the point that I am adding a folder to the tree, but it ends up at the top of the tree instead of in the sketched symbols folder.  

0 Likes
Message 20 of 24

marcin_otręba
Advisor
Advisor
Could you provide some screens form that folder structure?

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes