![]() |
Adding to a Collection
Kind of Complicated But:
I have a collection of areas of type areaClass. The areaClass has a collection of points of type PolyPoint as a property. I am trying to add points to certain objects in the areaClass which can only be identified by their key property. As you can see from the following code that there can be multiple objects of quad1. I am trying to add points pts1.x and pts1.y to quad1 key "1". If it is possible to add per a reference number that would be fine also I just need to keep track of which points are applied to which areas. I appreciate any help on this!! Dim tri1 As New AreaClass tri1.Shape = tri tri1.Key = CStr(areakeynum) areas.Add tri1.Shape, tri1.Key areakeynum = areakeynum + 1 For i = 1 To TierNum - 1 If i = 0 Then i = 1 End If Dim quad1 As New AreaClass quad1.Shape = quad quad1.Key = CStr(areakeynum) 'Quantity of Identical roof areas includes the area just created quad1.QuantityIdentical = 4 quad1.QuantityMirror = 0 areas.Add quad1.Shape, quad1.Key areakeynum = areakeynum + 1 Next i For j = 1 To TierNum TierScale = Sheets("Defaults").Cells(223 + TierNum, 2 + j).Value rad = radius * TierScale For i = 3 * sideNum * j - (3 * sideNum - 1) To 3 * sideNum * j - 2 Step 3 wsPlot.Cells(i, 1).Value = 0 wsPlot.Cells(i, 2).Value = 0 Next i z = sideNum * (j - 1) For i = 3 * sideNum * j - (3 * sideNum - 2) To 3 * sideNum * j - 1 Step 3 wsPlot.Cells(i, 1).Value = rad * Cos(0.5 * (i + z) * theta) wsPlot.Cells(i, 2).Value = rad * Sin(0.5 * (i + z) * theta) wsPlot.Cells(i + 1, 1).Value = rad * Cos((0.5 * (i + z) + 2) * theta) wsPlot.Cells(i + 1, 2).Value = rad * Sin((0.5 * (i + z) + 2) * theta) If TierNum 1 Then For P = 1 To 4 If i = 3 * sideNum * j - (3 * sideNum - 2) Then Dim pts1 As New PolyPoint pts1.x = rad * Sin(0.5 * (i + z) * theta) pts1.y = 0 pts1.Key = P 'PROBLEM AREA<<<<<<<<<<<< End If Next P End If z = z + 1 Next i Next j |
All times are GMT +1. The time now is 02:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com