Revit PromptForFamilyInstancePlacementOptions 族放置API
这段时间在做族库,在做到最后需要与Revit连同时,希望可以用户选择下载然后直接在Revit中布置构件,查找API ,发现可以使用PromptForFamilyInstancePlacementOptions方法实现族放置。 代码 比较简单,只不过需要记住,由于PromptForFamilyInstancePlacementOptions会自己创建一个事务,所以使用的话需要将此方法挪出事务。 code: 1234567891011121314151617181920212223242526Family family; using (Transaction trans = new Transaction(app.ActiveUIDocument.Document,"load family")) { trans.Start(); var loa...
Revit PromptForFamilyInstancePlacementOptions Family Placement API
Doing family library during this period, when needed to connect with Revit at the end, hoping users can choose to download and then directly arrange components in Revit. Searching API, found PromptForFamilyInstancePlacementOptions method can be used to implement family placement. The code is relatively simple, but need to remember, since PromptForFamilyInstancePlacementOptions will create a transaction itself, so if using it, need to move this method out of transaction. code: 1234567891011121...
WCF Exceeded Max Quota (65536)
Today pulling 500 records from database via WCF connection reported this error. Baidu problem found most solutions are modifying ServiceModel parameter of App.config, as follows 123456789101112131415<bindings> <basicHttpBinding> <binding name="webIn" sendTimeout="00:30:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed"> <...
WCF 超出最大配额(65536)
今天通过WCF连接数据库拉取500条数据报出这个错误,百度问题发现大部分解决办法都是修改App.config的’ServiceModel`参数,如下 123456789101112131415<bindings> <basicHttpBinding> <binding name="webIn" sendTimeout="00:30:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength=...
WCF 找不到具有绑定 NetTcpBinding 的终结点的与方案 net.tcp 匹配的基址。注册的基址方案是 [http]。
原本WCF只使用了< BasicHttpBinding >,现在新增net.tcp协议,添加后服务器报错找不到具有绑定 NetTcpBinding 的终结点的与方案 net.tcp 匹配的基址。注册的基址方案是 [http]。,检查Web.config与网站配置之后依旧报错。最后参照 WCF:如何将net.tcp协议寄宿到IIS,在网站->绑定->添加net.tcp协议 ,情况解决。如果刚开始配置,不要忘记在高级设置中增加net.tcp协议 Web.config配置文件 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172<?xml version="1.0" encoding="utf-8"?><configuration> <appSettings> &...
WCF Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
Originally WCF only used < BasicHttpBinding >, now added net.tcp protocol. After adding server reported error Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]., checked Web.config and website configuration still reported error.Finally referred to WCF: How to host net.tcp protocol to IIS, in Website->Binding->Add net.tcp protocol, situation solved.If just starting configuration, don’t f...
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 调整SplitContainer中Panel的大小
点击Panel后点击ESC取消然后将鼠标移动到边界上即可调整大小
Winform Resize Panel in SplitContainer
Click Panel then click ESC to cancel then move mouse to boundary to resize
MySQL 锁粒度与ACID
表锁(Table Lock):它会锁定整张表。一个用户在对表进行写操作(插入、删除、更新等)钱,他需要先获得写锁,这会阻塞其他用户对该表的所有读写操作。没有写锁的时候,其他用户可以获得读锁,多用户之间的读锁相互不阻塞。行级锁(row lock):行级锁能够最大程度的支持并发处理(同时也带来了最大的所开销)。 ACIDACID表示原子性(atomicity)、一致性(consistency)、隔离性(isolation)和持久性(durability) 原子性(atomicity):一个事务必须被视为一个最小的工作单元,整个事务中的所有操作要么全部提交成功,要么全部失败回滚,对于一个事务来说,不可能只执行其中的一部分操作一致性(consistency):数据库总时哦才能够一个一致性的状态转换到另外一个一致性的状态。在执行事务某条语句的时候系统突然蹦会,导致事务最终没有提交,所以事务所作的修改也不会保存到数据库中隔离性(isolation):通常来说,一个事务所作的修改在最终提交以前,对其他事务是不可见的。在一个事务没有执行结束时,对事务的修改不会影响外部数据。持久性(durabil...
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...
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)调取,参数为枚举值,可以参照官方链接获得具体的地址。

![WCF 找不到具有绑定 NetTcpBinding 的终结点的与方案 net.tcp 匹配的基址。注册的基址方案是 [http]。](https://cdn.bimath.com/blog/pg/24c0ff56deac8ab4315bc9a5d21486b1.png)




