Message 1 of 4
Sorting symbols - existing values

Not applicable
10-15-2018
11:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm wondering if there is a way to automatically sorting sketch symbols into views using iLogic? I would like to create 2 criteria: Checks if there is a value in the symbol, if so it moves the symbol; eg. A1
So, and If A1 is inserted then the next one does not move to the same place as A1 only for the next 38mm.
This is my code:
Dim oDoc As Document oDoc = ThisApplication.ActiveDocument Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument Dim oSheet As Sheet = oDrawDoc.ActiveSheet '----------------- X Dim x1 As Double x1 = 7.6 Dim x2 As Double x2 = 15.2 '----------------- Y Dim y1 As Double y1 = 0 Dim y2 As Double y2 = 7.6 'find the symbol by name For Each oSymbol In oDoc.ActiveSheet.SketchedSymbols If oSymbol.Name = "A1" Then 'find the text box by name/label For Each oTextBox In oSymbol.Definition.Sketch.Textboxes If oTextBox.Text = "A1" Then oString = oSymbol.GetResultText(oTextBox) End If Next If oString = "" Then Else '------ For Each oSketchedSymbol As SketchedSymbol In oSheet.SketchedSymbols If oSketchedSymbol.Name = "A1" Then Dim oPoint As Point2d = oSketchedSymbol.Position Select Case oSheet.Size Case DrawingSheetSizeEnum.k24x36InDrawingSheetSize oPoint.X = 0 oPoint.Y = 0 Case DrawingSheetSizeEnum.k18x24InDrawingSheetSize oPoint.X = 0 oPoint.Y = 0 Case Else oPoint.X += x1 oPoint.Y += y1 End Select If Not oPoint Is Nothing Then oSketchedSymbol.Position = oPoint End If End If Next '------ End If End If Next '================================================= For Each oSymbol In oDoc.ActiveSheet.SketchedSymbols If oSymbol.Name = "A2" Then 'find the text box by name/label For Each oTextBox In oSymbol.Definition.Sketch.Textboxes If oTextBox.Text = "A2" Then oString = oSymbol.GetResultText(oTextBox) End If Next If oString = "" Then Else '----- For Each oSketchedSymbol As SketchedSymbol In oSheet.SketchedSymbols If oSketchedSymbol.Name = "A2" Then Dim oPoint As Point2d = oSketchedSymbol.Position Select Case oSheet.Size Case DrawingSheetSizeEnum.k24x36InDrawingSheetSize oPoint.X = 0 oPoint.Y = 0 Case DrawingSheetSizeEnum.k18x24InDrawingSheetSize oPoint.X = 0 oPoint.Y = 0 Case Else oPoint.X += x1 oPoint.Y += y1 End Select If Not oPoint Is Nothing Then oSketchedSymbol.Position = oPoint End If End If Next '----- End If End If Next '================================================= For Each oSymbol In oDoc.ActiveSheet.SketchedSymbols If oSymbol.Name = "B1" Then 'find the text box by name/label For Each oTextBox In oSymbol.Definition.Sketch.Textboxes If oTextBox.Text = "B1" Then oString = oSymbol.GetResultText(oTextBox) End If Next If oString = "" Then Else '----- For Each oSketchedSymbol As SketchedSymbol In oSheet.SketchedSymbols If oSketchedSymbol.Name = "B1" Then Dim oPoint As Point2d = oSketchedSymbol.Position Select Case oSheet.Size Case DrawingSheetSizeEnum.k24x36InDrawingSheetSize oPoint.X = 0 oPoint.Y = 0 Case DrawingSheetSizeEnum.k18x24InDrawingSheetSize oPoint.X = 0 oPoint.Y = 0 Case Else oPoint.X += x1 oPoint.Y += y1 End Select If Not oPoint Is Nothing Then oSketchedSymbol.Position = oPoint End If End If Next '----- End If End If Next
And my sheet:
Thanks in advance
David