Reinforcement--Revit钢筋创建
钢筋创建——High
Show how to create Rebar in concrete element (Beam or Column) which does not have any reinforcement.
如何给不含任何钢筋的混凝土图元(梁或柱)创建钢筋
效果图:
|——Rebar.CreateFromCurves
param | description |
---|---|
doc | Document,Revit本身doc |
style | 枚举:RebarStyle.Standard/StirrupTie |
barType | Autodesk.Revit.DB.Structure.RebarBarType——8 HRB400 |
startHook | 起始点的钢筋弯钩形式 |
endHook | 终点的钢筋弯钩形式 |
host | 宿主元素 |
norm | 钢筋平面的法线方向 |
curves | 钢筋的曲线 |
startHookOrient | 起始弯钩朝向 |
endHookOrient | 终点弯钩朝向 |
useExistingShapeIfPossible | 匹配已有的钢筋形状 |
createNewShape | 如果有shape了就创建失败 |
创建钢筋核心代码
protected Rebar PlaceRebars(
RebarBarType rebarType,
RebarHookType startHook,
RebarHookType endHook,
RebarGeometry geomInfo,
RebarHookOrientation startOrient,
RebarHookOrientation endOrient)
{
Autodesk.Revit.DB.XYZ normal = geomInfo.Normal; // the direction of rebar distribution
IList<Curve> curves = geomInfo.Curves; // the shape of the rebar curves
// Invoke the NewRebar() method to create rebar 钢筋创建
Rebar createdRebar = Rebar.CreateFromCurves(m_revitDoc, Autodesk.Revit.DB.Structure.RebarStyle.Standard, rebarType, startHook, endHook, m_hostObject, normal, curves,startOrient, endOrient, false, true);
if (null == createdRebar) // Assert the creation is successful
{
return null;
}
// Change the rebar number and spacing properties to the user wanted
SetRebarSpaceAndNumber(createdRebar, geomInfo.RebarNumber, geomInfo.RebarSpacing);
return createdRebar;
}
// 钢筋阵列
protected static void SetRebarSpaceAndNumber(Rebar bar, int number, double spacing)
{
// Asset the parameter is valid
if (null == bar || 2 > number || 0 > spacing)
{
return;
}
// Change the rebar number and spacing properties
// 根据GetShapeDrivenAccessor来阵列
bar.GetShapeDrivenAccessor().SetLayoutAsNumberWithSpacing(number, spacing, true, true, true);
}
BIM树洞
做一个静谧的树洞君
用建筑的语言描述IT事物;
用IT的思维解决建筑问题;
共建BIM桥梁,聚合团队。
本学习分享资料不得用于商业用途,仅做学习交流!!如有侵权立即删除!!
-
微信公众号: BIM树洞
-
知乎专栏:BIM树洞
-
气氛组博客:http://www.31bim.com
-
BIM应用及咨询,CAD,Revit, OpenGL,图形开发交流,加Q群1083064224