revit二次开发——自适应构件族

自适应构件族有着强大的功能,在桥梁建模里非常实用。

自适应族重要的类:AdaptiveComponentInstanceUtils
自适应族实例化:CreateAdaptiveComponentInstance
得到自适应点的ID:GetInstancePlacementPointElementRefIds
自适应点的位置:Position
自适应点和元素关联起来:SetPointElementReference


下面贴一段代码作为例子方便使用。

 bool modelCurveZhu = revitDoc.LoadFamilySymbol(TempFamily.FamilyPath_first, System.IO.Path
                            .GetFileNameWithoutExtension(TempFamily.FamilyPath_first), out familySymbol);   //这里的族一定要有类型才行
                        familySymbol.Activate();   //激活族类型
 famIns1 = AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(revitDoc, familySymbol);   //自适应族实例化
                    IList placePointIds = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(famIns1);
                     point = revitDoc.GetElement(placePointIds[0]) as ReferencePoint;                //自适应构件族的自适应点
                    point.Position = modelCurve.GeometryCurve.GetEndPoint(0); 


                    PointLocationOnCurve pointLocationOnCurve00 = new PointLocationOnCurve(PointOnCurveMeasurementType.NormalizedCurveParameter, 
                        0, PointOnCurveMeasureFrom.Beginning);
                    PointOnEdge poe00 = revitApp.Create.NewPointOnEdge(modelCurve.GeometryCurve.Reference, pointLocationOnCurve00);  /将自适应点和模型线关联起来
                    point.SetPointElementReference(poe00 as PointElementReference);


你可能感兴趣的:(revit二次开发)