/// <summary> /// Get all selected lines and arcs /// </summary> /// <param name="document">Revit's document</param> /// <returns>CurveArray contains all selected lines and arcs</returns> private CurveArray GetSelectedCurves(ThisDocument document) { CurveArray selectedCurves = m_doc.Document.Application.Create.NewCurveArray(); ElementSet elements = new ElementSet(); foreach (var elementid in document.Selection.GetElementIds()) { elements.Insert(m_doc.Document.GetElement(elementid)); } foreach (Autodesk.Revit.DB.Element element in elements) { if ((element is ModelLine) || (element is ModelArc)) { ModelCurve modelCurve = element as ModelCurve; Curve curve = modelCurve.GeometryCurve; if (curve != null) { selectedCurves.Append(curve); } } else if ((element is DetailLine) || (element is DetailArc)) { DetailCurve detailCurve = element as DetailCurve; Curve curve = detailCurve.GeometryCurve; if (curve != null) { selectedCurves.Append(curve); } } } return(selectedCurves); }
/// <summary> /// Default constructor of StructuralLayerFunction /// </summary> public StructuralLayerFunction(ThisDocument hostDoc) { // Init for varialbes // this document handler m_doc = hostDoc; m_functions = new ArrayList(); }
/// <summary> /// Constructor /// </summary> /// <param name="application">Revit application</param> /// <param name="selectedCurves">Array contains geometry curves of selected lines or arcs </param> /// <param name="labels">List contains all existing labels in Revit document</param> public CreateWithSelectedCurvesData(ThisDocument thisDoc, CurveArray selectedCurves, ArrayList labels) { m_thisDoc = thisDoc; m_revit = thisDoc.Document.Application; m_selectedCurves = selectedCurves; m_labelsList = labels; }
/// <summary> /// Initialization and find out a slab's Level, Type name, and set the Span Direction properties. /// </summary> /// <param name="revit">The revit object for the active instance of Autodesk Revit.</param> /// <returns>A value that signifies if your intitialization was successful for true or failed for false.</returns> private bool Initialize(ThisDocument uidoc) { m_slabComponentId = uidoc.Selection.GetElementIds(); // There must be exactly one slab selected if (m_slabComponentId.Count == 0) { // nothing selected MessageBox.Show("Please select a slab."); return(false); } else if (1 != m_slabComponentId.Count) { // too many things selected MessageBox.Show("Please select only one slab."); return(false); } foreach (ElementId eid in m_slabComponentId) { Element e = uidoc.Document.GetElement(eid); // If the element isn't a slab, give the message and return failure. // Else find out its Level, Type name, and set the Span Direction properties. if ("Autodesk.Revit.DB.Floor" != e.GetType().FullName) { MessageBox.Show("A slab should be selected."); return(false); } // Change the element type to floor type m_slabFloor = e as Floor; // Get the layer information from the type object by using the CompoundStructure property // The Layers property is then used to retrieve all the layers m_slabLayerCollection = m_slabFloor.FloorType.GetCompoundStructure().GetLayers(); m_numberOfLayers = m_slabLayerCollection.Count; // Get the Level property by the floor's Level property m_level = m_doc.Document.GetElement(m_slabFloor.LevelId).Name; // Get the Type name property by the floor's FloorType property m_typeName = m_slabFloor.FloorType.Name; // The span direction can be found using generic parameter access // using the built in parameter FLOOR_PARAM_SPAN_DIRECTION Parameter spanDirectionAttribute; spanDirectionAttribute = m_slabFloor.get_Parameter(BuiltInParameter.FLOOR_PARAM_SPAN_DIRECTION); if (null != spanDirectionAttribute) { // Set the Span Direction property this.SetSpanDirection(spanDirectionAttribute.AsDouble()); } } return(true); }
/// <summary> /// Default constructor of StructuralLayerFunction /// </summary> public SampleProjectInfo(ThisDocument hostDoc) { // Init for varialbes // this application handler m_doc = hostDoc; // initialize global information RevitStartInfo.RevitApp = m_doc.Application.Application; RevitStartInfo.RevitDoc = m_doc.Document; RevitStartInfo.RevitProduct = m_doc.Application.Application.Product; }
/// <summary> /// Get all model and detail lines/arcs within selected elements /// </summary> /// <param name="document">Revit's document</param> /// <returns>ElementSet contains all model and detail lines/arcs within selected elements </returns> public static ICollection <ElementId> GetSelectedModelLinesAndArcs(ThisDocument thisDocument) { var tmpIds = new List <ElementId>(); ElementSet elements = new ElementSet(); foreach (ElementId elementid in thisDocument.Selection.GetElementIds()) { elements.Insert(thisDocument.Document.GetElement(elementid)); } foreach (Autodesk.Revit.DB.Element element in elements) { if ((element is ModelLine) || (element is ModelArc) || (element is DetailLine) || (element is DetailArc)) { tmpIds.Add(element.Id); } } return(tmpIds); }
/// <summary> ///constructor /// </summary> public RoomsData(ThisDocument hostAddIn, Autodesk.Revit.ApplicationServices.Application application) { m_application = application; m_thisDocument = hostAddIn; RoomFilter roomFilter = new RoomFilter(); RoomTagFilter roomTagFilter = new RoomTagFilter(); LogicalOrFilter orFilter = new LogicalOrFilter(roomFilter, roomTagFilter); FilteredElementIterator elementIterator = (new FilteredElementCollector(m_thisDocument.Document)).WherePasses(orFilter).GetElementIterator(); elementIterator.Reset(); // try to find all the rooms and room tags in the project and add to the list while (elementIterator.MoveNext()) { object obj = elementIterator.Current; // find the rooms, skip those rooms which don't locate at Level yet. Room tmpRoom = obj as Room; if (null != tmpRoom && null != tmpRoom.Level) { m_rooms.Add(tmpRoom); continue; } // find the room tags RoomTag tmpTag = obj as RoomTag; if (null != tmpTag) { m_roomTags.Add(tmpTag); continue; } } //find out the rooms that without tag ClassifyRooms(); }
/// <summary> /// Ctor with ThisDocument as /// </summary> /// <param name="hostApp">ThisDocument handler</param> public DeleteObject(ThisDocument hostDoc) { m_doc = hostDoc; }
/// <summary> /// ctor wit parameter used to call this sample. /// </summary> /// <param name="doc"></param> public CapitalizeText(ThisDocument hostDoc) { m_doc = hostDoc.Document; }
/// <summary> /// GridCreation init /// </summary> /// <param name="hostApp"></param> public GridCreation(ThisDocument hostDoc) { m_doc = hostDoc; }
/// <summary> /// Constructor /// </summary> /// <param name="application">Application object</param> /// <param name="dut">Current length display unit type</param> /// <param name="labels">All existing labels in Revit's document</param> public CreateRadialAndArcGridsData(ThisDocument doc, DisplayUnitType dut, ArrayList labels) { m_doc = doc; m_labelsList = labels; m_dut = dut; }
/// <summary> /// Constructor /// </summary> /// <param name="application">Application object</param> /// <param name="dut">Current length display unit type</param> /// <param name="labels">All existing labels in Revit's document</param> public CreateOrthogonalGridsData(ThisDocument thisDoc, DisplayUnitType dut, ArrayList labels) { m_thisDoc = thisDoc; m_labelsList = labels; m_dut = dut; }
/// <summary> /// Ctor with ThisDocument as /// </summary> /// <param name="hostApp">ThisDocument handler</param> public RotateFramingObjects(ThisDocument hostDoc) { m_doc = hostDoc; }
/// <summary> /// Ctor with ThisDocument as /// </summary> /// <param name="hostApp">ThisDocument handler</param> public InplaceFamilyAnalyticalModel3D(ThisDocument hostDoc) { m_doc = hostDoc; }
/// <summary> /// ctor wit parameter used to call this sample. /// </summary> /// <param name="doc"></param> public FindAndReplaceText(ThisDocument hostDoc) { m_doc = hostDoc.Document; }
/// <summary> /// ctor wit parameter used to call this sample /// </summary> /// <param name="hostApp"></param> public CreateBeamsColumnsBraces(ThisDocument hostDoc) { m_doc = hostDoc; }
/// <summary> /// Default constructor of StructuralLayerFunction /// </summary> public SamplesRoom(ThisDocument hostDoc) { // Init for varialbes // this document handler m_doc = hostDoc; }
/// <summary> /// ctor wit parameter used to call this sample. /// </summary> /// <param name="doc"></param> public QuickPrint(ThisDocument hostDoc) { m_doc = hostDoc.Document; }
/// <summary> /// ctor wit parameter used to call this sample. /// </summary> /// <param name="doc"></param> public FindAndReplaceWinType(ThisDocument hostDoc) { m_doc = hostDoc.Document; }
public Common(string fn) { UContainer = ThisDocument.Register4Unity(); UpdateDatesInTestTemplates(); Invoice = InvoiceFactory.LoadTemplate(fn); }
public Common() { UContainer = ThisDocument.Register4Unity(); UpdateDatesInTestTemplates(); }
/// <summary> /// Ctor with ThisDocument as /// </summary> /// <param name="hostApp">ThisDocument handler</param> public SlabProperties(ThisDocument hostDoc) { m_doc = hostDoc; }