我正在为Autodesk Revit 2014开发一个插件,将房间几何学转换为概念群体。但是当我运行这个脚本时,revit会完全关闭。我已经隔离了导致崩溃的代码:
Extrusion m_Extrusion = m_FamDoc.FamilyCreate.NewExtrusion(true, m_CurveArArray, m_SketchPlane, 8);而修改日志显示了这个错误:
n:\build\2014_ship_x64_inst_20130308_1515\source\revit\revitui\modscope\ModScope.cpp的第571行:检测到未冻结的选择变化。
有人知道我使用挤压命令有什么问题吗?还是在Revit里有什么?
提前谢谢。
发布于 2015-04-27 18:01:47
完全冻结是很奇怪的..。它可能与您的代码相关(在NewExtrusion调用之前)
实际上,这个方法有一个完整的示例,请参阅github:ColumnRectangle.cs上的这个文件中的ColumnRectangle.cs方法(第170行):
// ==========================================
// (1) create a simple solid by extrusion
// ==========================================
Extrusion createSolid()
{
//
// (1) define a simple rectangular profile
//
// 3 2
// +---+
// | | d h = height
// +---+
// 0 1
// 4 w
//
CurveArrArray pProfile = createProfileRectangle();
//
// (2) create a sketch plane
//
// we need to know the template. If you look at the template (Metric Column.rft) and "Front" view,
// you will see "Reference Plane" at "Lower Ref. Level". We are going to create an extrusion there.
// findElement() is a helper function that find an element of the given type and name. see below.
//
ReferencePlane pRefPlane = findElement(typeof(ReferencePlane), "Reference Plane") as ReferencePlane;
//SketchPlane pSketchPlane = _doc.FamilyCreate.NewSketchPlane( pRefPlane.Plane ); // 2013
SketchPlane pSketchPlane = SketchPlane.Create( _doc, pRefPlane.Plane ); // 2014
// (3) height of the extrusion
//
// once again, you will need to know your template. unlike UI, the alightment will not adjust the geometry.
// You will need to have the exact location in order to set alignment.
// Here we hard code for simplicity. 4000 is the distance between Lower and Upper Ref. Level.
// as an exercise, try changing those values and see how it behaves.
//
double dHeight = mmToFeet(4000.0);
// (4) create an extrusion here. at this point. just an box, nothing else.
//
bool bIsSolid = true;
return _doc.FamilyCreate.NewExtrusion(bIsSolid, pProfile, pSketchPlane, dHeight);
}发布于 2014-01-13 00:54:08
您是否为此创建了事务?类似的东西:使用(Transaction trans =新事务(doc,"Extrude")) { trans.Start();Extrude m_extrusion =m_FamDoc.FamilyCreate.NewExtrusion.trans.Commit();}
发布于 2022-02-08 09:24:05
通过定义任何类型的Array,我的代码中也出现了同样的问题。经过几周的大搜索,我什么也没有发现,但我意识到我使用了点网框架5.0版本,当我把它改为点网框架4.8时,一切都好了。
https://stackoverflow.com/questions/19298718
复制相似问题