明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1564|回复: 1

插入图块出错[求助]

[复制链接]
发表于 2003-3-30 17:16:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2003-3-30 17:16:04 编辑

您好:
我想将图形组意图快的形式插入,但试了几次都报错
现写了一个简化的代码(画个圆然后以图块形式插入)
Public leoblock As AcadBlock
   
Public Sub leopump()
    Dim leocircle As AcadCircle
    Dim centerp(0 To 2) As Double
    Dim leoblockref As AcadBlockReference
    Dim insertp
'画圆
    centerp(0) = 0
    centerp(1) = 0
    centerp(2) = 0
    Set leocircle = leoblock.AddCircle(centerp, 10)
   
'图形生成
    ThisDrawing.Regen acActiveViewport

'插入图块
    insertp = ThisDrawing.Utility.GetPoint(, "输入插入点:")
    Set leoblockref = ThisDrawing.ModelSpace.InsertBlock_
                                 (insertp, "leopump", 1, 1, 1, 0)
End Sub
始终抱错,找了一小时也查不出
发表于 2003-3-31 08:40:00 | 显示全部楼层

看看sample

Sub Example_InsertBlock()
    ' This example creates a block containing a circle.
    ' It then inserts the block.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")
   
    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)
   
    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
   
    ZoomAll
   
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 20:43 , Processed in 0.162193 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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