明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2646|回复: 2

[求助] 一个SetXData的错误

[复制链接]
发表于 2007-9-24 23:04:00 | 显示全部楼层 |阅读模式

各位大师,

小弟的代码在SetXData时发生了如下错误:“运行时错误'-2147352567(80020009)':方法‘’SetXData”作用于‘IAcadLine’时失败”

能给帮忙解决一下吗?

这厢有礼了

Dim Spoint As Variant
    Dim Epoint As Variant
    Dim objline As AcadLine
   
    rmd1 = "输入起点"
    rmd2 = "输入终点"
   
    Spoint = ThisDrawing.Utility.GetPoint(, rmd1)
    Epoint = ThisDrawing.Utility.GetPoint(Spoint, rmd2)
   
    Set objline = ThisDrawing.ModelSpace.AddLine(Spoint, Epoint)
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim mchjigg As String
    Dim dengji As String
    Dim jshtj As String
    Dim gdh As String
    Dim XDType(0 To 4) As Integer
    Dim XData(0 To 4) As Variant
   
    XDType(0) = 1001
    XData(0) = "waibu"
    XDType(1) = 1000
    XData(1) = "AA"    

XDType(2) = 1003
    XData(2) = "BB"    

XDType(3) = 1004
    XData(3) = "cc" 
    XDType(4) = 1005
    XData(4) = "DD"     
    objline.SetXData XDType, XData
   

发表于 2007-9-25 05:08:00 | 显示全部楼层

帮助文件!

Organization of Extended Data

 
 
 

Extended data consists of one or more 1001 groups, each of which begins with a unique application name. The xdata groups returned by entget follow the definition data in the order in which they are saved in the database.

Within each application's group, the contents, meaning, and organization of the data are defined by the application. AutoCAD maintains the information but does not use it. The table also shows that the group codes for xdata are in the range 1000-1071. Many of these group codes are for familiar data types, as follows:

String

1000. Strings in extended data can be up to 255 bytes long (with the 256th byte reserved for the null character).

Application Name

1001 (also a string value). Application names can be up to 31 bytes long (the 32nd byte is reserved for the null character) and must adhere to the rules for symbol table names (such as layer names). An application name can contain letters, digits, and the special characters $ (dollar sign), - (hyphen), and _ (underscore). It cannot contain spaces.

Layer Name

1003. Name of a layer associated with the xdata.

Database -Handle

1005. Handle of an entity in the drawing database.

3D Point

1010. Three real values, contained in a point.

Real

1040. A real value.

Integer

1070. A 16-bit integer (signed or unsigned).

Long

1071. A 32-bit signed (long) integer. If the value that appears in a 1071 group is a short integer or real value, it is converted to a long integer; if it is invalid (for example, a string), it is converted to a long zero (0L).

NoteAutoLISP manages 1071 groups as real values. If you use entget to retrieve an entity's definition list that contains a 1071 group, the value is returned as a real, as shown in the following example:

(1071 . 12.0)

If you want to create a 1071 group in an entity with entmake or entmod, you can use either a real or an integer value, as shown in the following example:

(entmake '((..... (1071 . 12) .... )))

(entmake '((..... (1071 . 12.0) .... )))

(entmake '((..... (1071 . 65537.0) .... )))

(entmake '((..... (1071 . 65537) .... )))

But AutoLISP still returns the group value as a real:

(entmake '((..... (1071 . 65537) .... )))

The preceding statement returns the following:

(1071 . 65537.0)

ObjectARX always manages 1071 groups as long integers.

Several other extended data groups have special meanings in this context (if the application chooses to use them):

Control String

1002. An xdata control string can be either "{" or "}". These braces enable the application to organize its data by subdividing it into lists. The left brace begins a list, and the right brace terminates the most recent list. Lists can be nested.

NoteIf a 1001 group appears within a list, it is treated as a string and does not begin a new application group.
Binary Data

1004. Binary data that is organized into variable-length chunks, which can be handled in ObjectARX with the ads_binary structure. The maximum length of each chunk is 127 bytes.

NoteAutoLISP cannot directly handle binary chunks, so the same precautions that apply to long (1071) groups apply to binary groups as well.
World Space Position

1011. Unlike a simple 3D point, the WCS coordinates are moved, scaled, rotated, and mirrored along with the parent entity to which the extended data belongs. The WCS position is also stretched when the STRETCH command is applied to the parent entity and when this point lies within the select window.

World Space -Displacement

1012. A 3D point that is scaled, rotated, or mirrored along with the parent, but not stretched or moved.

World -Direction

1013. A 3D point that is rotated or mirrored along with the parent, but not scaled, stretched, or moved. The WCS direction is a normalized displacement that always has a unit length.

Distance

1041. A real value that is scaled along with the parent entity.

Scale Factor

1042. Also a real value that is scaled along with the parent.

The DXF group codes for xdata are also described in the DXF Reference.

 楼主| 发表于 2007-9-25 22:20:00 | 显示全部楼层
明白了,非常感谢帮助。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 12:49 , Processed in 0.174401 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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