明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1358|回复: 2

请问如何把函数中绘制的一条多线段的名称传回来

[复制链接]
发表于 2007-5-31 16:47:00 | 显示全部楼层 |阅读模式

我调用了Draw_Box_Center绘制了一条多线段,我想在函数外中使用该多线段,比如说调用该多线段的的Coordinate属性。

我的代码如下,运行时出现“参数不可选”的错误提示

 Call Draw_Box_Center("body_back_1", "Body_Layer", start_center_point_X, start_center_point_Y, L1, H1)
       
    Dim point1(0 To 1) As Double 
    point1(0) = Draw_Box_Center.Coordinate(0)(0)
    point1(1) = Draw_Box_Center.Coordinate(0)(1)

Public Function Draw_Box_Center(box_name, layer_name, center_point_X, center_point_Y, box_long, box_width)
' Define the 2D polyline points
    Dim first_point_X As Double
    Dim first_point_Y As Double
   
   
    Dim points(0 To 9) As Double
   
    first_point_X = center_point_X - box_long / 2
    first_point_Y = center_point_Y - box_width / 2
   
    points(0) = first_point_X: points(1) = first_point_Y
    points(2) = first_point_X + box_long: points(3) = first_point_Y
    points(4) = first_point_X + box_long: points(5) = first_point_Y + box_width
    points(6) = first_point_X: points(7) = first_point_Y + box_width
    points(8) = first_point_X: points(9) = first_point_Y
   
     ' Create a lightweight Polyline object in model space
    Set box_name = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)


    Draw_Box_Center = box_name
   
    ' Set the layer of new circle to "ABC"
    box_name.layer = layer_name

End Function

发表于 2007-6-2 09:01:00 | 显示全部楼层

Public Function Draw_Box_Center(box_name, layer_name, center_point_X, center_point_Y, box_long, box_width) as string

Draw_Box_Center=box_name.objecthandle

end function

 楼主| 发表于 2007-6-2 12:00:00 | 显示全部楼层
sealive发表于2007-6-2 9:01:00Public Function Draw_Box_Center(box_name, layer_name, center_point_X, center_point_Y, box_long, box_width) as stringDraw_Box_Center=box_name.objecthandleend function

THANKS A LOT!!!

我用另一种方法实现了,

谢谢你的回答~~

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

本版积分规则

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

GMT+8, 2025-2-22 18:39 , Processed in 0.187307 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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