streng Posted December 17, 2009 Posted December 17, 2009 Hi Hope someone can help. I have created a selection set grouping attributed blocks and storing the data in an array. I am struck trying to achieve two things, namely: 1. The layer that textstring(0) resides 2. The colour settings of this textstring These values both appear in the attributes editor but I need these in my userform in order to edit further down the line. Hope someone can help and hope I explained my problem sufficiently. My code so far is Option Explicit Dim intCode(1) As Integer Dim varData(1) As Variant Dim elem As AcadEntity Dim Array1 As Variant Dim aCount As Long Dim RefNum As Long Dim RefEdit() As String Dim iNo As Integer Dim TotalRef As Long Dim x As Long Dim PrefixArray() As String Dim i As Long Dim count As Long Dim IsItThere As Boolean Dim MyLayer As AcadLayer Private Sub UserForm_Initialize() 'Gathers together all reference blocks intCode(0) = 0: varData(0) = "Insert" intCode(1) = 2: varData(1) = "REF1_50" TotalRef = AllSS(intCode, varData) ReDim RefEdit(0 To TotalRef, 0 To 6) For Each elem In ThisDrawing.SelectionSets.Item("TempSSet") 'Using IsItThere to eliminate duplicates from end result - This creates a new 2d array called prefixarray IsItThere = False Array1 = elem.GetAttributes RefEdit(x, 0) = (Array1(0).TextString) RefEdit(x, 1) = (Array1(1).TextString) RefEdit(x, 2) = (Array1(2).TextString) RefEdit(x, 3) = elem.Layer [color=red]'RefEdit(x,4) = layer of textstring0 within elem block[/color] [color=red] 'RefEdit(x,5) = colour of textstring0 within elem block[/color] Next elem End Sub Sub SSClear() Dim SSS As AcadSelectionSets On Error Resume Next Set SSS = ThisDrawing.SelectionSets If SSS.count > 0 Then SSS.Item("TempSSet").Delete End If End Sub Function AllSS(Optional grpCode As Variant, Optional dataVal As Variant) As Integer Dim TempObjSS As AcadSelectionSet SSClear Set TempObjSS = ThisDrawing.SelectionSets.Add("TempSSet") 'pick selection set If IsMissing(grpCode) Then TempObjSS.Select acSelectionSetAll Else TempObjSS.Select acSelectionSetAll, , , grpCode, dataVal End If AllSS = TempObjSS.count End Function Quote
streng Posted December 17, 2009 Author Posted December 17, 2009 Have sorted it Easy when you know how, should have thought of this first !! RefEdit(x, 4) = (Array1(0).Layer) RefEdit(x, 5) = (Array1(0).color) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.