明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1316|回复: 0

求助

[复制链接]
发表于 2005-12-24 22:06:00 | 显示全部楼层 |阅读模式

请教各位老大:

哪位能看一下下面的程序:为何我不能将定义好的块,插到指定点

Private Sub Command1_Click()
On Error Resume Next
    Dim acadApp As AcadApplication
    Set acadApp = GetObject(, "AutoCAD.Application")
    If Err Then
        Err.Clear
        Set acadApp = CreateObject("AutoCAD.Application")
        If Err Then
            MsgBox Err.Description
            Exit Sub
        End If
    End If

Dim blockobj05 As AcadBlock

   Dim insertionpnt05(0 To 2) As Double
   insertionpnt05(0) = 2136.8: insertionpnt05(1) = 1389.8: insertionpnt05(2) = 0#
   Set blockobj05 = acaddocc.Blocks.Add(insertionpnt05, "qblock") '创建块
   '向块中添加直线、多义线
  Dim linobj As AcadLine
    Dim stp130(0 To 2) As Double
 Dim enp130(0 To 2) As Double
  stp130(0) = 20: stp130(1) = 20: stp130(2) = 0#
 enp130(0) = 50: enp130(1) = 50: enp130(2) = 0#
Set linobj = blockobj.AddLine(stp130, enp130)
 
 Dim Pll39obj As AcadLWPolyline
 Dim points139(0 To 5) As Double
 points139(0) = 10: points139(1) = 18
 points139(2) = 30: points139(3) = 47
 points139(4) = 60: points139(5) = 75
 Set Pl139obj = acaddoc.ModelSpace.AddLightWeightPolyline(points139)
 l139obj.Closed = ture
 Set Pll39obj = blockobj.AddLightWeightPolyline(points139)
  Dim Pl140obj As AcadLWPolyline
 Dim points140(0 To 5) As Double
 points140(0) = 41: points140(1) = 64
 points140(2) = 38: points140(3) = 52
 points140(4) = 25: points140(5) = 100
 Set Pl140obj = acaddoc.ModelSpace.AddLightWeightPolyline(points140)
 l140obj.Closed = ture
 Set Pll40obj = blockobj.AddLightWeightPolyline(points140)
 
 Dim blockRefobj As AcadBlockReference
 '''''''''''''''''''''''插入快
 Dim insertionpnt(0 To 2) As Double
 insertionpnt05(0) = 200: insertionpnt05(1) = 200: insertionpnt05(2) = 0#
 Set blockRefobj = acadApp.ActiveDocument.ModelSpace.InsertBlock(insertionpnt05, "qblock", 1#, 1#, 1#, 0) '插入块
 
 
     ZoomExtents
    acadApp.Visible = True
End Sub

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 08:44 , Processed in 0.172613 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表