Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
mcarlton71
605 Views, 2 Replies

How to place sketched symbol and assign layer and leader style

I have ilogic code that will place sketched symbols in view windows at a defined position.  I am now trying to customize this for a specific sketched symbol that I want to assign a different "layer" and "leader style" to.  Cant seem to find a way to do this within the code i am using.  

 

from the "insert sketched symbol" menu, once I select my symbol I can then manually select the layer and style before dropping in my view. OR I have to do this task after the symbol is placed.   any assistance on what i might add to do this.  i have tried defining my oLayer and oLeader to the ones I want to use from the styles manager but cant figure out where to then use them when the sketched symbol is added.  thanks.

 

'AUTO TAG
'iLogic - select view and insert AUTO TAG

Dim oApp As Application: oApp = ThisApplication
Dim oDoc As DrawingDocument: oDoc = oApp.ActiveDocument
Dim oSheet As Sheet: oSheet = oDoc.ActiveSheet

'This uses a sketch symbol with the name "'View On' View Label"
Dim oSymDef As SketchedSymbolDefinition : oSymDef = oDoc.SketchedSymbolDefinitions.Item(“AUTO TAG")


'This is the selected view
Dim oView As DrawingView: oView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter,"Select View To Place Symbol:")

'This takes the label items of the selected view
'And adds it To an array that will link To the prompted entry
Dim sPromptStrings(4) As String
sPromptStrings(0) = "String 0"
sPromptStrings(1) = "String 1"
sPromptStrings(2) = "String 2"
sPromptStrings(3) = "String 3"
sPromptStrings(4) = "String 4"


'This is the position for the sketched symbol under the selected view'
Dim oPosition As Point2d: oPosition = oView.Center
'oPosition.Y = oPosition.Y - (oView.Height/1.90625)
'oPosition.X = oPosition.X - (oView.Width / 500)
oPosition.Y = oPosition.Y + (oView.Height/6)
oPosition.X = oPosition.X + (oView.Width/5)

'This inserts the sketched symbol and fills in the prompted entry.
Dim oSymbol As SketchedSymbol: oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition, , ,sPromptStrings)
'This will run promp