明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1006|回复: 0

LinetypeScale应用一例

[复制链接]
发表于 2008-11-27 16:42:00 | 显示全部楼层 |阅读模式

在一张图上的中心线,有的长,有的短,如果LinetypeScale都用1的话,有的中心线间距拉的开,有的就成为一条直线。

Sub lsls()
  Dim pt1, pt2
  Dim sSet As AcadSelectionSet
  pt1 = ThisDrawing.Utility.GetPoint(, "Input First Point")
  pt2 = ThisDrawing.Utility.GetCorner(pt1, "Input First Point")
  Set sSet = CreateSelectionSetCrossingText(pt1, pt2)
  Dim objText As AcadText
  Dim objLine As AcadLine
  For ii = 0 To sSet.Count - 1
    Set objLine = sSet.Item(ii)
    With objLine
      Debug.Print .Length

通过判断长度,来设置LinetypeScale的值。
      Select Case .Length
        Case Is <= 5
          .LinetypeScale = 0.1
        Case Is <= 10
          .LinetypeScale = 0.2
         
        Case Is > 50
          .LinetypeScale = 0.8
       
      End Select
    End With
  Next ii
End Sub

Function CreateSelectionSetCrossingText(pt1 As Variant, pt2 As Variant) As AcadSelectionSet
   On Error Resume Next
   Dim sSet As AcadSelectionSet
   'Dim SSet As AcadSelectionSet
   If Not IsNull(ThisDrawing.SelectionSets.Item("SelectEntity")) Then
     Set sSet = ThisDrawing.SelectionSets.Item("SelectEntity")
     sSet.Delete
   End If
   Set sSet = ThisDrawing.SelectionSets.Add("SelectEntity")
   Dim gpCode(0) As Integer
   Dim dataValue(0) As Variant
   gpCode(0) = 0
   dataValue(0) = "Line"
  
   sSet.Select acSelectionSetCrossing, pt1, pt2, gpCode, dataValue

   Set CreateSelectionSetCrossingText = sSet

End Function

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

本版积分规则

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

GMT+8, 2024-11-26 06:46 , Processed in 0.144716 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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