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

string of code to check the symbol clipping box

I have a code that will insert sketch symbol that works great, and now want to put a line of code in that will check the symbol clipping box or set it before inserting it.

nowellcolsenXK53F_0-1653593963371.png

 

Dim oApp As Application: oApp = ThisApplication
Dim oDoc As DrawingDocument: oDoc = oApp.ActiveDocument
Dim oSheet As Sheet : oSheet = oDoc.ActiveSheet
Dim oSketchedSymbol As SketchedSymbol 
			 
'assigns layer and leader
Dim oLayer = oDoc.StylesManager.Layers("Auto Tag")
Dim oLeader = oDoc.StylesManager.LeaderStyles("Auto Tag")

Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
Dim oSketchSymLib As SketchedSymbolDefinitionLibrary _
    = oDrawDoc.SketchedSymbolDefinitions.SketchedSymbolDefinitionLibraries.Item("Global Form Drawing Library")

Dim oSSDEf As SketchedSymbolDefinition _
    = oDrawDoc.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "AUTO TAG", True)


'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)
oSymbol.Layer = oLayer
oSymbol.LeaderStyle = oLeader