AutoCAD开发1---获取块属性
Private Sub CommandButton1_Click()
Dim pEntity As AcadObject
Dim pBlock As AcadBlockReference
Dim pPolyline As AcadLWPolyline
Dim pSlct As AcadSelectionSet
'若 Entity 选择集存在,则删除选择集,删除后并添加
For i = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets.Item(i).Name = "Entity" Then
Set pSlct = ThisDrawing.SelectionSets.Item(i)
pSlct.Delete
End If
Next i
Set pSlct = ThisDrawing.SelectionSets.Add("Entity")
'隐藏窗体,并用 SelectOnScreen 方法选择
UserForm1.Hide
pSlct.SelectOnScreen
'定义要获取的数据的类型和数据载体
Dim pXDataType As Variant
Dim pXDatavlaue As Variant
'定义块的插入点,坐标存放数组
Dim pInsertPt As Variant
Dim pCoords As Variant
Dim sCoor As String
For Each pEntity In pSlct
'Debug.Print pEntity.ObjectName
If pEntity.ObjectName = "AcDbBlockReference" Then
Set pBlock = pEntity
pBlock.GetXData "SOUTH", pXDataType, pXDatavlaue
pInsertPt = pBlock.InsertionPoint
'Debug.Print pXDataType(0) & "," & pXDataType(1)
'Debug.Print pXDatavlaue(1) & "," & pInsertPt(0) & "," & pInsertPt(1) & "," & pBlock.Linetype & "," & pBlock.LinetypeScale & "," & pBlock.Lineweight & "," & pBlock.HasAttributes & "," & pBlock.XScaleFactor & "," & pBlock.YScaleFactor&; "," & pBlock.ZScaleFactor
'Debug.Print pBlock.Name & "," & pBlock.Layer
'Debug.Print pBlock.ObjectID & "," & pBlock.Handle & "," & pXDatavlaue(1) & "," & pInsertPt(0) & "," & pInsertPt(1)
'Debug.Print pBlock.Linetype & "," & pBlock.LinetypeScale & "," & pBlock.Lineweight
'Debug.Print pBlock.XScaleFactor & "," & pBlock.YScaleFactor & "," & pBlock.ZScaleFactor
'Debug.Print
MsgBox "块 名:" & pBlock.Name & Chr(13) & "所在层:" & pBlock.Layer & Chr(13) & "编 码:" & pXDatavlaue(1) & Chr(13) & "坐 标:" & Format(pInsertPt(0), "0.0000") & "," & Format(pInsertPt(1), "0.0000")
ElseIf pEntity.ObjectName = "AcDbPolyline" Then
Set pPolyline = pEntity
pPolyline.GetXData "SOUTH", pXDataType, pXDatavlaue
pCoords = pPolyline.Coordinates
'Debug.Print pXDatavlaue(1) & "," & pPolyline.ObjectID
For j = 0 To UBound(pCoords)
If j Mod 2 = 0 Then
'Debug.Print sCoor
sCoor = ""
End If
sCoor = sCoor & pCoords(j) & ","
Next j
Debug.Print
End If
Next pEntity
pSlct.Delete
'UserForm1.Show
End Sub
AutoCAD开发1---获取块属性的更多相关文章
- NX二次开发-UFUN获取块的参数UF_MODL_ask_block_parms
NX11+VS2013 #include <uf.h> #include <uf_modl.h> #include <uf_ui.h> UF_initialize( ...
- AutoCAD开发4--添加块)
Private Sub CommandButton3_Click() Dim pInsertPnt As Variant 'pInsertPnt(0) = 100.5141: pInsertPnt(1 ...
- AutoCAD开发2--添加带属性的点
Private Sub CommandButton11_Click() Dim pPoint As AcadPoint Dim DataType(0 To 1) As Integer Dim Data ...
- C#.Net实现AutoCAD块属性提取
https://blog.csdn.net/dengyiyu/article/details/2201175 本文主要给大家介绍一下SmartSoft中用C#.Net实现AutoCAD块属性提取的方法 ...
- C#开发BIMFACE系列18 服务端API之获取模型数据3:获取构件属性
系列目录 [已更新最新开发文章,点击查看详细] 本篇主要介绍如何获取单文件/模型下单个构建的属性信息. 请求地址:GET https://api.bimface.com/data/v2/fil ...
- C#开发BIMFACE系列20 服务端API之获取模型数据5:批量获取构件属性
系列目录 [已更新最新开发文章,点击查看详细] 在<C#开发BIMFACE系列18 服务端API之获取模型数据3:获取构件属性>中介绍了获取单个文件/模型的单个构建的属性,本篇介绍 ...
- Python中如何获取类属性的列表
这篇文章主要给大家介绍了在Python中如何获取类属性的列表,文中通过示例代码介绍的很详细,相信对大家的学习或者工作具有一定的参考借鉴价值,有需要的朋友可以参考借鉴,下面来一起看看吧. 前言 最近工作 ...
- JS中isPrototypeOf 和hasOwnProperty 的区别 ------- js使用in和hasOwnProperty获取对象属性的区别
JS中isPrototypeOf 和hasOwnProperty 的区别 1.isPrototypeOf isPrototypeOf是用来判断指定对象object1是否存在于另一个对象object2的 ...
- js中获取css属性
直接获取 window.onload = function() { var but = document.getElementById('button'); var div = document.ge ...
随机推荐
- Java12配置
配置环境变量: 之前的JAVA_HOME和CLASSPATH已经都不要了.只要配置jdk的bin到Path里: C:\Program Files\Java\jdk-12\bin
- windows server 2008 r2 x64 enterprise service pack1中aspjpeg.dll安装
官网地址:http://persits.com/ 64位:http://www.persits.com/aspjpeg64.exe sn:lptn9dQO1enAePAXB2wFaCZawYWzfm0 ...
- iOS之iOS11、iPhone X、Xcode9 适配指南
更新iOS11后,发现有些地方需要做适配,整理后按照优先级分为以下三类: 1.单纯升级iOS11后造成的变化: 2.Xcode9 打包后造成的变化: 3.iPhoneX的适配 一.单纯升级iOS11后 ...
- impala daemon启动失败
启动错误日志: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: ...
- 通过spark sql 将 hdfs上文件导入到mongodb
功能:通过spark sql 将hdfs 中文件导入到mongdo 所需jar包有:mongo-spark-connector_2.11-2.1.2.jar.mongo-java-driver-3.8 ...
- 一个简单的gridlayout栗子
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- day31网络编程
网络编程1. 目标:编写一个C/S架构的软件 C/S: Client(用户端)--------基于网络----------Server(服务端) B/S: Browser-------基于 ...
- [java,2017-05-04] 创建word文档
package test; import java.text.SimpleDateFormat; import java.util.Date; import com.aspose.words.Data ...
- ES6 入门Promise
Promise是一个对象用来传递异步操作的消息,有三种状态:Pending(进行中),Resolved(已完成又称Fulfilled)和Rejected(已失败). 特点:对象状态不受外界的影响.一旦 ...
- c#中使用excel
在做一个小项目,需要把一些查询结果导出到Excel,找了一些资料,自己也总结出了一点方法,与大家共享. 一.首先简要描述一下如何操作Excel表 先要添加对Excel的引用.选择项目-〉添加引用-〉C ...