revit

Revit二次开发: 文件损坏

匿名 (未验证) 提交于 2019-12-02 22:10:10
哪些因素可能会导致损坏? 损坏的原因也各不相同,包括但不限于 无法读取/写入存储介质 程序发生崩溃(特别是在数据写入 RVT 模型时) 附加模块以通过正常 UI 无法或意外的方式修改图元 未经测试的多项操作或一系列操作(例如,取消同步或在同步后使用“撤消”命令) 解决方案: 要最大程度地减少数据损坏的发生率,请执行以下操作: 注意:如果您使用的是 2017 版本的 Revit,请务必安装 2017.1 Update,因为其中包含专门用于解决损坏的更改:修复损坏的中心模型 确保您有项目的正确备份副本 在编辑会话期间可能会造成损坏。当这种情况出现时,每个保存操作均会导致正确备份丢失并创建错误备份。如果自动备份的数目小于保存操作的次数,则所有正确备份均会丢失。要确保您拥有正确备份,请执行以下一项或两项操作: 增加自动备份的数目,该数目应大于单个编辑任务内执行的保存次数。 例如,如果每个编辑任务平均保存次数少于 50,请将该备份数目增加至大于 50。 执行手动备份。 除了自动备份以外,还应创建项目的单独副本 定期核查项目 最常见的情况是,您应该每周核查一次,但如果项目的变更率较高,则核查更频繁。Revit 尝试容忍错误,并尽可能忽略它。但是,随着错误数量的不断增加,最终它将无法继续运行。使用核查可以清除有问题的数据,并在核查开始失败时显示警告 确保 Revit 已更新

【Revit API】创建相机视角

匿名 (未验证) 提交于 2019-12-02 22:10:10
在Revit中有一个相机功能可以以相机视角产生一个视图。一开始我在2016中找关键词Camera,但是没什么收获。 其实这个相机功能的真正核心是创建透视视图:View3D.CreatePerspective(Document, ElementId) 简单的代码示例如下: var uiDocument = commandData.Application.ActiveUIDocument;var doc = uiDocument.Document;IEnumerable<ViewFamilyType> viewFamilyTypes = from elem in new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)) let type = elem as ViewFamilyType where type.ViewFamily == ViewFamily.ThreeDimensional select type; using (Transaction tran = new Transaction(doc, "[ToolSet] Camera")) { tran.start(); View3D view3D = View3D.CreatePerspective(doc, viewFamilyTypes.First

【Revit API】创建工作集并将element加入工作集中

匿名 (未验证) 提交于 2019-12-02 22:10:10
话不多说,直接上代码! public class WorkSetHelper { public void AddElementsToWorkSet(Document doc, List<Element> elements) { if (doc.IsWorkshared == true) { var workset = GetWorkset(doc); if (workset != null) { var worksetID = workset.Id.IntegerValue; using (Transaction tran = new Transaction(doc, "[ToolSet] Add Elemens To WorkSet")) { tran.Start(); foreach (var ele in elements) { Parameter wsparam = ele.get_Parameter(BuiltInParameter.ELEM_PARTITION_PARAM); if (wsparam != null) { wsparam.Set(worksetID); } } tran.Commit(); } } } } public Workset GetWorkset(Document doc) { Workset newWorkset = null; //

Revit Python Pick Object / Select Object

爷,独闯天下 提交于 2019-12-01 13:10:42
I'm fairly new to coding, so this might be obvious. Why do I get an error "name 'ObjectType' not defined" when I run this code: picked = uidoc.Selection.PickObject(ObjectType.Element) I'm using revit python shell (IronPython) You should import ObjectType into the current scope: >>> from Autodesk.Revit.UI.Selection import ObjectType >>> picked = uidoc.Selection.PickObject(ObjectType.Element) I have just tried this out in the RevitPythonShell and have noticed, that it doesn't work, because the shell is still in the foreground. So, this technique will work for scripts that you add to the Ribbon,

Revit Python Pick Object / Select Object

无人久伴 提交于 2019-12-01 10:11:45
问题 I'm fairly new to coding, so this might be obvious. Why do I get an error "name 'ObjectType' not defined" when I run this code: picked = uidoc.Selection.PickObject(ObjectType.Element) I'm using revit python shell (IronPython) 回答1: You should import ObjectType into the current scope: >>> from Autodesk.Revit.UI.Selection import ObjectType >>> picked = uidoc.Selection.PickObject(ObjectType.Element) I have just tried this out in the RevitPythonShell and have noticed, that it doesn't work, because

Can I make the default AppDomain use shadow copies of certain assemblies?

巧了我就是萌 提交于 2019-11-30 06:48:32
问题 A short explanation of why I want to do this: I am busy writing a plugin for Autodesk Revit Architecture 2010. Testing my plugin code is extremly cumbersome, as I have to restart Autodesk for each debug session, manually load a Revit project, click on the Add-Ins tab and then start my plugin. This is just taking too long. I have written a second plugin that hosts an IronPython interpreter. This way, I can play around with the API provided by Revit. But eventually, the code has to be rewritten

三、VersionChecking

你。 提交于 2019-11-29 08:29:05
Autodesk.Revit.UI.IExternalCommand Autodesk.Revit.ApplicationServices.Application Subject: Version information of Revit application. 1、Application对象里包括了@Rervit版本信息和产品信息 .VersionBuild .VersionName .VersionNumber .Product .Language 来源: https://www.cnblogs.com/liuxinyong/p/11494147.html

Can I make the default AppDomain use shadow copies of certain assemblies?

放肆的年华 提交于 2019-11-28 21:40:42
A short explanation of why I want to do this: I am busy writing a plugin for Autodesk Revit Architecture 2010. Testing my plugin code is extremly cumbersome, as I have to restart Autodesk for each debug session, manually load a Revit project, click on the Add-Ins tab and then start my plugin. This is just taking too long. I have written a second plugin that hosts an IronPython interpreter. This way, I can play around with the API provided by Revit. But eventually, the code has to be rewritten in C# - and debugged. Easy, I thought: Just load the plugins DLL from the IronPython script and

REVIT 卸载工具,完美彻底卸载清除干净revit各种残留注册表和文件

那年仲夏 提交于 2019-11-27 16:17:11
一些同学安装revit出错了,也有时候想重新安装revit的时候会出现这种本电脑windows系统已安装revit,你要是不留意直接安装,只会安装revit的附件,revit是不会安装上的。这种原因呢就是大家在之前卸载revit时没有吧revit残留信息删除,下面我来教大家把revit卸载然后重新安装,最后完美安装运行revit。如果纯手工删除revit会有几千条注册表记录要删,这里会使用一个修复卸载工具auto uninstaller AUTO Uninstaller 更新下载地址 1、在软件中选择revit 2、选择revit的版本 3、点击“开始卸载/修复”按钮,等待卸载结束 4、重新安装、可以使用了 转载于:https://www.cnblogs.com/98Kar/p/10451677.html 来源: CSDN 作者: weixin_33717117 链接: https://blog.csdn.net/weixin_33717117/article/details/94727269

Revit获取安装路径,零依赖Revit提供的dll

℡╲_俬逩灬. 提交于 2019-11-27 16:14:31
通过RevitAddInUtility.dll提供的方法,我们很容易获取到一些本地Revit安装的信息,比如安装的版本,安装路径,和插件配置文件所在的文件夹等。 但如果你对代码有洁癖,觉得为了这么点事儿,没必要去引用一个外部Dll。或者其他别的什么原因都可以,导致不想去引用 RevitAddInUtility.dll这个类库,同时又想获取到Revit安装的相关信息怎么办呢? 我们可以通过读取注册表来获取我们想要的信息。 Revit安装信息,在注册表中按如下键值存放。 我给出了一种获取Revit安装信息的方法。其中包括两个类,存放Revit安装信息的RevitItem类,和构建RevitItem信息的RevitManager类。如果有需要的话可以直接拷贝到项目中,直接运行即可 RevitItem类 /// <summary> /// Revit安装信息 /// </summary> public class RevitItem { internal RevitItem(string name,string revitFile) { Name = name; RevitFile = revitFile; AllUsersAddInFolder = RevitManager.GetAllUsersAddInFolder(name); CurrentUserAddInFolder=