/// <summary> /// Create a extrusion roof. /// </summary> private void createExtrusionRoof() { try { if (m_roofsManager.Profile.Size != 0) { Autodesk.Revit.DB.Level level = this.refLevelComboBox.SelectedItem as Autodesk.Revit.DB.Level; Autodesk.Revit.DB.RoofType roofType = this.extrusionRoofTypesComboBox.SelectedItem as Autodesk.Revit.DB.RoofType; Autodesk.Revit.DB.ReferencePlane refPlane = refPanesComboBox.SelectedItem as Autodesk.Revit.DB.ReferencePlane; if (level != null && roofType != null && refPlane != null) { Autodesk.Revit.DB.ExtrusionRoof roof = m_roofsManager.CreateExtrusionRoof(refPlane, level, roofType, m_start, m_end); if (roof == null) { MessageBox.Show("Invalid profile"); } else { this.extrusionRoofsListView.Items.Add(new RoofItem(roof)); this.extrusionRoofsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } } } else { MessageBox.Show("You should supply profile to create extrusion roof, click select button to select profile in Revit."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static void GetFamilyTemplateReferencePlanes(FamilyTemplate famTemplate, Document doc, User user) { if (doc != null) { if (famTemplate.FamilyTemplateReferencePlanes.InternalCollection.Count <= 0) { List <Element> referencePlaneElementList = new FilteredElementCollector(doc).OfClass(typeof(Autodesk.Revit.DB.ReferencePlane)).ToElements() as List <Element>; foreach (Element element in referencePlaneElementList) { Autodesk.Revit.DB.ReferencePlane plane = (Autodesk.Revit.DB.ReferencePlane)element as Autodesk.Revit.DB.ReferencePlane; ReferencePlane refPlane = ReferencePlane.NewReferencePlane(famTemplate.internalSQLConenction, famTemplate.FamilyTemplateReferencePlanes.InternalDataView, user); refPlane.Name = plane.Name; refPlane.FamiltyId = famTemplate.Id; refPlane.ElementId = plane.Id.IntegerValue; refPlane.UniqueId = plane.UniqueId; refPlane.LevelId = plane.LevelId.IntegerValue; refPlane.ViewId = plane.OwnerViewId.IntegerValue; if (plane.Category != null) { refPlane.Category = plane.Category.Name; } else { refPlane.Category = "None"; } refPlane.DirectionX = plane.Direction.X; refPlane.DirectionY = plane.Direction.Y; refPlane.DirectionZ = plane.Direction.Z; refPlane.BubbleEndX = plane.BubbleEnd.X; refPlane.BubbleEndY = plane.BubbleEnd.Y; refPlane.BubbleEndZ = plane.BubbleEnd.Z; refPlane.NormalX = plane.Normal.X; refPlane.NormalY = plane.Normal.Y; refPlane.NormalZ = plane.Normal.Z; refPlane.FreeEndX = plane.FreeEnd.X; refPlane.FreeEndY = plane.FreeEnd.Y; refPlane.FreeEndZ = plane.FreeEnd.Z; refPlane.IsActive = true; refPlane.CreatedById = user.Id; refPlane.CreatedBy = user; refPlane.ModifiedBy = user; refPlane.ModifiedById = user.Id; refPlane.EndEdit(); } } else { } } }
/// <summary> /// Initialize a roof element /// </summary> private void InitRoof(CurveArray curves, Autodesk.Revit.DB.ReferencePlane reference, Autodesk.Revit.DB.Level level, Autodesk.Revit.DB.RoofType roofType, double extrusionStart, double extrusionEnd) { TransactionManager.Instance.EnsureInTransaction(Document); Autodesk.Revit.DB.RoofBase roof = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.RoofBase>(Document); if (roof == null) { roof = Document.Create.NewExtrusionRoof(curves, reference, level, roofType, extrusionStart, extrusionEnd); } else { roof = Document.Create.NewExtrusionRoof(curves, reference, level, roofType, extrusionStart, extrusionEnd); } InternalSetRoof(roof); TransactionManager.Instance.TransactionTaskDone(); ElementBinder.CleanupAndSetElementForTrace(Document, InternalRoof); }
public static ReferencePlane Wrap(Autodesk.Revit.DB.ReferencePlane ele, bool isRevitOwned) { return(ReferencePlane.FromExisting(ele, isRevitOwned)); }
/// <summary> /// Private constructor /// </summary> private Roof(CurveArray curves, Autodesk.Revit.DB.ReferencePlane reference, Autodesk.Revit.DB.Level level, Autodesk.Revit.DB.RoofType roofType, double extrusionStart, double extrusionEnd) { SafeInit(() => InitRoof(curves, reference, level, roofType, extrusionStart, extrusionEnd)); }
public RefPlane(Autodesk.Revit.DB.ReferencePlane rp) { Id = rp.Id.IntegerValue; RefPlaneName = rp.Name; }
/// <summary> /// Internal reference plane /// </summary> /// <param name="referencePlane"></param> private ReferencePlane(Autodesk.Revit.DB.ReferencePlane referencePlane) { this.InternalReferencePlane = referencePlane; }
/// <summary> /// Set the InternalReferencePlane and update the element id and unique id /// </summary> /// <param name="rp"></param> private void InternalSetReferencePlane(Autodesk.Revit.DB.ReferencePlane rp) { this.InternalReferencePlane = rp; this.InternalElementId = rp.Id; this.InternalUniqueId = rp.UniqueId; }
/// <summary> /// Initialize a ReferencePlane element /// </summary> /// <param name="referencePlane"></param> private void InitReferencePlane(Autodesk.Revit.DB.ReferencePlane referencePlane) { InternalSetReferencePlane(referencePlane); }
/// <summary> /// Internal reference plane /// </summary> /// <param name="referencePlane"></param> private ReferencePlane(Autodesk.Revit.DB.ReferencePlane referencePlane) { SafeInit(() => InitReferencePlane(referencePlane)); }
public ReferencePlane(DB.ReferencePlane value) : base(value) { }