百度收录怎么做/深圳网站优化平台
//选择csv导入信息
[CommandMethod("setdata")]
//本程序在AutoCAD的快捷命令是"DLLLOAD"
public void setdata()
{Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();dlg.DefaultExt = ".csv";// Display OpenFileDialog by calling ShowDialog method Nullable<bool> result = dlg.ShowDialog();//判断确认按钮if (result == true){//选择的文件路径string file_dir = dlg.FileName;}
}
使用Microsoft.Win32.OpenFileDialog注意需要引用 PresentationFramework.dll控件
[CommandMethod("setdata")]public void SetData(){// 选择CSV文件Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();dlg.DefaultExt = ".csv";Nullable<bool> result = dlg.ShowDialog();if (result != true)return;// 获取当前文档和数据库Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;Database db = doc.Database;Editor ed = doc.Editor;// 打开CSV文件并逐行处理string filePath = dlg.FileName;string[] csvLines = File.ReadAllLines(filePath);CheckAndCreateLayer("qlr权利人");using (Transaction trans = db.TransactionManager.StartTransaction()){BlockTable blockTable = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;BlockTableRecord modelSpace = trans.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;foreach (string csvLine in csvLines){string[] csvData = csvLine.Split(',');if (csvData.Length < 6){ed.WriteMessage("CSV数据格式不正确!");continue;}string layerName = csvData[0];string name = csvData[1];//double x, y, height;int color;if (!double.TryParse(csvData[2], out x) || !double.TryParse(csvData[3], out y) ||!double.TryParse(csvData[4], out height) || !int.TryParse(csvData[5], out color)){ed.WriteMessage("CSV数据类型转换出错!");continue;}// 检查图层是否已存在,不存在创建图层CheckAndCreateLayer(layerName);// 创建实体对象Point3d position = new Point3d(x, y, 0);DBText text = new DBText();text.Position = position;text.TextString = name;text.Height = height;text.Color = Color.FromColorIndex(ColorMethod.ByAci, (byte)color);//text.LayerId = ObjectId(layerName);LayerTableRecord ltr = new LayerTableRecord();text.LayerId = GetLayerId(layerName);// 添加实体到模型空间modelSpace.AppendEntity(text);trans.AddNewlyCreatedDBObject(text, true);//拼接CSV字符串string value = layerName + "," + name + "," + x + "," + y + "," + height + "," + color;ed.WriteMessage("\n" + value);}trans.Commit();}}public ObjectId GetLayerId(string layerName){Document doc = Application.DocumentManager.MdiActiveDocument;Database db = doc.Database;using (Transaction tr = db.TransactionManager.StartTransaction()){LayerTable layerTable = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);if (layerTable.Has(layerName)){LayerTableRecord layerRecord = (LayerTableRecord)tr.GetObject(layerTable[layerName], OpenMode.ForRead);return layerRecord.ObjectId;}}return ObjectId.Null;}public void CheckAndCreateLayer(string layerName){Document doc = Application.DocumentManager.MdiActiveDocument;Database db = doc.Database;Editor ed = doc.Editor;using (Transaction tr = db.TransactionManager.StartTransaction()){LayerTable layerTable = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;if (!layerTable.Has(layerName)){LayerTableRecord layer = new LayerTableRecord();layer.Name = layerName;layerTable.UpgradeOpen();ObjectId layerId = layerTable.Add(layer);tr.AddNewlyCreatedDBObject(layer, true);// 设置新图层的属性layer.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Red);layer.LineWeight = LineWeight.LineWeight030;tr.Commit();ed.WriteMessage("图层已创建: {0}\n", layerName);}else{tr.Commit();ed.WriteMessage("图层已存在: {0}\n", layerName);}}}
注意事项 导入csv编码 utf8
导入视图如下
相关文章:

C# Cad2016二次开发选择csv导入信息(七)
//选择csv导入信息 [CommandMethod("setdata")] //本程序在AutoCAD的快捷命令是"DLLLOAD" public void setdata() {Microsoft.Win32.OpenFileDialog dlg new Microsoft.Win32.OpenFileDialog();dlg.DefaultExt ".csv";// Display OpenFileDial…...

[陇剑杯 2021]日志分析
[陇剑杯 2021]日志分析 题目做法及思路解析(个人分享) 问一:单位某应用程序被攻击,请分析日志,进行作答: 网络存在源码泄漏,源码文件名是_____________。(请提交带有文件后缀的文件名&…...

Java面试汇总——jvm篇
目录 JVM的组成: 1、JVM 概述(⭐⭐⭐⭐) 1.1 JVM是什么? 1.2 JVM由哪些部分组成,运行流程是什么? 2、什么是程序计数器?(⭐⭐⭐⭐) 3、介绍一下Java的堆(⭐⭐⭐⭐) 4、虚拟机栈(⭐⭐⭐⭐) 4.1 什么是虚拟机栈&…...

数据结构:完全二叉树(递归实现)
如果完全二叉树的深度为h,那么除了第h层外,其他层的节点个数都是满的,第h层的节点都靠左排列。 完全二叉树的编号方法是从上到下,从左到右,根节点为1号节点,设完全二叉树的节点数为sum,某节点编…...

RK3568 移植Ubuntu
使用ubuntu-base构建根文件系统 1、到ubuntu官网获取 ubuntu-base-18.04.5-base-arm64.tar.gz Ubuntu Base 18.04.5 LTS (Bionic Beaver) 2、将获取的文件拷贝到ubuntu虚拟机,新建目录,并解压 mkdir ubuntu_rootfs sudo tar -xpf u...

C++大学教程(第九版)6.34猜数字游戏 6.35 修改的猜数字游戏
文章目录 6.34题目代码运行截图6.35题目代码运行截图 6.34题目 猜数字游戏)编写一个程序,可以玩“猜数字”的游戏。具体描述如下:程序在1~1000之间的整数中随机选择需要被猜的数,然后显示: 代码 #include <iostream> #include <cstdlib>…...

【立创EDA-PCB设计基础】5.布线设计规则设置
前言:本文详解布线前的设计规则设置。经过本专栏中的【立创EDA-PCB设计基础】前几节已经完成了布局,接下来开始进行布线,在布线之前,要设置设计规则。 目录 1.间距设置 1.1 安全间距设置 1.2 其它间距设置 2.物理设置 2.1 导…...

ElementUI简介以及相关操作
ElementUI是一套基于Vue.js的桌面端组件库,提供了丰富的组件帮助开发人员快速构建功能强大、风格统一的页面。以下是ElementUI的简介以及相关操作: 简介:ElementUI是一套为开发者、设计师和产品经理准备的基于Vue 2.0的桌面端组件库ÿ…...

内存耗尽排查思路
内存耗尽排查思路 – WhiteNights Site 标签:日志 内存间断性耗尽问题的排查思路 先简单说下背景。排查了两天给我整麻了。 找了个镜像模板做虚拟机。但是发现只要一开机,内存每隔几秒就会被耗尽。看内存的波形图就和坐过山车一样,一会占…...

OpenCV书签 #差值哈希算法的原理与相似图片搜索实验
1. 介绍 差值哈希算法(Difference Hash Algorithm,简称dHash) 是哈希算法的一种,主要可以用来做以图搜索/相似图片的搜索工作。 2. 原理 差值哈希算法通过计算相邻像素的差异来生成哈希,即通过缩小图像的每个像素与平…...

Unity中URP下获取主灯信息
文章目录 前言一、计算BulinnPhone的函数有两个重载1、 目前最新使用的是该方法(这是我们之后主要分析的函数)2、 被淘汰的老方法,需要传入一堆数据 二、GetMainLight1、Light结构体2、GetMainLight具有4个方法重载3、1号重载干了什么&#x…...

尝试着在Stable Diffusion里边使用SadTalker进行数字人制作
首先需要标明的是,我这里是图片说话类型,而且是看了知识星球AI破局俱乐部大航海数字人手册进行操作的。写下这篇文章是防止我以后遗忘。 我使用的基础软件是Stable Diffusion,SadTalker是作为插件放进来的,需要注意的是这对自己的…...

链路聚合原理与配置
链路聚合原理 随着网络规模不断扩大,用户对骨干链路的带宽和可靠性提出了越来越高的要求。在传统技术中,常用更换高速率的接口板或更换支持高速率接口板的设备的方式来增加带宽,但这种方案需要付出高额的费用,而且不够灵活。采用…...

第8章 通信网络安全
文章目录 8.1 信息系统安全概述8.1.1 信息系统的构成和分类8.1.2 信息系统安全1、信息系统中的安全概念2、信息系统安全问题的发展演变3、信息系统的安全结构 8.1.3 信息系统的安全保护等级1.TCSEC(可信计算机系统评估准则)2. 我国信息安全标准 8.1.4 通…...

L1-092 进化论(Java)
在“一年一度喜剧大赛”上有一部作品《进化论》,讲的是动物园两只猩猩进化的故事。猩猩吕严说自己已经进化了 9 年了,因为“三年又三年”。猩猩土豆指出“三年又三年是六年呐”…… 本题给定两个数字,以及用这两个数字计算的结果,…...

SpringBoot 源码解析5:ConfigurationClassPostProcessor整体流程和@ComponentScan源码分析
SpringBoot 源码解析5:ConfigurationClassPostProcessor整体流程和ComponentScan源码分析 1. 知道以下几点,读ConfigurationClassPostProcessor源码会更轻松2. 源码解析 ConfigurationClassPostProcessor#postProcessBeanDefinitionRegistry2.1 Configur…...

一.初识Linux 1-3操作系统概述Linux初识虚拟机介绍
目录 一.初识Linux 1.操作系统概述 计算机组成 硬件: 软件: 操作系统: 操作系统工作流程 操作系统作用 常见的操作系统 PC端: 移动端:(掌上操作系统) 一.初识Linux 2.Linux初识 linu…...

Eureka整合seata分布式事务
文章目录 一、分布式事务存在的问题二、分布式事务理论三、认识SeataSeata分布式事务解决方案1、XA模式2、AT模式3、SAGA模式4.SAGA模式优缺点:5.四种模式对比 四、微服务整合Seata AT案例Seata配置微服务整合2.1、父工程项目创建引入依赖 2.2、Eureka集群搭建2.3、…...

华为云磁盘性能指标(参考)
MD[华为云磁盘性能指标(参考)] 云硬盘(Elastic Volume Service, EVS) 根据性能,磁盘可分为极速型SSD V2、极速型SSD、通用型SSD V2、超高IO、通用型SSD、高IO、普通IO。 性能指标(参考),测速说明:操作系统-windows …...

利用OpenGL图形库实现人物动画移动效果
使用OpenGL库实现人物动画移动效果需要涉及到更复杂的图形编程和事件处理。以下是一个简单的例子,使用OpenGL和GLUT库实现人物的基本动画移动效果。 确保你已经安装了OpenGL和GLUT。你可以使用包管理器或者从官方网站下载并安装。 一、如果你已经安装过了OpenGL和…...

History命令解释,及一个相关的bash脚本(如何编写脚本程序从记录文件中提取history命令)
目 录 一、history命令介绍 1、history命令是什么? 2、history的主要功能 二、history命令的用法 1、语法 2、选项说明 3、命令实例 三、history和历史记录文件bash_history 四、history命令的相关配置 1,命令带时间展示-HISTTI…...

apisix 单机部署 linux
安装etcd: cd /home/app rz tar -zxvf etcd-v3.5.4-linux-amd64.tar.gz cd etcd-v3.5.4-linux-amd64 vim start.sh内容: #!/bin/sh nohup etcd --name infra0 --initial-advertise-peer-urls http://127.0.0.1:2380 \--listen-peer-urls http://127.0.…...

Redis 面试题 | 06.精选Redis高频面试题
🤍 前端开发工程师、技术日更博主、已过CET6 🍨 阿珊和她的猫_CSDN博客专家、23年度博客之星前端领域TOP1 🕠 牛客高级专题作者、打造专栏《前端面试必备》 、《2024面试高频手撕题》 🍚 蓝桥云课签约作者、上架课程《Vue.js 和 E…...

2008年苏州大学837复试机试C/C++
2008年苏州大学复试机试 题目 编写程序充成以下功能: 一、从键盘上输入随机变量x的 10个取样点。X0,X1—X9 的值; 1、计算样本平均值 2、判定x是否为等差数列 3、用以下公式计算z的值(t0.63) 注。请对程序中必要地方进行注释 补充:个人觉得这个题目回忆…...

MySQL笔记-information_schema库中COLUMNS表的一些笔记
mysql建表中可以添加comment,也就是注释,这些注释会写到information_schema库的COLUMNS表中,可以使用如下SQL语句进行查询: SELECT COLUMN_NAME, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA your_data…...

归并排序模板
模板在文末,以下步骤方便理解记忆。 先贴一张快速排序模板步骤,用于对比记忆 归并排序步骤: (0)如果数组左边界L ≥ 数组右边界,则不需要排序,直接return。 (1)直接取…...

【NVIDIA】Jetson Orin Nano系列:安装 Qt6、firefox、jtop、flameshot
1、使用命令安装 sudo apt install qtcreator sudo apt install qt6-* sudo apt install libqt6* sudo apt install qml-qt6 sudo apt install qmlscene-qt6 sudo apt install assistant-qt6 sudo apt install designer-qt62、启动 qtcreator 3、常用工具安装 sudo apt in…...

Fastapi+Jsonp实现前后端跨域请求
文章目录 一、实现方法1.后端部分【Fastapi】2.前端部分【JS】二、测试一、实现方法 1.后端部分【Fastapi】 # coding:utf-8import json from fastapi import FastAPI, Response from fastapi.middleware.cors import CORSMiddlewareapp = FastAPI(...

MacOS受欢迎的数据库开发工具 Navicat Premium 15 中文版
Navicat Premium 15 Mac是一款数据库管理工具,提供了一个全面的解决方案,用于连接、管理和维护各种数据库系统。以下是Navicat Premium 15 Mac的一些主要功能和特点: 软件下载:Navicat Premium 15 中文版下载 多平台支持ÿ…...

helm---自动化一键部署
什么是helm?? 在没有这个helm之前,deployment service ingress helm的作用就是通过打包的方式,把deployment service ingress 这些打包在一块,一键式部署服务,类似于yum 官方提供的一个类似于安装仓库的功能,可以实…...