田草博客

互联网田草博客


网友交流QQ群:11740834 需注明申请加入原因

微信 公众号:ByCAD

邮箱:tiancao1001x126.com
ByCAD,微信公众号
首页 | 普通 | 电脑 | AutoCAD | VB/VB.NET | FLash | 结构 | 建筑 | 电影 | BIM | 规范 | 软件 | ID
-随机-|-分布-
-博客论坛-|-﨣﨤﨧﨨-
-网站导航-|-规范下载-
-BelovedFLash欣赏-

用户登陆
用户:
密码:
 

站点日历
73 2024 - 5 48
   1234
567891011
12131415161718
19202122232425
262728293031


站点统计

最新评论



第五代导演的领军人物 陈凯歌 自动点击器(ie窗体成为其子窗体)
未知 自动选筋程序   [ 日期:2008-07-31 ]   [ 来自:本站原创 ]  HTML
Function XuanJin(MinD As Integer, MaxD As Integer, Area As Long) As String
    MsgBox "你给的钢筋 面积是" & Area
    MsgBox "选筋的最小直径" & MinD
    MsgBox "选筋的最大直径" & MaxD
    Dim MinDArea As Long
    MinDArea= MinD ^ 2 * 3.14 / 4 ' 最小直径钢筋单根面积
    Dim n As Integer
    n = Fix(Area / MinDArea) '需要最小直径钢筋的根数
    Dim i As Integer
    Dim j As Integer
    Dim m As Integer
    Dim L As Integer
    Dim tempArea As Long
    Dim WuCha As Integer
    Dim MinWuCha As Integer
    MinWuCha = 100
    '优先选用小直径钢筋
    If n < 2 Then
       XuanJin = "2D" & MinD '两根最小直径钢筋已经满足
    Else
        '4层循环嵌套(两种钢筋直径和各自的根数循环)
        For i = MinD To MaxD
            If isInArray(i) = True Then
                For j = 1 To n
                    For m = MinD To MaxD
                        For L = 1 To n
                            If isInArray(m) = True Then
                                tempArea = j * i ^ 2 * 3.14 / 4 + L * m ^ 2 * 3.14 / 4 '所选钢筋面积
                                WuCha = Abs(tempArea - Area) / Area * 100 '钢筋面积误差
                                If MinWuCha > WuCha Then '误差小于最小误差
                                    MinWuCha = WuCha '最小误差则等于该误差
                                    '记录误差偏小时所选用的钢筋
                                    If i = m Then '所选的钢筋同直径
                                        XuanJin = (j + L) & "D" & i
                                    Else '所选钢筋有两种直径
                                        XuanJin = j & "D" & i & "+" & L & "D" & m
                                    End If
                                End If
                            End If
                        Next L
                    Next m
                Next j
            End If
        Next i
    End If
End Function
Sub xuanjian()
    Dim Jin As String
    Jin = XuanJin(16, 25, 180)
    MsgBox Jin
End Sub
'判断是否是有效的钢筋直径
Function isInArray(d As Integer) As Boolean
    isInArray = False
    Dim Ds As Variant
    Ds = Array(4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 30, 32, 36, 40)
    Dim i As Integer
    For i = 0 To 15
        If Ds(i) = d Then isInArray = True
    Next
End Function

'板选筋
Function xuanjin2(MinD As Integer, MaxD As Integer, MinJianJu As Integer, MaxJianJu As Integer, Area As Long) As String
    Dim MinDArea As Long
    MinDArea = MinD ^ 2 * 3.14 / 4 ' 最小直径钢筋单根面积
    Dim MaxDArea As Long
    MaxDArea = MaxD ^ 2 * 3.14 / 4 ' 最大直径钢筋单根面积
    If MaxDArea * 1000 / MinJianJu < Area Then '最大直径钢筋和最小钢筋间距都不能满足要求
       xuanjin2 = 0
    End If
    
    Dim N As Double
    
    Dim i As Integer
    Dim j As Integer

    Dim tempArea As Long
    Dim WuCha As Integer
    Dim MinWuCha As Integer
    MinWuCha = 100

    For i = MinD To MaxD
        If isInArray(i) = True Then
            For j = MinJianJu To MaxJianJu Step 10
                N = 1000 / j
                tempArea = N * i ^ 2 * 3.14 / 4 '所选钢筋面积
                WuCha = Abs(tempArea - Area) / Area * 100 '钢筋面积误差
                If MinWuCha > WuCha Then '误差小于最小误差
                    MinWuCha = WuCha '最小误差则等于该误差
                    '记录误差偏小时所选用的钢筋
                    xuanjin2 = i & "@" & j
                End If
                
            Next j
        End If
    Next i
End Function


[本日志由 tiancao1001 于 2008-09-23 02:33 PM 编辑]


引用这个评论 田草 于 2008-07-31 09:52 PM 发表评论: 
按此在新窗口打开图片 

发表评论 - 不要忘了输入验证码哦!
作者: 用户:  密码:   注册? 验证:  防止恶意留言请输入问题答案:1*3=?  
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字

字体样式 文字大小 文字颜色
插入粗体文本 插入斜体文本 插入下划线
左对齐 居中对齐 右对齐
插入超级链接 插入邮件地址 插入图像
插入 Flash 插入代码 插入引用
插入列表 插入音频文件 插入视频文件
插入缩进符合
点击下载按钮 下标 上标
水平线 简介分割标记
表  情
 
Tiancao Blog All Rights Reserved 田草博客 版权所有
Copyright ©