到目前为止进展顺利。可以直到现在。谁能指出我的逻辑哪里错了,或者我的语法哪里坏了
- Option Explicit
- Dim pt As Variant
- Public Ab0 As Double
- Public Bb0 As Double
- Public Cb0 As Double
- Public abc As Double
- Public R As Integer
- Public X As Double
- Public Y As Double
- Dim ptstair As Variant
- Dim p As Variant
- Dim i As Integer
- Dim RR
- Dim PLP(0 To 2) As Double
- Dim plpoints
- Dim plp00 As Double
- Dim plp01 As Double
- Dim plp02 As Double
- Public Sub SelPoint()
- pt = ThisDrawing.Utility.GetPoint(, "Select Point:")
- MsgBox pt(0) & ";" & pt(1) & ";" & pt(2)
- Ab0 = pt(0)
- Bb0 = pt(1)
- Cb0 = pt(2)
- StrOpt.Show 'this calls the form StrOpt. Where I input the values for the rise, run, and number of risers.
- End Sub
- Public Sub makestair()
- R = StrOpt.textboxR 'This is the number of risers
- X = StrOpt.textboxX 'This is the Run of the riser
- Y = StrOpt.textboxY 'This is the Rise of the riser
- RR = (R * 2) + 1 ' This is the number of times the step needs to repeat. 4 Risers will require
- '9 points in the polyline
- ' You always have to do this with a collection before you can use it.
- Set p = New Collection
-
- ' i is equal to integers 1 thru RR,(number of points needed for polyline)
- For i = 1 To RR Step 1
- If i Mod 2 = 0 Then 'if i divided by 2 has a remainder of 0, an even number, then I would
- 'like for the following formula.
- plp00 = Ab0 + X * ((i - 2) / 2)
- plp01 = Bb0 + Y * (i / 2)
- plp02 = Cb0
- MsgBox plp00 & plp01 & plp02
-
- PLP(0) = plp00: PLP(1) = plp01: PLP(2) = plp02 ' here is where I would like to take the three values and
- 'and turn them back into a variant that will be used in the
- ' add polyline command.
- p.Add (PLP())
-
- Else 'if i divided by 2 has a remainder not equal to 0, odd number, then I
- 'would like the following formula.
- plp00 = Ab0 + X * ((i - 1) / 2)
- plp01 = Bb0 + Y * ((i - 1) / 2)
- plp02 = Cb0
- MsgBox plp00 & plp01 & plp02
-
- PLP(0) = plp00: PLP(1) = plp01: PLP(2) = plp02
- p.Add (PLP())
- End If
- Next i
- ' now I should have a collection of items that are variants.
- plpoints = p.Item(PLP(4))
- MsgBox plpoints
- End Sub
我知道我可以得到一个点并提取这三个变体。我该怎么做呢。使用三个数字并使其成为单个变量的变体
谢谢大家 |