如何编程在Revit里创建广联达直筋长度小于00.8mm的线

2778人阅读
概念说明(65)
Revit 二次开发入门(39)
问题:创建了一个新厚度的楼板族。FloorType newFamilyType = typeMoBan.Duplicate(sFmailyName) as FloorT在板的创建接口没有设置族的地方啊Floor newFloor = m_ReviteDoc.Create.NewSlab(temCurveArr, simLevelInfo.FloorLevel, banSlopArrowLine, dTemAnagle, true);如何使用这个新类型来创建楼板构件呢?答:创建楼本的还有其他方法: NewFloor(), &可以接受楼板类型来创建楼板.public
floorType,
structural
)或:public
floorType,
structural,
)如果你必须用NewSlab() 方法, 可以在NewSlab() 方法调用之后,给已经生成的板修改楼板类型.Floor.FloorType = targetFloorType.作者:叶雄进 Autodesk特聘开发咨询专家,橄榄山首席研发转载请注明原文出处。http://blog.csdn.net/joexiongjin/article/details/
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:814489次
积分:10755
积分:10755
排名:第853名
原创:276篇
评论:572条
(1)(2)(3)(1)(1)(2)(2)(4)(7)(6)(6)(3)(9)(4)(6)(8)(3)(1)(4)(4)(5)(7)(1)(7)(4)(3)(5)(4)(7)(7)(2)(6)(11)(6)(6)(14)(13)(11)(5)(7)(6)(3)(7)(4)(3)(3)(6)(2)(15)(6)(6)(14)怎么编程在Revit里创建长度小于0.8mm的线 - 编程当前位置:& &&&怎么编程在Revit里创建长度小于0.8mm的线怎么编程在Revit里创建长度小于0.8mm的线&&网友分享于:&&浏览:0次如何编程在Revit里创建长度小于0.8mm的线Revit不知为何出有一个奇怪的规矩,那就是无法绘制长度小于 0.8mm的长度的线. (0.8mm等于&32分之一英寸). 导致很多小的短线无法绘制.在轻钢薄壁构件里,其厚度有的只有0.5, 有的是0.7, 均无法绘制. 这给Revit的工作带来一些局限性.这里有一个用编程的办法来绕弯路创建小于0.8mm, 其用法确实有点难以想到.首先我们创建一个长度放大100倍的长线. 然后给这个线添加尺寸约束,并绑定到一个参数上. 最后指定参数的值为实际长度. 最后删除标准和临时参数. 这样就可以绘制出来长度小于0.8mm的线.下面是代码演示. 大家可以自己看下.[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
class RvtTestCommand : IExternalCommand
// member variables for top level access to the Revit database
public Application _
public Document m_
string BareFamilyName = &type1&;
// command main
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
_app = commandData.Application.A
m_doc = commandData.Application.ActiveUIDocument.D
UIApplication m_revit = commandData.A
Transaction trans = new Transaction(m_doc);
trans.Start(&crateshortline&);
DrawLine(_app.Create, m_doc, m_doc.ActiveView, true, new XYZ(0. / 304.8, 4. / 304.8, 0), new XYZ(0. / 304.8, 4. / 304.8, 0));
return Result.S
public XYZ GetEndPoint(Curve c, int index)
return c.GetEndPoint(index);
public Reference GetEndPointReference(Curve c, int index)
return c.get_EndPointReference(index);
public double MmToFeet(double mm)
return mm / 304.8;
public void DrawLine(Autodesk.Revit.Creation.Application appCreate, Document famDoc, View workView,bool bOnXYPlane, XYZ startPoint, XYZ endPoint)
XYZ _offset = new XYZ(0, 0, 0);
double dLength = startPoint.DistanceTo(endPoint);
if (dLength & 1/32.0/12.0)
if (dLength == 0)
else if ((dLength * 100) & 1 / 32.0 / 12.0)
TaskDialog.Show(&lengh check&,&Line too small to draw, even when multiplied by 100&);
XYZ ptVector = endPoint - startP
XYZ ptMultiplied = startPoint + ptVector * 100;
Line revitLine = appCreate.NewLineBound(ptMultiplied + _offset, startPoint + _offset);
DetailLine detailLine2 = famDoc.FamilyCreate.NewDetailCurve(workView, revitLine) as DetailL
XYZ ptTempLine = startPoint + new XYZ(MmToFeet(2.0), MmToFeet(1.855), 0);
Line revitLineTemp = appCreate.NewLineBound( ptTempLine + _offset, startPoint + _offset);
DetailLine detailLineTemp = famDoc.FamilyCreate.NewDetailCurve(workView, revitLineTemp) as DetailL
famDoc.Regenerate();
// dimension of whole length
ReferenceArray refArray = new ReferenceArray();
refArray.Append(GetEndPointReference(detailLine2.GeometryCurve, 0));
refArray.Append(GetEndPointReference(detailLine2.GeometryCurve, 1));
XYZ p1 = new XYZ(
GetEndPoint(revitLine, 0).X + 0.1,
GetEndPoint(revitLine, 0).Y + 0.1,
GetEndPoint(revitLine, 0).Z);
XYZ p2 = new XYZ(
GetEndPoint(revitLine, 1).X + 0.1,
GetEndPoint(revitLine, 1).Y + 0.1,
GetEndPoint(revitLine, 1).Z);
Line line = appCreate.NewLineBound(p1, p2);
Dimension dimensionTotal = famDoc.FamilyCreate.NewLinearDimension(workView, line, refArray);
FamilyParameter famParamL1 = famDoc.FamilyManager.get_Parameter(&smalllinelength&);
if (famParamL1 == null)
famParamL1 = famDoc.FamilyManager.AddParameter(&smalllinelength&, BuiltInParameterGroup.PG_GENERAL, ParameterType.Length, true);
if (famDoc.FamilyManager.Types.Size == 0)
famDoc.FamilyManager.NewType(this.BareFamilyName);
famDoc.FamilyManager.Set(famParamL1, dLength);
dimensionTotal.FamilyLabel = famParamL1;
famDoc.FamilyManager.Set(famParamL1, dLength); // needed to make it resize properly
famDoc.Delete(dimensionTotal.Id); // now remove the dimension, no longer needed
famDoc.FamilyManager.RemoveParameter(famParamL1); // now remove the parameter, no longer needed
famDoc.Delete(detailLineTemp.Id);
catch (System.Exception exception)
TaskDialog.Show(&exception&, exception.Message);
Line revitLine = appCreate.NewLineBound(startPoint + _offset, endPoint + _offset);
DetailLine detailLine2 = famDoc.FamilyCreate.NewDetailCurve(workView, revitLine) as DetailL
catch (System.Exception exception)
TaskDialog.Show(&exception&,exception.Message);
}作者:叶雄进 Autodesk特聘开发咨询专家,橄榄山软件首席研发转载请注明原文出处。http://blog.csdn.net/joexiongjin/article/details/
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有2780人阅读
概念说明(65)
Revit 二次开发入门(39)
问题:创建了一个新厚度的楼板族。FloorType newFamilyType = typeMoBan.Duplicate(sFmailyName) as FloorT在板的创建接口没有设置族的地方啊Floor newFloor = m_ReviteDoc.Create.NewSlab(temCurveArr, simLevelInfo.FloorLevel, banSlopArrowLine, dTemAnagle, true);如何使用这个新类型来创建楼板构件呢?答:创建楼本的还有其他方法: NewFloor(), &可以接受楼板类型来创建楼板.public
floorType,
structural
)或:public
floorType,
structural,
)如果你必须用NewSlab() 方法, 可以在NewSlab() 方法调用之后,给已经生成的板修改楼板类型.Floor.FloorType = targetFloorType.作者:叶雄进 Autodesk特聘开发咨询专家,橄榄山首席研发转载请注明原文出处。http://blog.csdn.net/joexiongjin/article/details/
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:814492次
积分:10755
积分:10755
排名:第853名
原创:276篇
评论:572条
(1)(2)(3)(1)(1)(2)(2)(4)(7)(6)(6)(3)(9)(4)(6)(8)(3)(1)(4)(4)(5)(7)(1)(7)(4)(3)(5)(4)(7)(7)(2)(6)(11)(6)(6)(14)(13)(11)(5)(7)(6)(3)(7)(4)(3)(3)(6)(2)(15)(6)(6)(14)

我要回帖

更多关于 长度不能小于 0 的文章

 

随机推荐