string of code to check the symbol clipping box

string of code to check the symbol clipping box

nowell.colsenXK53F
Enthusiast Enthusiast
403 Views
3 Replies
Message 1 of 4

string of code to check the symbol clipping box

nowell.colsenXK53F
Enthusiast
Enthusiast

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

 

0 Likes
Accepted solutions (3)
404 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor
Accepted solution

This should do it. Source is the API help and search  sketched symbol object

Syntax

SketchedSymbol.SymbolClipping() As Boolean

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 4

nowell.colsenXK53F
Enthusiast
Enthusiast
Accepted solution
I get this error
"Error on Line 10 : Reference to a non-shared member requires an object reference."
0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor
Accepted solution

The error message suggest you have an object not correctly referenced. Did you by chance place the symbol clipping snippet directly into the code as is without referencing the object? 

 

AAcheson_0-1653668822302.png

 

oSymbol.SymbolClipping = True

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes