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(); } return(Result.Succeeded); }
Stream(ArrayList data, LayoutRuleClearSpacing layoutRule) { data.Add(new Snoop.Data.ClassSeparator(typeof(LayoutRuleClearSpacing))); data.Add(new Snoop.Data.String("Justify type", layoutRule.JustifyType.ToString())); data.Add(new Snoop.Data.Double("Spacing", layoutRule.Spacing)); }
Stream(ArrayList data, LayoutRule layoutRule) { data.Add(new Snoop.Data.ClassSeparator(typeof(LayoutRule))); // no data at this level LayoutRuleClearSpacing lrClearSpacing = layoutRule as LayoutRuleClearSpacing; if (lrClearSpacing != null) { Stream(data, lrClearSpacing); return; } LayoutRuleFixedDistance lrFixedDist = layoutRule as LayoutRuleFixedDistance; if (lrFixedDist != null) { Stream(data, lrFixedDist); return; } LayoutRuleFixedNumber lrFixedNum = layoutRule as LayoutRuleFixedNumber; if (lrFixedNum != null) { Stream(data, lrFixedNum); return; } LayoutRuleMaximumSpacing lrMaxSpacing = layoutRule as LayoutRuleMaximumSpacing; if (lrMaxSpacing != null) { Stream(data, lrMaxSpacing); return; } }
Stream(ArrayList data, LayoutRuleClearSpacing layoutRule) { data.Add(new Snoop.Data.ClassSeparator(typeof(LayoutRuleClearSpacing))); data.Add(new Snoop.Data.String("Justify type", layoutRule.JustifyType.ToString())); data.Add(new Snoop.Data.Double("Spacing", layoutRule.Spacing)); }
/// <summary> /// constructor /// </summary> public ClearSpacingParam() : base() { m_layout = new LayoutRuleClearSpacing(m_fixedSpacing, m_justifyType); m_layoutType = LayoutMethod.ClearSpacing; }
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); }
/// <summary> /// constructor /// </summary> public ClearSpacingParam() : base() { m_layout = new LayoutRuleClearSpacing(m_fixedSpacing, m_justifyType); m_layoutType = LayoutMethod.ClearSpacing; }