/// <summary> /// Exports a beam system as an IFC assembly. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="beamSystem">The beam system.</param> /// <param name="productWrapper">The ProductWrapper.</param> public static void ExportBeamSystem(ExporterIFC exporterIFC, BeamSystem beamSystem, ProductWrapper productWrapper) { if (beamSystem == null) { return; } ICollection <ElementId> beamMemberIds = beamSystem.GetBeamIds(); ExportAssemblyInstanceWithMembers(exporterIFC, beamSystem, beamMemberIds, IFCElementAssemblyType.Beam_Grid, productWrapper); }
/// <summary> /// /// </summary> /// <param name="app"></param> /// <param name="beamSystem"></param> /// <returns></returns> private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, BeamSystem beamSystem) { List <Curve> profile = new List <Curve>(); foreach (Curve curve in beamSystem.Profile) { profile.Add(curve); } BeamSystem beamSystemClone = BeamSystem.Create(app.ActiveUIDocument.Document, profile, beamSystem.Level, 0, false); Utils.ParamUtil.SetParameters(beamSystemClone.Parameters, beamSystem.Parameters); return(beamSystemClone); }
public void Example() { var profile = new WideFlangeProfile("test", 1.0, 2.0, 0.1, 0.1); var a = new Vector3(0, 0, 0); var b = new Vector3(20, 0, 0); var d = new Vector3(20, 20, 10); var c = new Vector3(0, 20, 0); var polygon = new Polygon(new[] { a, b, c, d }); var system = new BeamSystem(5, profile, new Line(a, b), new Line(c, d), BuiltInMaterials.Steel); var model = new Model(); model.AddElements(system.Beams); model.SaveGlb("beam_system.glb"); }
protected override void OnCreate() { _query = GetEntityQuery(new EntityQueryDesc() { All = new ComponentType[] { ComponentType.ReadOnly <BeamComponent>(), }, }); _beamSystem = World.GetOrCreateSystem <BeamSystem>(); _matricesInRenderer = new Matrix4x4[BatchNum][]; for (var i = 0; i < BatchNum; ++i) { _matricesInRenderer[i] = new Matrix4x4[Cv.InstanceLimit]; } }
public void BeamSystem() { this.Name = "BeamSystem"; var profile = new WideFlangeProfile("test", 1.0, 2.0, 0.1, 0.1); var a = new Vector3(0, 0, 0); var b = new Vector3(20, 0, 0); var d = new Vector3(20, 20, 10); var c = new Vector3(0, 20, 0); var polygon = new Polygon(new[] { a, b, c, d }); var beam = new Beam(new Line(a, b), profile); var system = new BeamSystem(5, profile, new Line(a, b), new Line(c, d), BuiltInMaterials.Steel); Assert.True(system.Elements.Count() == 5); this.Model.AddElements(system.Elements); this.Model.AddElement(beam); }
/// <summary> /// create beam system according to given profile and property /// </summary> public void CreateBeamSystem() { Document document = m_data.CommandData.Application.ActiveUIDocument.Document; // create curve array and insert Lines in order IList <Curve> curves = new List <Curve>(); foreach (Line line in m_data.Lines) { curves.Add(line); } // create beam system takes closed profile consist of lines BeamSystem aBeamSystem = BeamSystem.Create(document, curves, document.ActiveView.SketchPlane, 0); // set created beam system's layout rule and beam type property aBeamSystem.LayoutRule = m_data.Param.Layout; aBeamSystem.BeamType = m_data.Param.BeamType; }
/// <summary> /// create beam system according to given profile and property /// </summary> public void CreateBeamSystem() { Autodesk.Revit.Creation.Document docCreation = m_data.CommandData.Application.ActiveUIDocument.Document.Create; // create CurveArray and insert Lines in order CurveArray curves = new CurveArray(); foreach (Line line in m_data.Lines) { curves.Append(line); } // create beam system takes closed profile consist of lines BeamSystem aBeamSystem = docCreation.NewBeamSystem(curves, m_data.CommandData.Application.ActiveUIDocument.Document.ActiveView.SketchPlane); // set created beam system's layout rule and beam type property aBeamSystem.LayoutRule = m_data.Param.Layout; aBeamSystem.BeamType = m_data.Param.BeamType; }
/// <summary> /// Exports a beam system as an IFC assembly. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="beamSystem">The beam system.</param> /// <param name="productWrapper">The ProductWrapper.</param> public static void ExportBeamSystem(ExporterIFC exporterIFC, BeamSystem beamSystem, ProductWrapper productWrapper) { if (beamSystem == null) return; ICollection<ElementId> beamMemberIds = beamSystem.GetBeamIds(); ExportAssemblyInstanceWithMembers(exporterIFC, beamSystem, beamMemberIds, IFCElementAssemblyType.Beam_Grid, productWrapper); }
/// <summary> /// /// </summary> /// <param name="app"></param> /// <param name="element"></param> /// <returns></returns> public static Revit.Element CloneElement(Application app, Revit.Element element) { Opening opening = element as Opening; if (opening != null) { return(CloneElement(app, opening)); } BoundaryConditions boundaryConditions = element as BoundaryConditions; if (boundaryConditions != null) { return(CloneElement(app, boundaryConditions)); } AreaLoad areaLoad = element as AreaLoad; if (areaLoad != null) { return(CloneElement(app, areaLoad)); } AreaReinforcement areaReinforcement = element as AreaReinforcement; if (areaReinforcement != null) { return(CloneElement(app, areaReinforcement)); } BeamSystem beamSystem = element as BeamSystem; if (beamSystem != null) { return(CloneElement(app, beamSystem)); } Dimension dimension = element as Dimension; if (dimension != null) { return(CloneElement(app, dimension)); } FamilyInstance familyInstance = element as FamilyInstance; if (familyInstance != null) { return(CloneElement(app, familyInstance)); } Floor floor = element as Floor; if (floor != null) { return(CloneElement(app, floor)); } Grid grid = element as Grid; if (grid != null) { return(CloneElement(app, grid)); } Group group = element as Group; if (group != null) { return(CloneElement(app, group)); } Level level = element as Level; if (floor != null) { return(CloneElement(app, floor)); } LineLoad lineLoad = element as LineLoad; if (lineLoad != null) { return(CloneElement(app, lineLoad)); } LoadCase loadCase = element as LoadCase; if (loadCase != null) { return(CloneElement(app, loadCase)); } LoadCombination loadCombination = element as LoadCombination; if (loadCombination != null) { return(CloneElement(app, loadCombination)); } LoadNature loadNature = element as LoadNature; if (loadNature != null) { return(CloneElement(app, loadNature)); } LoadUsage loadUsage = element as LoadUsage; if (loadUsage != null) { return(CloneElement(app, loadUsage)); } ModelCurve modelCurve = element as ModelCurve; if (modelCurve != null) { return(CloneElement(app, modelCurve)); } PointLoad pointLoad = element as PointLoad; if (pointLoad != null) { return(CloneElement(app, pointLoad)); } Rebar rebar = element as Rebar; if (rebar != null) { return(CloneElement(app, rebar)); } ReferencePlane referencePlane = element as ReferencePlane; if (referencePlane != null) { return(CloneElement(app, referencePlane)); } Room room = element as Room; if (room != null) { return(CloneElement(app, room)); } RoomTag roomTag = element as RoomTag; if (roomTag != null) { return(CloneElement(app, roomTag)); } SketchPlane sketchPlane = element as SketchPlane; if (sketchPlane != null) { return(CloneElement(app, sketchPlane)); } View3D view3D = element as View3D; if (view3D != null) { return(CloneElement(app, view3D)); } ViewDrafting viewDrafting = element as ViewDrafting; if (viewDrafting != null) { return(CloneElement(app, viewDrafting)); } ViewSection viewSection = element as ViewSection; if (viewSection != null) { return(CloneElement(app, viewSection)); } ViewSheet viewSheet = element as ViewSheet; if (viewSheet != null) { return(CloneElement(app, viewSheet)); } Wall wall = element as Wall; if (wall != null) { return(CloneElement(app, wall)); } // this element has not yet been exposed in the Creation Document class //Debug.Assert(false); return(null); }
private void Stream( ArrayList data, BeamSystem beamSys ) { data.Add( new Snoop.Data.ClassSeparator( typeof( BeamSystem ) ) ); data.Add( new Snoop.Data.Object( "Beam system type", beamSys.BeamSystemType ) ); data.Add( new Snoop.Data.Object( "Beam type", beamSys.BeamType ) ); data.Add( new Snoop.Data.Xyz( "Direction", beamSys.Direction ) ); data.Add( new Snoop.Data.Double( "Elevation", beamSys.Elevation ) ); data.Add( new Snoop.Data.Object( "Layout rule", beamSys.LayoutRule ) ); data.Add( new Snoop.Data.Enumerable( "Profile", beamSys.Profile ) ); data.Add( new Snoop.Data.Enumerable( "Get all beams", beamSys.GetBeamIds(), beamSys.Document ) ); // TBD: Level seems to be overridden here but not specified as "overridden" }
/// <summary> /// /// </summary> /// <param name="app"></param> /// <param name="beamSystem"></param> /// <returns></returns> private static Revit.Element CloneElement( Autodesk.Revit.UI.UIApplication app, BeamSystem beamSystem ) { List<Curve> profile = new List<Curve>(); foreach( Curve curve in beamSystem.Profile ) { profile.Add( curve ); } BeamSystem beamSystemClone = BeamSystem.Create( app.ActiveUIDocument.Document, profile, beamSystem.Level, 0, false ); Utils.ParamUtil.SetParameters( beamSystemClone.Parameters, beamSystem.Parameters ); return beamSystemClone; }
public Result setup_joists() { using (Transaction t = new Transaction(doc, "Joists")) { t.Start(); Family f = null; //FIXME : move to a function that's called only once string familyPath = @"C:\ProgramData\Autodesk\RVT 2019\Libraries\US Imperial\Structural Framing\Wood\Plywood Web Joist.rfa"; doc.LoadFamily(familyPath, out f); XYZ pt0 = XYZ.Zero; Line directionLine = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(0, 5, -joist_offset)); SketchPlane sp = SketchPlane.Create(doc, Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ(0, 40, -joist_offset))); BeamSystem bs = BeamSystem.Create(doc, joistCurves, sp, directionLine.Direction, false); //get the layoutRule of the beamsystem Autodesk.Revit.DB.LayoutRule layoutRule = bs.LayoutRule; //create a new instance of the LayoutRuleClearSpacing class LayoutRuleClearSpacing myLayoutRuleClearSpacing = new LayoutRuleClearSpacing(2.0, BeamSystemJustifyType.Beginning); //set the new layoutRule to the beamsystem bs.LayoutRule = myLayoutRuleClearSpacing; t.Commit(); } // Metal beam double offset_from_floor = 80 / 12.0; XYZ startPoint = new XYZ(0.0, 183 / 12.0, level.Elevation + offset_from_floor); XYZ endPoint = new XYZ(472 / 12.0, 183 / 12.0, level.Elevation + offset_from_floor); FamilySymbol beamSymbol = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Cast <FamilySymbol>() .First(q => q.Family.FamilyCategory.Name == "Structural Framing" && q.Family.Name == "W Shapes" && q.Name == "W12X26"); using (Transaction t = new Transaction(doc)) { t.Start("Activate beam"); if (!beamSymbol.IsActive) { beamSymbol.Activate(); // doc.Regenerate(); } t.Commit(); } // try to insert an instance using (Transaction tx = new Transaction(doc)) { tx.Start("insert beam"); FamilyInstance fi = doc.Create.NewFamilyInstance(XYZ.Zero, beamSymbol, StructuralType.Beam); (fi.Location as LocationCurve).Curve = Line.CreateBound(startPoint, endPoint);; tx.Commit(); } return(Result.Succeeded); }