明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 821|回复: 0

高手们帮帮忙吧

[复制链接]
发表于 2013-4-19 20:33:25 | 显示全部楼层 |阅读模式
Private Type muxian
xb As Long
yb As Long
zb As Long
xe As Long
ye As Long
ze As Long
End Type
Private Type bianyaqi
x1b As Long
y1b As Long
z1b As Long
x1e As Long
y1e As Long
z1e As Long
End Type
Sub bianyaqi()
Dim am() As muxian
Dim xy As Variant
Dim m1 As Integer
Dim entity As AcadBlockReference
For Each entity In ThisDrawing.ModelSpace
ReDim Preserve am(m1)
Call entity.GetXData("", xdatatype, xdatavalue)
strcode1 = xdatavalue(1)
If strcode1 = "母线" Then
xy = entity.InsertionPoint
MsgBox ("xy") & xy(0)
With am(m1)
.xb = xy(0)
.yb = xy(1)
.zb = xy(2)
.xe = xy(0) + 70
.ye = xy(1)
.ze = xy(2)
End With
MsgBox ("am(i)=") & am(0).xb
End If
m1 = m1 + 1

Next
Dim pt As Variant
pt = ThisDrawing.Utility.GetPoint(, "指定点:")
For i = 0 To m1
If pt(0) > am(i).xb - 40 And pt(0) < am(i).xe + 40 And pt(1) > am(i).yb - 40 And pt(1) < am(i).ye + 40 Then
If Sqr((am(i).xb - pt(0)) ^ 2 + (am(i).yb - pt(1)) ^ 2) > Sqr((am(i).xe - pt(0)) ^ 2 + (am(i).ye - pt(1)) ^ 2) Then
pt(0) = am(i).xe
pt(1) = am(i).ye
pt(2) = am(i).ze
Else
pt(0) = am(i).xb
pt(1) = am(i).yb
pt(2) = am(i).zb
End If
End If
Next
为什么在这个程序里,给结构体赋值不能成功呢???输出的值总是0,初学者,求指教!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 13:52 , Processed in 0.161624 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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