Message 1 of 2

Not applicable
05-17-2018
08:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need a way to check if a symbol is already in a drawing before running this following code that inserts a symbol
SyntaxEditor Code Snippet
' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument ' Obtain a reference to the desired sketched symbol definition. Dim oSketchedSymbolDef As SketchedSymbolDefinition = oDrawDoc.SketchedSymbolDefinitions.Item("MATERIAL") Dim oSheet As Sheet = oDrawDoc.ActiveSheet ' This sketched symbol definition contains one prompted string input. An array ' must be input that contains the strings for the prompted strings. Dim oPromptStrings As String() = {iProperties.Value("Project", "STOCK NUMBER"),""} Dim oBorder As Border oBorder = oSheet.Border Dim oPlacePoint As Point2d oyOffset = 7 'user defined offset oxOffset = 9 oX = oBorder.RangeBox.MaxPoint.X - oxOffset oY = oBorder.RangeBox.MinPoint.Y + oyOffset oPlacePoint = ThisApplication.TransientGeometry.CreatePoint2d(oX,oY) ' Add an instance of the sketched symbol definition to the sheet. ' Rotate the instance by 45 degrees and scale by .75 when adding. ' The symbol will be inserted at (0,0) on the sheet. Since the ' start point of the line was marked as the insertion point, the ' start point should end up at (0,0). Dim oSketchedSymbol As SketchedSymbol = oSheet.SketchedSymbols.Add(oSketchedSymbolDef, oPlacePoint, (0), 1,oPromptStrings )
.
Solved! Go to Solution.