Revit二次开发 斜面上旋转基于面构件错误的问题
今天修改了一下之前的功能,测试时发现无法在斜面上旋转基于面的构件,检查了一下午,从面的获取到tranform的转换都核查的一遍发现没有错误,最后发现应该是旋转时AXIS参数的问题,检查AXIS的向量与斜面的FACE.NORMAL一致,垂直于指定面,但是每次旋转都出错,之后将旋转轴设置为(0,0,1)之后就可以正常生成,,,不清楚问题在哪,暂时记录下来,想明白后继续补充
Revit Secondary Development Error Rotating Face-based Component on Sloped Face
Today modified previous function a bit, found unable to rotate face-based component on sloped face during testing. Checked for an afternoon, checked everything from face retrieval to transform conversion found no error. Finally found it should be problem of AXIS parameter during rotation. Checked AXIS vector is consistent with FACE.NORMAL of sloped face, perpendicular to specified face, but every rotation errors. Afterwards set rotation axis to (0,0,1) then can generate normally,,, don’t know...
Use C++ for Revit Secondary Development
Since VC++ is compiled in CLR, it cannot achieve encryption effect. If you want to protect your code, it is recommended to use C++ for core algorithms and C# for interaction. While making component library, considering database connection code might be decompiled, I used WCF to interact with server data in previous version, articles can be found in my previous posts. But recently learning QT and trying to use QT+C++ or VC++ development to see effect, so simply wrote a demo developed by c++.R...
使用C++进行Revit二次开发
由于VC++是在CLR中被编译所以无法达到加密的效果,如果想要保护自己的代码还是建议使用C++做核心算法,C#做交互。 由于做族库中,考虑到连接数据库代码可能会被反编译,上个版本中我采用的是WCF的方式与服务器数据交互,文章可在我前几篇找到,但是最近在学习QT相尝试使用QT+C++或是VC++开发,看一下效果,所以简单写了一个c++开发的demo。参考链接:C++ Revit Add-In步骤: 需要确保我们的VS上面安装CLI工具,如果按照上面的步骤直接进行的话,是没有类库选项需要我们安装额外的组件。安装点击:工具-获取工具和功能即可安装 创建类库,输入名字与.netframwork框架版本即可,版本与RevitAPI需要的版本对应 按照c#的开发方式,添加引用即可,在头文件中,将transation头添加,并添加iexternalcommand接口,并在cpp文件中写内容即可。但是在添加[transation]的时候无法通过智能提示添加,不清楚是不是我的原因,由于c++使用指针,如果习惯var变量可以使用auto替代,代码类中加上^符号即可。其他的只需要遵循c++的写法就...
Revit Winform Display on Top of Revit
Reference Article: 《BuilderCoder Revit Parent Window 》 When we use modal form, when focus is not on form, form will hide behind all layers. If encountering unfamiliar user, will click buttons continuously, creating multiple forms. And interaction for single form is also not friendly. Searching in website, often tell everyone to set TopMost, but this operation sets form to top most layer. When we use other applications like browser, form still displays on top layer which does not conform to in...
Revit Winform显示在Revit上层
引用文章:《BuilderCoder Revit Parent Window 》 当我们使用模态窗体时,当焦点不在窗体上时,窗体会隐藏在所有层级后方,如果遇到不熟悉的用户会不停点击按钮,从而生成多个窗体。并且对于单一窗体的交互也不友好。 在网站中搜索,经常会告诉大家设置TopMost但是这一操作会把窗体设置为最顶层,当我们使用其他应用程序,如:浏览器。窗体依旧显示在最上层不符合交互逻辑。 通过设置IWin32Window将Revit设置为窗体的父窗体,但是我们通过 1var rvtPtr = Process.GetCurrentProcess().MainWindowHandle; 仅可以获得他的焦点,此时我们需要继承IWin32Window创建一个类,最后应用于Show()的函数中 123456789101112public class WindowHandle:IWin32Window { private IntPtr _handle; public WindowHandle(IntPtr h) ...
Winform Resize Panel in SplitContainer
Click Panel then click ESC to cancel then move mouse to boundary to resize
Winform 调整SplitContainer中Panel的大小
点击Panel后点击ESC取消然后将鼠标移动到边界上即可调整大小
MySQL Lock Granularity and ACID
Table Lock: It locks the entire table. Before a user performs a write operation (insert, delete, update, etc.) on the table, they need to acquire a write lock first, which will block all read and write operations on the table by other users. When there is no write lock, other users can obtain read locks, and read locks between multiple users do not block each other.Row Lock: Row-level locks can support concurrent processing to the greatest extent (and also bring the largest lock overhead). AC...
MySQL 锁粒度与ACID
表锁(Table Lock):它会锁定整张表。一个用户在对表进行写操作(插入、删除、更新等)钱,他需要先获得写锁,这会阻塞其他用户对该表的所有读写操作。没有写锁的时候,其他用户可以获得读锁,多用户之间的读锁相互不阻塞。行级锁(row lock):行级锁能够最大程度的支持并发处理(同时也带来了最大的所开销)。 ACIDACID表示原子性(atomicity)、一致性(consistency)、隔离性(isolation)和持久性(durability) 原子性(atomicity):一个事务必须被视为一个最小的工作单元,整个事务中的所有操作要么全部提交成功,要么全部失败回滚,对于一个事务来说,不可能只执行其中的一部分操作一致性(consistency):数据库总时哦才能够一个一致性的状态转换到另外一个一致性的状态。在执行事务某条语句的时候系统突然蹦会,导致事务最终没有提交,所以事务所作的修改也不会保存到数据库中隔离性(isolation):通常来说,一个事务所作的修改在最终提交以前,对其他事务是不可见的。在一个事务没有执行结束时,对事务的修改不会影响外部数据。持久性(durabil...
WCF Use Console to Drive Revit
Currently doing family library project, already made WPF interface but because it was WPF project at start, intermediate interaction operations need to be implemented in Revit, thinking of driving Revit through WPF thereby implementing communication between two windows. One way is generic, implemented using external event, this path is relatively easyAnother way is when reading jimmy‘s blog found a case, using WCF as connection to drive two independent programs. Regarding creating WCF program...
WCF使用控制台驱动Revit
目前再做族库项目,已经将WPF界面做好但是由于开始的时候是WPF项目,中间的交互操作需要在Revit中实现,想着通过WPF驱动Revit从而实现两个窗口之间的互通。 一个办法是通用的,使用外部事件实现,这一条路径比较容易另一个办法是在看jimmy的博客的时候发现有一个案例,通过WCF作为连接驱动两个独立的程序。 关于创建WCF程序可以参照官网 控制台与Revit均需要管理员权限运行,否则将会报错无法接受终结点的错误 我的代码放到GitHub,只修改了关于Revit的部分,如果官方案例无法运行可以对照两个案例互相验证。 通过看前辈的项目,学习到了使用命令行快速定位addin文件,也明白了一些插件无法在常规路径看不到的原因 12345copy "$(ProjectDir)RevitExternalDemo.addin" "$(AppData)\Autodesk\REVIT\Addins\2016"copy "$(TargetPath)" "$(AppData)\Autodesk\REVIT\Addins\2016&...
How to Get Special Folders on Computer
Title : How to Get Special Folders on Computer Official Link: Environment.SpecialFolder We usually load some cache files in the file to facilitate retrieval next time. If using a hard disk address like: H:\preview, the user might not have the H drive letter. However, all computers have some fixed cache paths. If you want to access the Temp folder, you can enter the %temp% command on the computer to access it quickly. In the program, we call it viaEnvironment.GetFolderPath(Environment.SpecialF...
csharp-special-folder
Title : 获得电脑特殊文件夹的办法 官方连接:Environment.SpecialFolder 我们通常会在文件中加载一些缓存文件,方便下次运行的时候调取。如果使用硬盘地址如:H:\preview ,用户可能会出现没有H盘符的情况,但是所有的电脑都会有一些固定的缓存路径. 如果想要访问Temp文件夹,在电脑中我们可以输入%temp%命令快速进入,在程序中我们通过Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)调取,参数为枚举值,可以参照官方链接获得具体的地址。
QT Learning Path
Add Action12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667//mainwindow.h#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>QT_BEGIN_NAMESPACEnamespace Ui { class MainWindow; }QT_END_NAMESPACEclass MainWindow : public QMainWindow{ Q_OBJECTpublic: MainWindow(QWidget *parent = nullptr); ~MainWindow();private: Ui::MainWindow *ui; void open(); QAction *openAction;};#e...
QT 学习之路
添加动作12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667//mainwindow.h#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>QT_BEGIN_NAMESPACEnamespace Ui { class MainWindow; }QT_END_NAMESPACEclass MainWindow : public QMainWindow{ Q_OBJECTpublic: MainWindow(QWidget *parent = nullptr); ~MainWindow();private: Ui::MainWindow *ui; void open(); QAction *openAction;};#endif /...
Mysql Function to Query All Child Nodes Based on Parent Node
The data volume is 5k+. Referring to the function given in the blog, it takes 15s to run once, which is too long. So finally I didn’t choose to traverse data in Mysql, but traversed in the class when the user selects the parent node. The overall time consumption will be much smaller, and it will not bring lag feeling to the user. I don’t use Mysql functions much usually, so I record it for future learning use. After the function is created in Mysql, it will prompt the error message This func...
Mysql 根据父节点查询所有子节点函数
数据量5k+,参照博客中给出的函数,运行一次需要15s,耗时太长,所以最终没有选择在Mysql中进行数据的遍历,而是采用在用户选取父节点时,在类中遍历,总体耗时会小很多,也不会给用户带来尺钝感。 平时使用Mysql 的函数不多,所以还是记录下来以后学习使用 在Mysql 中函数创建后会提示This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de 的错误信息,参照博客:MySQL 创建函数报错 This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators 解决办法由两个: 在函数体前写一句 set global log_bin_trust_function_creators...
WCF Exceeded Maximum Message Size Quota for Incoming Message (65536). To increase quota, please use MaxReceivedMessageSize property on corresponding binding element.
Today when using WCF to pull data from database, reported this error, checked Web.config saw maxReciveMessageSize inside already set to max. Finally by modifying parameter in configuration file in WCF debugger, modifying number to max, reconfiguring can run successfully.Reference Blog:WCF Request Data: Exceeded Maximum Message Size Quota for Incoming Message (65536). To increase quota, please use MaxReceivedMessageSize property on corresponding binding element. If client receiving has proble...
WCF 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。
今天使用WCF从数据库拉取数据时,爆出这个错误,查看Web.config看到里面maxReciveMessageSize已经设置为最大,最后通过在WCF调试器中修改配置文件中的参数,将数修改为最大,重新配置后即可运行成功。参考博客:WCF请求数据:已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。 如果时客户端的接收出现问题,只需要去客户端的配置文件将配置容量进行设置即可 12345<bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IMysqlService" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/> </basic...










