iLogic and sketch symbol library

iLogic and sketch symbol library

Anonymous
Not applicable
3,674 Views
6 Replies
Message 1 of 7

iLogic and sketch symbol library

Anonymous
Not applicable

I have a code that looks for a yes or no iproperty from the idw model and place a sketch symbol in the idw depending on the yes or no.

 

I am currently using these line of code to get the sketch symbol

SyntaxEditor Code Snippet

    'create insertion point, coordinates - are cm 
    Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
    Dim oInsertionPoint As Point2d
    
    'define the insert point for the symbol
    oInsertionPoint = oTG.CreatePoint2d(23.9,4.5) ' X = 25 cm , Y = 4.5 cm
    'define symbol Definition to use
    oSymDef= oDrawDoc.SketchedSymbolDefinitions.Item(sSymbol_01)
    
    'capture the current active sheet 
    Dim oCurrentNumber  As Sheet
    oCurrentNumber  = oDrawDoc.ActiveSheet

        'insert the new symbol
        'Nothing is used when teh symbol has no prompted entry
        oSym = oCurrentNumber.SketchedSymbols.Add(oSymDef,oInsertionPoint,0,1,Nothing)    

But it doesn't look for the skecth symbol in the libraries, only in the local one.

 

Is there a way (ilogic code) to insert a sketch symbol from the library?

I know that there's code to get the sketch symbol from a template but I really wish I could just use the one in the library.

0 Likes
Accepted solutions (1)
3,675 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

UP!

0 Likes
Message 3 of 7

BrandonBG
Collaborator
Collaborator
Accepted solution
Dim oSketchSymLib As SketchedSymbolDefinitionLibrary
oSketchSymLib = oDrawing.SketchedSymbolDefinitions.SketchedSymbolDefinitionLibraries.Item("Library")

Dim oSSDEf As SketchedSymbolDefinition
oSSDef = oDrawing.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "The Name Of The Sketched Symbol", True)

You need to add the library sketched symbol to the local symbols before you can place it.

 

Brandon

Message 4 of 7

Anonymous
Not applicable
Thanks I just added it to my to my code and it worked!
Message 5 of 7

JorisSteurs1246
Advocate
Advocate

I have been putting these pieces of iLogic together, but can't get it to work.

 

Is it possible to post the complete working code here?

 

Thank you.

0 Likes
Message 6 of 7

bradeneuropeArthur
Mentor
Mentor
Please provide us your complete code.

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

edward.bolanos
Explorer
Explorer

Hi

 

This is the rule!

 

Regards

 

'Sub Main() 
'Set a reference to the drawing document.
'This assumes the drawing document is active.
Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
Dim oSketchSymLib As SketchedSymbolDefinitionLibrary _
    = oDrawDoc.SketchedSymbolDefinitions.SketchedSymbolDefinitionLibraries.Item("Library")

Dim oSSDEf As SketchedSymbolDefinition _
    = oDrawDoc.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "The Name Of The Sketched Symbol", True)

'Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
Dim oSketchedSymbolDef As SketchedSymbolDefinition _
       = oDrawDoc.SketchedSymbolDefinitions.Item("The Name Of The Sketched Symbol")
	   

Dim oSheet As Sheet = oDrawDoc.ActiveSheet
 
'CREATE INSERTION POINT, coordinates in cm!
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oInsertionPoint As Point2d = oTG.CreatePoint2d(24.9, 19.1)
 
'Add an instance of the sketched symbol definition to the sheet.
'Angle of rotation = 0 radians,
'scale = 1 when adding
'no text message
Dim oSketchedSymbol As SketchedSymbol _
       = oSheet.SketchedSymbols.Add( _
             oSketchedSymbolDef, _
             oInsertionPoint, _
             0, 1, Nothing)
'End Sub

 

0 Likes