baneit319 发表于 2015-9-22 22:15:47

想在一个块中画封闭线,在封闭属性上运行出错

想在一个块中画封闭线,在封闭属性上运行出错,具体如下:

Sub kk()
Dim basep(0 To 2) As Double '块基点
Dim blockunit As AcadBlock
Dim pnts(0 To 7) As Double

basep(0) = 0
basep(1) = 0
Set blockunit = ThisDrawing.Blocks.Add(basep, "Unit")
pnts(0) = 0: pnts(1) = 0
   pnts(2) = 0: pnts(3) = 100
   pnts(4) = 100: pnts(5) = 100
   pnts(6) = 100: pnts(7) = 0

Call blockunit.AddLightWeightPolyline(pnts)
    blockunit.Closed = True    ‘’‘调试发现封闭在块中不能这么用,运行出错,改成AddLightWeightPolyline(pnts).Closed = True也不行,,这里求指教,谢谢!
End Sub

zzyong00 发表于 2015-9-22 23:11:14

Sub kk()
Dim basep(0 To 2) As Double '块基点
Dim blockunit As AcadBlock
Dim pnts(0 To 7) As Double

basep(0) = 0
basep(1) = 0
Set blockunit = ThisDrawing.Blocks.Add(basep, "Unit")
pnts(0) = 0: pnts(1) = 0
   pnts(2) = 0: pnts(3) = 100
   pnts(4) = 100: pnts(5) = 100
   pnts(6) = 100: pnts(7) = 0
Dim objPl As AcadLWPolyline
Set objPl = blockunit.AddLightWeightPolyline(pnts)
    objPl.Closed = True
End Sub

baneit319 发表于 2015-9-29 16:01:51

zzyong00 发表于 2015-9-22 23:11 static/image/common/back.gif
Sub kk()
Dim basep(0 To 2) As Double '块基点
Dim blockunit As AcadBlock


谢谢老大,搞定了^_^

baneit319 发表于 2015-9-29 17:53:09

本帖最后由 baneit319 于 2015-10-1 22:42 编辑

zzyong00 发表于 2015-9-22 23:11 static/image/common/back.gif
Sub kk()
Dim basep(0 To 2) As Double '块基点
Dim blockunit As AcadBlock


谢谢!
页: [1]
查看完整版本: 想在一个块中画封闭线,在封闭属性上运行出错