找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 479|回复: 1

[求助]:关于getAcDbObjectId

[复制链接]
发表于 2005-9-6 18:53:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
Acad::ErrorStatus
getAcDbObjectId(
AcDbObjectId& retId,
bool createIfNotFound,
const AcDbHandle& objHandle,
Adesk::UInt32 xRefId = 0);

该函数的功能是已知实体句柄求实体ID,但我试验了下发觉它始终只返回eUnknownHandle,不知道哪位用过,介绍一下方法,谢谢!

抱歉,发错了,这个应该是ObjectArx的问题
不过将错就错,我想了解一下,VBA里类似功能的函数是什么,Lisp里似乎有个handenthandle函数功能和此类似。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2005-9-6 20:10:10 | 显示全部楼层

ThisDrawing.HandleToObject(handle)

借花献佛,这个例子是AutoCAD 自带的VBA帮助里的相关代码。

函数是:HandleToObject


''''''Start to show the code

<pre>

Sub Example_HandleToObject()
    ' This example creates a spline in model space, and returns the
    ' handle for the spline. Then the spline is returned from the handle and colored.
   
    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
   
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
   
    ZoomExtents
   
   
    ' Find the handle of the spline
    Dim handle As String
    handle = splineObj.handle
    MsgBox "The handle of the Spline is: " & splineObj.handle, , "HandleToObject Example"
        
    ' Find an object from a given handle
    Dim tempObj As AcadObject
    Set tempObj = ThisDrawing.HandleToObject(handle)[/COLOR]

    ' Now use the newly initialized object variable to color the object
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
    Call color.SetRGB(80, 100, 244)
   
    tempObj.TrueColor = color
   
    ThisDrawing.Regen True
    MsgBox "The Spline is now blue.", , "ObjectIDToObject Example"
   
End Sub
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-28 23:24 , Processed in 0.375073 second(s), 33 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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