05-26-2022
12:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-26-2022
12:40 PM
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.
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
Solved! Go to Solution.
05-26-2022
05:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-26-2022
05:29 PM
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
Or if this helped you, please, click (like)
Regards
Alan
05-27-2022
03:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-27-2022
03:41 AM
I get this error
"Error on Line 10 : Reference to a non-shared member requires an object reference."
"Error on Line 10 : Reference to a non-shared member requires an object reference."
05-27-2022
09:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-27-2022
09:29 AM
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?
oSymbol.SymbolClipping = True
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan
Or if this helped you, please, click (like)
Regards
Alan