如何编程创建自适应构件对象
展开全部
先创建一个对象,然后为每一个点设置坐标。
[csharp] view plain copy
private void CreateAdaptiveComponentInstance(Document document, FamilySymbol symbol)
{
// Create a new instance of an adaptive component family
FamilyInstance instance = AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(document, symbol);
// Get the placement points of this instance
IList<ElementId> placePointIds = new List<ElementId>();
placePointIds = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(instance);
double x = 0;
// Set the position of each placement point
foreach (ElementId id in placePointIds)
{
ReferencePoint point = document.GetElement(id) as ReferencePoint;
point.Position = new Autodesk.Revit.DB.XYZ(10*x, 10*Math.Cos(x), 0);
x += Math.PI/6;
}
}
[csharp] view plain copy
private void CreateAdaptiveComponentInstance(Document document, FamilySymbol symbol)
{
// Create a new instance of an adaptive component family
FamilyInstance instance = AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(document, symbol);
// Get the placement points of this instance
IList<ElementId> placePointIds = new List<ElementId>();
placePointIds = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(instance);
double x = 0;
// Set the position of each placement point
foreach (ElementId id in placePointIds)
{
ReferencePoint point = document.GetElement(id) as ReferencePoint;
point.Position = new Autodesk.Revit.DB.XYZ(10*x, 10*Math.Cos(x), 0);
x += Math.PI/6;
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询