获取REVIT Reference的法向量和原点

// 标记子构件的参考面时,需要依据Reference确定最外侧的标记进行总体标注。如顶部标记的最左侧和最右侧
// 构建参考线,将所有Reference的点向参考线投影,获取最左侧和最右侧Reference
public static bool GetFamilyInstanceReferencePlaneLocation( FamilyInstance fi, Reference r, out XYZ origin, out XYZ normal, bool needTrans=false) { bool found = false; origin = XYZ.Zero; normal = XYZ.Zero; if (null != r) { Document doc = fi.Document; using (Transaction t = new Transaction(doc)) { if (needTrans) t.Start("Create Temporary Sketch Plane"); using (SubTransaction st = new SubTransaction(doc)) { st.Start(); SketchPlane sk = SketchPlane.Create(doc, r); if (null != sk) { Plane pl = sk.GetPlane(); origin = pl.Origin; normal = pl.Normal; found = true; } st.RollBack(); } if (needTrans) t.RollBack(); } } return found; }

  

posted @ 2024-01-30 16:14  huihuang88515  阅读(22)  评论(0)    收藏  举报