china-hz 发表于 2003-3-25 11:25:00

难道真的不行吗?

难道真的不能在R14中用 object.InsertBlock 方法插入图形文件吗?如果不行,能告诉我用什么方法可以插入呢?谢谢!!急!!

zxj_76 发表于 2003-3-26 18:23:00

如果当前图形没有你插入的块,你只有插入图形文件了。

即在插入的时候带上图形文件全名,如:
Set Temp = MoSpace.InsertBlock(Pnt, "块名", map_Scale, map_Scale, map_Scale, 0)
If Err.Number = -2147418113 Then
   Set Temp = MoSpace.InsertBlock(Pnt, App.Path & "\块名.Dwg", map_Scale, map_Scale, map_Scale, 0)
End If
其中Pnt为插入点坐标,map_Scale是插入比例,如果在R14中,只需要2个即可。

china-hz 发表于 2003-3-27 08:34:00

好象没有反应

用了你说的方法,但是程序执行后,R14元任何反应。但是其他的方法都可以实现,也未发现有错误提示。

zxj_76 发表于 2003-3-27 08:37:00

请保证外部DWG文件的存在

不会的,在R14中只需要带两个比例,即X、Y。在2000中插入块才有Z比例,一定行的,这是我常用的。另外你一定要保证这个外部DWG文件的存在。

china-hz 发表于 2003-3-27 08:38:00

key not found

Err.Description内容为key not found

zxj_76 发表于 2003-3-27 08:40:00

另外我的代码中的变量你一定要赋值的,坐标,比例,否则当然不洗了。

china-hz 发表于 2003-3-27 08:44:00

如下代码有问题吗?

Dim insertpt(0 To 2) As Double
    insertpt(0) = 9#
    insertpt(1) = 0#
    insertpt(2) = 0#
    Dim blockrefobj As Object
    Set blockrefobj = acadapp.ActiveDocument.ModelSpace. _
   InsertBlock(insertpt, "d:\abc.dwg", 1#, 1#, 0)
而且d:\abc.dwg是存在的,

china-hz 发表于 2003-3-27 14:33:00

帮助内容为:

Description

Inserts a named block that has been defined in the current drawing.
Inserting a block into another block will create nested blocks.
Note: This method does not have the same functionality as the INSERT command in AutoCAD. While the INSERT command takes a block or a file name, this method can only insert a block that exists in the current drawing.

Syntax

RetVal = object.InsertBlock(InsertionPoint, Name, Xscale, Yscale, Rotation)

Elements

InsertionPoint        Point (three-element array of Doubles); input-only
The location in the drawing to insert the block.
Name        String; input-only
The name of the block existing in the current drawing.
Xscale        Double; input-only; optional
Default equals 1.0. Must be a positive number.
Yscale        Double; input-only; optional
Default equals 1.0. Must be a positive number.
Rotation        Double; input-only; optional
Default equals 0.0 radians.

Return Value

RetVal        BlockRef object
The placed block as a Block Reference object

zxj_76 发表于 2004-2-20 11:08:00

Dim        insertpt(0        To        2)        As        Double<BR>                                insertpt(0)        =        9#<BR>                                insertpt(1)        =        0#<BR>                                insertpt(2)        =        0#<BR>                                Dim        blockrefobj        As        Object<BR>                                Set        blockrefobj        =        acadapp.ActiveDocument.ModelSpace.        _<BR>                        InsertBlock(insertpt,        "d:\abc.dwg",        1#,        1#,        0)                                       这一行错误,应改为


InsertBlock(insertpt,        "d:\abc.dwg",        1#,        1#)


<BR>
页: [1]
查看完整版本: 难道真的不行吗?