田草博客

互联网田草博客


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

微信 公众号:ByCAD

邮箱:tiancao1001x126.com
ByCAD,微信公众号
首页 | 普通 | 电脑 | AutoCAD | VB/VB.NET | FLash | 结构 | 建筑 | 电影 | BIM | 规范 | 软件 | ID

评论列表

所有评论
[80] [81] [82] [83] [84] [85] [86] [87] [88] [89]  ... [144]  
tiancao1001 于 2009-02-22 11:25 PM 发表评论:
Sub XXX()
   On Error GoTo ErrControl
    
    Dim SSet As AcadSelectionSet
    Set SSet = CreateSelectionSet("XXX")
    Dim fType, fData
    BuildFilter fType, fData, 0, "LWPolyline"
    
    '选择矩形
    SSet.SelectOnScreen fType, fData
    
    Dim PL As AcadLWPolyline
    Dim New_Pl  As Variant
    Dim Pmin As Variant
    Dim Pmax As Variant
    Dim L As Double
    Dim H As Double
    For Each PL In SSet
        '偏移矩形
        New_Pl = PL.offset(100)
        '偏移后的矩形角点
        New_Pl(0).GetBoundingBox Pmin, Pmax
        L = Pmin(0) - Pmax(0) '矩形长
        H = Pmax(1) - Pmax(1) '矩形宽
        '在矩形内部写上 长x宽
        TxtHatch Format(L, "0.00") & "x" & Format(H, "0.00"), Pmin, Pmax, 0
        PL.Delete
    Next
ErrControl:

End Sub
Public Function TxtHatch(ByVal Str As String, ByVal P1 As Variant, P2 As Variant, a As Double) As AcadText
    Dim Txt As AcadText
    Dim TxtH As Double
    Dim TxtL As Double
    Dim RecL As Double
    Dim RecH  As Double
    Dim Center1(2) As Double
    Dim Pmin As Variant, Pmax As Variant
    If Abs(P1(0) - P2(0)) = 0 Or Abs(P1(1) - P2(1)) = 0 Then Exit Function
    If a = 0 Then
        RecL = Abs(P1(0) - P2(0))
        RecH = Abs(P1(1) - P2(1))
    Else
        RecL = Abs(P1(1) - P2(1))
        RecH = Abs(P1(0) - P2(0))
    End If
    Center1(0) = (P1(0) + P2(0)) / 2
    Center1(1) = (P1(1) + P2(1)) / 2
    Center1(2) = (P1(2) + P2(2)) / 2
    Set Txt = ThisDrawing.ModelSpace.AddText(Str, Point3D(0, 0, 0), 2.5)
    Txt.GetBoundingBox Pmin, Pmax
    TxtL = Abs(Pmin(0) - Pmax(0))
    TxtH = Abs(Pmin(1) - Pmax(1))
    If RecL / TxtL <= RecH / TxtH Then
        Txt.ScaleEntity Pmin, RecL / TxtL
    Else
        Txt.ScaleEntity Pmin, RecH / TxtH
    End If
    Txt.Alignment = acAlignmentMiddleCenter
    Txt.Move Txt.TextAlignmentPoint, Center1
    Txt.Rotate Center1, a * Atn(1) * 4 / 180
    Set TxtHatch = Txt
End Function
 
查看所评论的日志:田草CAD工具箱—>自动绘制PKPM轴线网
tiancao1001 于 2009-02-21 10:08 AM 发表评论:
你好当然可以。稍后给你献上。
感谢支持,
查看所评论的日志:田草CAD工具箱—>自动绘制PKPM轴线网
longer1000 于 2009-02-21 09:14 AM 发表评论:
你好!能否编写这样一个cad工具--自动编写矩形编号的程序。
设想方法如下:
选择批量的矩形,再向矩形中心方向偏移相同的数值,删除原选择的矩形,最后在偏移的矩形内填写相应的长度*宽度。
在此表示谢意
查看所评论的日志:田草CAD工具箱—>自动绘制PKPM轴线网
tiancao1001 于 2009-02-21 09:14 AM 发表评论:
你好,
P2PDistance,就是个求点到点的直线距离的,你自己补充吧?
我分享的代码只能提供一种思路,和解决方法。
查看所评论的日志:折断线绘制
luojunxu 于 2009-02-21 00:29 AM 发表评论:
缺少文件“JMTX_Frm”,没有运行?
查看所评论的日志:CAD截面特性计算
luojunxu 于 2009-02-20 11:14 PM 发表评论:
缺少一个函数P2PDistance
查看所评论的日志:折断线绘制
luojunxu 于 2009-02-20 10:55 PM 发表评论:
今天发现了,
查看所评论的日志:晓东VBA论坛板块的电子书版本
tiancao1001 于 2009-02-20 10:11 AM 发表评论:
'删除图纸中的所有点对象
Sub DelAllPoint()
    Dim E As AcadEntity
    Dim B As AcadBlock
    For Each B In ThisDrawing.Blocks
        For Each E In B
            If TypeOf E Is AcadPoint Then
                E.Delete
            End If
        Next
    Next
    ThisDrawing.Regen
End Sub

查看所评论的日志:田草日志
[80] [81] [82] [83] [84] [85] [86] [87] [88] [89]  ... [144]  
Tiancao Blog All Rights Reserved 田草博客 版权所有
Copyright ©