- 博客(40)
- 收藏
- 关注
原创 通过LabelUtils.GetLabelFor()方法查找BuiltInParameterGroup对应revit中中英文分组名。
可以根据GetLabelFor Method (BuiltInParameterGroup)查找对应的中文分组名。 然后通过 foreach(BuiltInParameterGroupiteminEnum.GetValues(typeof(BuiltInParameterGroup)))遍历 其中item.tostring()就是对应分组英文名。而 LabelUtils.GetLabelFor(item)就是对应的中文名,最后可以统一导出到excel或其...
2020-08-25 09:57:58
653
原创 Revit中Category的获取
开发基础代码UIDocument uidoc = commandData.Application.ActiveUIDocument;Document doc = uidoc.Document;UIApplication uiapp = commandData.Application;Application app = uiapp.Application;获得单一类别以墙为例...
2019-10-11 14:22:36
3240
3
转载 WPF : ControlTemplate和DataTemplate的区别
http://www.cnblogs.com/mrfangzheng/archive/2009/09/21/1571418.htmlControlTemplate用于描述控件本身. 使用TemplateBinding来绑定控件自身的属性, 比如{TemplateBinding Background}DataTemplate用于描述控件的Content. 使用Binding来绑定数据对象的属性...
2018-12-15 22:38:15
3284
原创 共享参数
创建txt文件路径(string) 通过System.IO.FileStream fs = System.IO.File.Create(paraFile)建文件 通过app.SharedParametersFilename = paraFile指定文件 通过 DefinitionFile DefFile = app.OpenSharedParameterFile();打开文件 Defini...
2018-12-02 13:23:23
1385
转载 表达式主体定义
原文地址https://docs.microsoft.com/zh-cn/dotnet/csharp/programming-guide/statements-expressions-operators/expression-bodied-members通过表达式主体定义,可采用非常简洁的可读形式提供成员的实现。 只要任何支持的成员(如方法或属性)的逻辑包含单个表达式,就可以使用表达式主体定义...
2018-11-13 16:13:44
1273
原创 Taskdialog
TaskDialog dialog = new TaskDialog("提示"); dialog.MainContent = "请选择"; dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,"选择一"); dialog.AddCommandLink...
2018-11-13 14:36:32
1309
原创 设置Revit文件预览图
DocumentPreviewSettings ClassContains the settings related to the saving of preview images for a given document.// Get the document's preview settingsDocumentPreviewSettings settings = document....
2018-11-11 11:59:28
1222
原创 二次开发获取默认类型Id
Document GetDefaultElementTypeId Method public ElementId GetDefaultElementTypeId( ElementTypeGroup defaultTypeId) ElementTypeGroup为枚举类型 Member name Description RailingsTypeForStai...
2018-11-11 11:57:32
919
原创 revit三维转到俯视图并缩放匹配选定元素
根据需要转到特定角度的三维视图,首先查找需要转到三维视图的up Direction 和Right Direction 并据此算出forwardDirection。 UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = uidoc.Document;...
2018-11-10 21:53:25
1311
转载 revit参数
Storagetype 描述了内部存储参数值的类型。在Revit里所有的参数值可以分为5种类型: None None represents an invalid storage type. This value should not be used. Integer The internal data is stored in the form of a signed 32...
2018-10-27 12:57:05
672
原创 XYZ点操作常用方法
判断两个向量是否平行(包含方向相反) /// <summary> /// 判断两个向量是否平行,包含方向相反 /// 通过Normalize()将两个向量单位正交化,这样就可以通过比较这两个单位向量的大小 /// 或者说比较这两个点是否重合来比较。 /// </summary> /// &...
2018-10-27 11:27:51
5264
转载 语音朗读
实现点击按钮朗读文本框内容的目的。 添加System.Speech的引用引用using System.Speech.Synthesis命名空间private void button_Click(object sender, RoutedEventArgs e) { //判断是否为空或者空格 if (string.Is...
2018-10-19 13:18:07
560
转载 将英文列表转成中文
定义英文枚举enum Week { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }定义转换方法static string GetChineseWeek(Week week) { string[] chine...
2018-10-17 09:31:59
2530
原创 利用NPOI写入Excel
引用NPOI.Dll文件应用命名空间using NPOI.HSSF.UserModel;using NPOI.SS.UserModel;创建基础数据public class Student { public int Age { get; set; } public string Name { get; set; } pu...
2018-10-15 11:18:25
2153
原创 关于List集合的一些基本操作
声明需要操作的Student类以及要转换的Person类public class Student:IFormattable,IComparable<Student> { public int ID { get; set; } public string Name { get; set; } public double Sc...
2018-10-13 23:27:47
330
原创 Revit二次开发添加按钮
整体结构布局 命令类 namespace HW{ [Transaction(TransactionMode.Manual)] class Cmd : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, Ele...
2018-10-12 15:49:29
4412
1
转载 Dictionary遍历方法
Dictionary<string, int> list = new Dictionary<string, int>(); list.Add("d", 1); foreach (var item in list) { ...
2018-10-11 13:44:08
4406
转载 计算几何算法
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; /*计算几何目录 ㈠ 点的基本运算 1. 平面上两点之间距离 1 2. 判断两点是否重合 1 3. 矢量叉乘 1 4. 矢量点乘 2 5. 判断点...
2018-10-10 09:14:26
283
转载 虚拟按键触发事件
public class Press { [DllImport("USER32.DLL")] public static extern bool PostMessage(IntPtr hWnd, uint msg, uint wParam, uint lParam); [DllImport("user32.dll")] s...
2018-10-08 14:15:45
451
原创 关于Excel的操作
获取桌面路径Environment.GetFolderPath(Environment.SpecialFolder.Desktop) using X = Microsoft.Office.Interop.Excel;X.Application excel = new X.Application();应该检查下电脑是否安装excelif (excel == null) Mess...
2018-09-25 17:12:55
274
原创 Revit二次开发基础知识
获取应用、文档及当前视图信息public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Applica...
2018-09-20 11:46:59
560
2
原创 Revit二次开发点滴记录
线的方向问题XYZ xyz=Line.Direction;此属性返回的是normalized之后的向量。示例如下 Line l1 = Line.CreateBound(new XYZ(0,5,0),new XYZ(0,0,0)); Line l2 = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(0, 5, 0)); Line l3 = Line...
2018-09-09 21:33:48
867
转载 从Excel中读取点坐标建立参照点
来自Revit SDK案例, public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Autodesk.Revit.ApplicationServices.Application app = commandData...
2018-09-07 16:19:50
1253
2
原创 path类
方法 名称 说明 ChangeExtension(String, String) 更改路径字符串的扩展名。 只是更改字符串,实际文件的文件后缀不会更改。 string str = @"C:\1.png"; string newPath = Path.ChangeExtension(str, "gif"); Cons...
2018-08-28 14:21:31
1288
原创 判断某字符是否为数字
可以通过以下判断字符或字符串中某个字符为数字。 名称 说明 IsNumber(Char) 指示指定的 Unicode 字符是否属于数字类别。 IsNumber(String, Int32) 指示指定字符串中位于指定位置的字符是否属于数字类别。 IsNumber(Char)方法不应用于确定是否一个字符串是否包...
2018-08-26 09:21:54
4480
转载 C#导出字符串为txt格式
using System;using System.IO;using System.Text;class Test{ public static void Main() { string path = @"c:\temp\MyTest.txt"; // This text is added only once to the file....
2018-08-21 16:36:52
2623
转载 导出图片
class CmdExportImage : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = comman...
2018-08-21 16:20:03
335
转载 导出IFC案例
class ExportIfc : IExternalCommand { public Result Execute(ExternalCommandData commandData,ref string message,ElementSet elements) { UIApplication uiapp = commandD...
2018-08-21 15:01:59
3242
1
原创 开发所需向量基础知识
向量的叉积向量积,也被称为叉积(即交叉乘积)、外积,是一种在向量空间中向量的二元运算。与点积不同,它的运算结果是一个伪向量而不是一个标量。并且两个向量的叉积与这两个向量都垂直。定义:两个向量a和b的叉积写作a × b(有时也被写成a ∧ b,避免和字母x混淆)。叉积可以被定义为:在这里θ表示'a和b之间的角度(0° ≤ θ ≤ 180°),它位于这两个矢量所定义的平面上。而n是...
2018-08-15 16:19:34
312
原创 C#点滴
1获取程序路径,根据需要来设定去掉最后i位字母。 public string GetAssembyMethod( int i) { string directoryName = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); r...
2018-08-13 14:41:53
154
原创 PostableCommand基础应用
通过PostableCommand可以直接调用大部分revit内置的命令。//获取uiApp UIApplication uiApp = commandData.Application; //查找要实现的命令Looks up and retrieves the Revit command id with the given id string....
2018-08-10 11:28:36
1951
转载 Face.Intersect(face) method问题
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var list = new FilteredElementCollector(commandData.Application.ActiveUIDocum...
2018-08-04 22:02:22
557
转载 文件及文件夹操作- File类、Directory 类、FileInfo 类、DirectoryInfo 类
命名空间:using system .IO;1. File类:创建:File.Create(路径);创建文件,返回FileStreamFileStream fs = File.Create(路径);之后需要关闭否则打不开,fs.close();删除:File.Delete(路径);无返回值复制文件:File.Copy(源文件,目标文件);剪切文件:File.Move(源文件...
2018-07-25 13:08:51
849
原创 revit二次开发小技巧
//获取当前视图的标高 ,操作时只能在平面视图,不然会报错,因为在三维视图无法获取标高。Level level = document.ActiveView.GenLevel;//通过某构件获取标高(如放置门时获取墙体标高)Level level = document.GetElement(wall.LevelId) as Level;//可以通过Document获取UIdocume...
2018-07-20 14:29:45
1413
1
原创 委托 匿名函数 Lamda表达式
namespace ConsoleApplication4{ class Program { static void Main(string[] args) { int[] nums = { 1, 2, 3, 4, 5, 6 }; List<int> L1= FilterNumber.Fi...
2018-07-20 14:28:11
187
原创 C#泛型
IEnumerable<T>继承自IEnumerableICollection<T>继承自IEnumerable<T>IList<T>继承自ICollection<T>
2018-07-20 11:58:48
156
转载 Take、TakeWhile、Skip、SkipWhile的比较
///take(); int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var first3Numbers = numbers.Take(3); //从第一个元素开始,只获取前面三个 Console.WriteLine("First 3 numbers:"); ...
2018-07-12 11:34:29
1361
原创 过滤楼板类型
public class CreatFloorSurface : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIDocument uidoc = com...
2018-07-07 18:27:37
160
原创 revit二次开发获取基本参数
UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = uidoc.Document; //获取选择的元素,讲元素转成列表形式 var elemList = uidoc.Selection.GetElementIds().ToList()...
2018-07-03 12:07:48
3255
原创 简单Linq语句查询排序
查询数组中所有偶数,按大小排序int []nums = { 1, 8, 4, 7, 3, 2, }; /* var qq = from num in nums where num % 2 == 0 orderby num select num; */ ...
2018-07-02 16:47:56
952
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人