上一篇内容已经详细地列出了准备工作,所以这一次直接贴出代码,自行粘贴使用
Model myModel = new Model(); //实例化模型
Rhino.Geometry.Polyline line = null;
x.TryGetPolyline(out line); //将CURVE类型转换成polyline
Point3dList.XAccess pointX = line.X; //获取犀牛中线控制点的X值
Point3dList.YAccess pointY = line.Y; //获取犀牛中线控制点的Y值
Point3dList.ZAccess pointZ = line.Z; //获取犀牛中线控制点的Z值
Contour pointList = new Contour();
for (int i = 0; i < line.Count; i++)
{
pointList.ContourPoints.Add(new Tekla.Structures.Geometry3d.Point(pointX[i], pointY[i], pointZ[i]));
}
if (line.Count > 2)//如果点的数量大于2,该梁为折梁
{
PolyBeam polyBeam = new PolyBeam();
foreach (Tekla.Structures.Geometry3d.Point item in pointList.ContourPoints)
{
Tekla.Structures.Model.ContourPoint pop = new Tekla.Structures.Model.ContourPoint(new Tekla.Structures.Geometry3d.Point(item.X, item.Y, item.Z), null);//将犀牛中的点转换为t