找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1135|回复: 1

[日积月累]:call调用创建实体子程序,怎么返回实体句柄

[复制链接]
发表于 2005-9-13 16:03:24 | 显示全部楼层 |阅读模式

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

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

×
Function 创建donut()
    ' This example creates a lightweight polyline in model space.
    ' It then finds and changes the bulge for a given segment.
   
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
   
    ' Define the 2D polyline points
    points(0) = -0.009: points(1) = 0
    points(2) = 0.009: points(3) = 0
    points(4) = -0.009: points(5) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.SetBulge 0, -1: plineObj.Update
    plineObj.SetBulge 1, -1: plineObj.Update
    plineObj.ConstantWidth = 0.018
End Function
Sub test1()
Dim plineObj As AcadLWPolyline
On Error Resume Next
plineObj = 创建donut()

End Sub
子程调用出错,请大侠看看
另call调用创建实体子程序,怎么返回实体句柄
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2005-9-13 18:49:49 | 显示全部楼层
我的电脑上没装ACAD,这样改不知行不行

Function 创建donut(rObj)
Dim plineObj As AcadLWPolyline
Dim points(0 To 5) As Double

' Define the 2D polyline points
points(0) = -0.009: points(1) = 0
points(2) = 0.009: points(3) = 0
points(4) = -0.009: points(5) = 0
Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
plineObj.SetBulge 0, -1: plineObj.Update
plineObj.SetBulge 1, -1: plineObj.Update
plineObj.ConstantWidth = 0.018
'下行是关键
set rObj=plineObj
End Function

Sub test1()
Dim plineObj As AcadLWPolyline
On Error Resume Next
call 创建donut(plineObj)
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-1 22:45 , Processed in 0.406553 second(s), 33 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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