private void CreateInnerMass(View view)
{
CurveLoop cl = GetCurveloop(view);
IList<CurveLoop> cls = new List<CurveLoop>();
cls.Add(cl);
DirectShape ds = CreateSphereDirectShape(cls, view.ViewDirection);
}
private CurveLoop GetCurveloop(View view)
{
CurveLoop cl = new CurveLoop();
BoundingBoxXYZ box = view.CropBox;
Transform tf = box.Transform;
XYZ min = tf.OfPoint(box.Min);
XYZ max = tf.OfPoint(box.Max);
var plan = Plane.CreateByOriginAndBasis(tf.Origin, tf.BasisX, tf.BasisY);
if (plan != null)
{
min = plan.Project(min);
max = plan.Project(max);
var list = max.GetRectange(min, tf.BasisX, tf.BasisY);
cl = CurveLoop.Create(list.ToList<Curve>());
}
return cl;
}
private DirectShape CreateSphereDirectShape(IList<CurveLoop> cls, XYZ vec)
{
double thick = 1d.ToApi();
Solid solid = GeometryCreationUtilities.CreateExtrusionGeometry(cls, vec, thick);
DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_Mass));
if (ds != null)
{
//ds.ApplicationId = "Application id";
//ds.ApplicationDataId = "Geometry object id";
ds.AppendShape(new List<GeometryObject>() { solid });
return ds;
}
return null;
}
revit二次开发 内建体量
猜你喜欢
转载自blog.csdn.net/zouzouol/article/details/82842067
今日推荐
周排行