乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 19|回复: 0

LinetypeScale应用一例

[复制链接]

120

主题

326

帖子

7

银币

中流砥柱

Rank: 25

铜币
806
发表于 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  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
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-3 17:05 , Processed in 0.665323 second(s), 55 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表