- 积分
- 1414
- 明经币
- 个
- 注册时间
- 2009-1-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
"aa|Mirr0|X600Y30ArrayX3Y4"主要是简化Array输入的一大堆数据.
采用split,将上面数据进行数组转换.程序如下.
- Sub ls1()
- aa = "aa|Mirr0|X600Y30ArrayX3Y4"
- ss = Split(aa, "|")
-
- Dim xDist, yDist, numberOfRows, numberOfColumns
- Dim Pt1(2) As Double, Pt2(2) As Double
- Dim objLine As AcadLine, Ent As AcadEntity
- Pt1(0) = 0: Pt1(1) = 10
- Pt2(0) = 400: Pt2(1) = 10
- Set objLine = ThisDrawing.ModelSpace.AddLine(Pt1, Pt2)
- Dim xCopyPt(2) As Double, basePt(2) As Double
- For ii = 0 To UBound(ss)
- Debug.Print ss(ii)
- If InStr(ss(ii), "Array") > 0 Then
- bb = Split(ss(ii), "Array")
-
- bbb = Split(bb(0), "Y")
- xDist = Val(Mid(bbb(0), 2))
- yDist = Val(bbb(1))
- bbb = Split(bb(1), "Y")
- numberOfColumns = Val(Mid(bbb(0), 2))
- numberOfRows = Val(bbb(1))
- Dim retObj As Variant
- retObj = objLine.ArrayRectangular(numberOfRows, numberOfColumns, 1, yDist, xDist, 1)
-
-
-
- End If
- Next ii
- End Sub
|
|