Message 1 of 4
Placing & Updating iLogic Sketch Symbols
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm following up on a post I made a few years ago that dealt with adding a views scale to a predefined Sketch Symbol and I've begun to expand on it a bit more. POST
Currently when ran it places my sketch symbols at a set distance from the view at the location I specify and has dummy text preset for the Prompted Entries that exist within the Symbol. I haven't been able to find a way to show the order in which they were placed, so getting prompts to enter in titles without knowing what view you're naming isn't super useful.
What I'm hoping to achieve is 3 additional things.
- When ran it would check the views that already have a symbol and update the info if it changed (view name, scale, etc)
- If ran multiple times it would not place the Sketch Symbol multiple times, simply update only?
- Is there a way to have linework within the symbol change as a result of the view width?
For point 3, the line beneath "DRAWING AREA TITLE" needs to be the same length as the view, rounded up to the nearest 3/4"
Sections/Details/Elevations
Plans
Code:
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing Document must be active for this rule to work. Exiting.", vbOKOnly + vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oSSDefs As SketchedSymbolDefinitions = oDDoc.SketchedSymbolDefinitions
Dim oPlanSymbolName As String = "014200-001 Drawing Area Title - 02 Grids" '<<<< CHANGE THIS >>>>
Dim oOtherSymbolName As String = "014300-001 Drawing Area Title - 02 Grids" '<<<< CHANGE THIS >>>>
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
For Each oView As DrawingView In oSheet.DrawingViews
' Define placement point for sketch symbol in relation to view (bottom Left of the view)
Dim oP2d As Point2d = oTG.CreatePoint2d((oView.Left), (oView.Top - oView.Height))
Select Case oView.ViewType
Case kStandardDrawingViewType, kDefaultDrawingViewType, kProjectedDrawingViewType, kAuxiliaryDrawingViewType
' Plan view symbol for standard, default, projected, and auxiliary views
Dim oPlanViewSSDef As SketchedSymbolDefinition
Try
oPlanViewSSDef = oSSDefs.Item(oPlanSymbolName)
Catch
MsgBox("Couldn't find the " & oPlanSymbolName & " sketch symbol definition.", , "")
Continue For
End Try
Dim oPrompts(7) As String '<<<< CHANGE THIS >>>>
oPrompts(0) = "X#" '<<<< CHANGE THIS >>>>
oPrompts(1) = "DRAWING AREA TITLE" & oView.Name '<<<< CHANGE THIS >>>>
oPrompts(2) = "SCALE" & oView.ScaleString '<<<< CHANGE THIS >>>>
oPrompts(3) = "SUBTEXT - LINE 1" '<<<< CHANGE THIS >>>>
oPrompts(4) = "SUBTEXT - LINE 2" '<<<< CHANGE THIS >>>>
oPrompts(5) = "SUBTEXT - LINE 3" '<<<< CHANGE THIS >>>>
oPrompts(6) = "SUBTEXT - LINE 4" '<<<< CHANGE THIS >>>>
oPrompts(7) = "SUBTEXT - LINE 5" '<<<< CHANGE THIS >>>>
oSheet.SketchedSymbols.Add(oPlanViewSSDef, oP2d, 0, 1, oPrompts)
Case DrawingViewTypeEnum.kDetailDrawingViewType, DrawingViewTypeEnum.kSectionDrawingViewType
' Section/detail views symbol for sections, details, etc.
Dim oSDEViewSSDef As SketchedSymbolDefinition
Try
oSDEViewSSDef = oSSDefs.Item(oOtherSymbolName)
Catch
MsgBox("Couldn't find the " & oOtherSymbolName & " sketch symbol definition.", , "")
Continue For
End Try
Dim oPrompts(9) As String '<<<< CHANGE THIS >>>>
oPrompts(0) = "Ref Grid" '<<<< CHANGE THIS >>>>
oPrompts(1) = "Ref Sheet" '<<<< CHANGE THIS >>>>
oPrompts(2) = "X#" '<<<< CHANGE THIS >>>>
oPrompts(3) = "DRAWING AREA TITLE" & oView.Name '<<<< CHANGE THIS >>>>
oPrompts(4) = "SCALE" & oView.ScaleString '<<<< CHANGE THIS >>>>
oPrompts(5) = "SUBTEXT - LINE 1" '<<<< CHANGE THIS >>>>
oPrompts(6) = "SUBTEXT - LINE 2" '<<<< CHANGE THIS >>>>
oPrompts(7) = "SUBTEXT - LINE 3" '<<<< CHANGE THIS >>>>
oPrompts(8) = "SUBTEXT - LINE 4" '<<<< CHANGE THIS >>>>
oPrompts(9) = "SUBTEXT - LINE 5" '<<<< CHANGE THIS >>>>
oSheet.SketchedSymbols.Add(oSDEViewSSDef, oP2d, 0, 1, oPrompts)
End Select
Next
'Trigger this script by using iTrigger
trigger = iTrigger0