zoukankan      html  css  js  c++  java
  • AutoCAD VBA基于对象的分层

    AutoCAD VBA基于对象的分层,讲不同对象根据特性分层,代码如下。

    Dim Value As Variant
    Value = ThisDrawing.GetVariable("cmdecho")
    ThisDrawing.SetVariable "cmdecho", 0
    Dim ObjLayer As AcadLayer
    Set ObjLayer = ThisDrawing.Layers.Add("尺寸标注")
    Set ObjLayer = ThisDrawing.Layers.Add("文字")
    Set ObjLayer = ThisDrawing.Layers.Add("主体")
    Set ObjLayer = ThisDrawing.Layers.Add("图案填充")
    Set ObjLayer = ThisDrawing.Layers.Add("虚线")
    Set ObjLayer = ThisDrawing.Layers.Add("中心线")
    Set ObjLayer = ThisDrawing.Layers.Add("剖面线")
    Set ObjLayer = ThisDrawing.Layers.Add("隐藏线")
    Dim ObjSelectionSet As AcadSelectionSet
    Dim Count As Integer
    Count = ThisDrawing.SelectionSets.Count
    While (Count > 0)
    Set ObjSelectionSet = ThisDrawing.SelectionSets.Item(Count - 1)
    ObjSelectionSet.Delete
    Count = Count - 1
    Wend
    Set ObjSelectionSet = ThisDrawing.SelectionSets.Add("SSET")
    Dim gpCode() As Integer
    Dim dataValue() As Variant
    ReDim gpCode(0)
    ReDim dataValue(0)
    Mode = acSelectionSetAll
    gpCode(0) = 0
    dataValue(0) = "dimension"
    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue
    ObjSelectionSet.Select Mode, , , groupCode, dataCode
    Dim tntry As AcadEntity
    For Each tntry In ObjSelectionSet
    Entry.Layer = "尺寸标注"
    Entry.Update
    Next Entry
    ObjSelectionSet.Clear
    gpCode(0) = 0
    dataValue(0) = "text"
    groupCode = gpCode
    dataCode = dataValue
    ObjSelectionSet.Select Mode, , , groupCode, dataCode
    For Each Entry In ObjSelectionSet
    Entry.Layer = "文字"
    Entry.Update
    Next Entry
    ObjSelectionSet.Clear
    ObjSelectionSet.Delete
    ThisDrawing.SetVariable "cmdecho", scmde

    代码完。

    作者:codee
    文章千古事,得失寸心知。


  • 相关阅读:
    聊聊、Spring 第一篇
    聊聊、Nginx 初始化日志文件
    聊聊、Nginx 参数合法性
    聊聊、Nginx GDB与MAIN参数
    聊聊、Nginx 初始化错误信息
    聊聊、Nginx GDB与MAIN
    聊聊、Nginx 安装启动
    聊聊、Zookeeper Windows启动
    Python使用列表推导式实现九九乘法和九九加法表
    Linux环境下后台运行Django项目
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2502931.html
Copyright © 2011-2022 走看看