Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic for Sketch Symbols

4 REPLIES 4
Reply
Message 1 of 5
shmartin89
1220 Views, 4 Replies

iLogic for Sketch Symbols

I want to replace view labels in drawings with sketch symbols to get a different appearance to my drawings. (As far as i know it is not possible to change the appearance of the standard view label.) See attached snap of my desired view label.

 

I have used ilogic on several occasions successfully but im not experienced at all.
 The way I see this working is for a sketch symbol to be inserted below a view when it is created,the standard view label being omitted & the Scale/Name/Sheet details linking to the sketch symbol through parameters.

 

If anyone can point me in the right direction on this one i would be greatful.

Cheers,

Capture.JPG

4 REPLIES 4
Message 2 of 5

over a year later, but i would also like some advise as to how to do this

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 3 of 5
mrattray
in reply to: stephengibson76

Unless someone has some brilliant idea on how to do this simply, it would be very difficult, cumbersome, and unreliable through iLogic (at least the way I picture it working). You may have a better chance of getting one of those brilliant ideas from one of the API gurus if you post in the Inventor Customization forum.

Mike (not Matt) Rattray

Message 4 of 5
shmartin89
in reply to: mrattray

Yes I can imagine it can be done through i logic but dont know anywhere near enough about writing code to produce it in ilogic.

 

It wouldnt be worth looking into it for me haha.

 

Inventor 2020 perhaps.......?!?!?! haha

Message 5 of 5
sstyxx
in reply to: shmartin89

SyntaxEditor Code Snippet

This should get you started.  It will insert a different sketch symbol based on the type of view it is. (I have section, detail, base and projected view set up already.  Might not be a great way to get it done and this is not done yet (I want to attach each tag to its respective view.).  I have been able to piece alot of code together from people on these forums so i thought i would give a little back.  This code is taken from multiple posts from other users.
 
Dim oDoc As DrawingDocument:  oDoc = ThisDoc.Document
oModelDoc = ThisDoc.ModelDocument

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim oSymbol As SketchedSymbol
Dim oSymbols As SketchedSymbols

ViewLetter = New String(){"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","W","Y","Z"}
Dim ViewCount = 0

oSheets = oDoc.Sheets

Dim view_asso_draft = 10506
Dim view_auxillary = 10499
Dim view_custom = 10498
Dim view_default = 10497
Dim view_detail = 10502
Dim view_draft = 10505
Dim view_OLE = 10500
Dim view_overlay = 10507
Dim view_projected = 10504
Dim view_section = 10503
Dim view_standard = 10501

For Each oSheet In oSheets
oViews = oSheet.DrawingViews
For Each oSymbol In oSheet.SketchedSymbols
If oSymbol.Definition.Name = "TTLs" Then
oSymbol.Delete
Else If oSymbol.Definition.Name = "TTL" Then
oSymbol.Delete
Else If oSymbol.Definition.Name = "DET TTL" Then
oSymbol.Delete
Else If oSymbol.Definition.Name = "SEC TTL" Then
oSymbol.Delete
End If
Next

    For Each oView In oViews
       
           'Set label as visible
        oView.ShowLabel = False
   
        'check view types 
        If oView.ViewType = view_detail Then
            oView.Name = ViewLetter(ViewCount)
            ViewCount = ViewCount + 1

            'This places a sketched symbol
            Dim oSymDef As SketchedSymbolDefinition
            'define the sketch symbol to be inserted
            oSymDef = oDoc.SketchedSymbolDefinitions.Item("DET TTL")
    'set a string array with values for the prompted entries found in the symbol
    Dim sPromptStrings(1) As String 
    sPromptStrings(0) = oView.Name'set to view scale
    sPromptStrings(1) = oView.ScaleString 'set to view name    
    
    'set the position for the sketched symbol to be inserted 
    'and spaced off of the selected view center
    Dim oPosition As Point2d: oPosition = oView.Center
    oPosition.y = oPosition.y - (oView.Height / 1.75 + 0.6)
    'insert the sketched symbol and set the prompted entries
    oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition,0,1,sPromptStrings)
'------------------------------------------------------------------------------------------------------     
        
        Else If oView.ViewType = view_section Then
            oView.Name = ViewLetter(ViewCount)
            ViewCount = ViewCount + 1
  
            'This places a sketched symbol
            Dim oSymDef As SketchedSymbolDefinition
            'define the sketch symbol to be inserted
            oSymDef = oDoc.SketchedSymbolDefinitions.Item("SEC TTL")
    'set a string array with values for the prompted entries found in the symbol
    Dim sPromptStrings(1) As String 
    sPromptStrings(0) = oView.Name 'set to view name 'set to view scale
    sPromptStrings(1) = oView.ScaleString 'set to view scale    
    
    'set the position for the sketched symbol to be inserted 
    ' and spaced off of the selected view center
    Dim oPosition As Point2d: oPosition = oView.Center
    oPosition.y = oPosition.y - (oView.Height / 1.75 + 0.6)
    'insert the sketched symbol and set the prompted entries
    oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition,0,1,sPromptStrings)
'------------------------------------------------------------------------------------------------------     

        Else If oView.ViewType = view_standard Then
            'This places a sketched symbol
            Dim oSymDef As SketchedSymbolDefinition
            'define the sketch symbol to be inserted
            oSymDef = oDoc.SketchedSymbolDefinitions.Item("TTL")
    'set a string array with values for the prompted entries found in the symbol
    Dim sPromptStrings(1) As String 
    sPromptStrings(0) = oView.Name 'set to view name 'set to view scale
    sPromptStrings(1) = oView.ScaleString 'set to view scale    

    'set the position for the sketched symbol to be inserted 
    ' and spaced off of the selected view center
    Dim oPosition As Point2d: oPosition = oView.Center
    oPosition.y = oPosition.y - (oView.Height / 1.5 + 0.6)
    'insert the sketched symbol and set the prompted entries
    oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition,0,1,sPromptStrings)
'------------------------------------------------------------------------------------------------------     
    
        Else If oView.ViewType = view_projected Then
            'This places a sketched symbol
            Dim oSymDef As SketchedSymbolDefinition
            'define the sketch symbol to be inserted
            oSymDef = oDoc.SketchedSymbolDefinitions.Item("TTLs")
    'set a string array with values for the prompted entries found in the symbol
    Dim sPromptStrings(1) As String 
    sPromptStrings(0) = oView.Name 'set to view name 'set to view scale
    sPromptStrings(1) = oView.ScaleString 'set to view scale    
    
    'set the position for the sketched symbol to be inserted 
    ' and spaced off of the selected view center
    Dim oPosition As Point2d: oPosition = oView.Center
    oPosition.y = oPosition.y - (oView.Height / 1.5 + 0.6)
    'insert the sketched symbol and set the prompted entries
    oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition,0,1,sPromptStrings)
    End If
    Next
Next

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report