难道真的不行吗?
难道真的不能在R14中用 object.InsertBlock 方法插入图形文件吗?如果不行,能告诉我用什么方法可以插入呢?谢谢!!急!!如果当前图形没有你插入的块,你只有插入图形文件了。
即在插入的时候带上图形文件全名,如: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个即可。
好象没有反应
用了你说的方法,但是程序执行后,R14元任何反应。但是其他的方法都可以实现,也未发现有错误提示。请保证外部DWG文件的存在
不会的,在R14中只需要带两个比例,即X、Y。在2000中插入块才有Z比例,一定行的,这是我常用的。另外你一定要保证这个外部DWG文件的存在。key not found
Err.Description内容为key not found另外我的代码中的变量你一定要赋值的,坐标,比例,否则当然不洗了。
如下代码有问题吗?
Dim insertpt(0 To 2) As Doubleinsertpt(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是存在的,
帮助内容为:
DescriptionInserts 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 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]