/// <summary> /// function used to extract offset value from constraint /// </summary> /// <param name="updateData"> data used to pass or get information regarding constraints cover</param> /// <param name="constraint">constraint from which we extract the offset information</param> /// <param name="targetIdx">index of target in constraint</param> /// <param name="offset"> output value </param> /// <returns></returns> public static bool getOffsetFromConstraintAtTarget(RebarUpdateCurvesData updateData, RebarConstraint constraint, int targetIdx, out double offset) { offset = 0.0; if (updateData == null || constraint == null) { return(false); } double barDiam = updateData.GetBarModelDiameter(); var rebarStyle = updateData.GetRebarStyle(); var attachment = updateData.GetAttachmentType(); bool bIsInside = rebarStyle == RebarStyle.Standard || (rebarStyle != RebarStyle.Standard && attachment == StirrupTieAttachmentType.InteriorFace); if (constraint.IsToCover()) { if (targetIdx < 0 || targetIdx >= constraint.NumberOfTargets) { return(false); // incorrect index } RebarCoverType coverType = constraint.GetTargetCoverType(targetIdx); double coverDist = (coverType == null) ? 0.0 : coverType.CoverDistance; double diameterOffset = (barDiam / 2); if (bIsInside) { diameterOffset *= -1; } offset = constraint.GetDistanceToTargetCover() - coverDist + diameterOffset; return(true); } offset = constraint.GetDistanceToTargetHostFace(); return(true); }
CurveElement getSelectedCurveElement(Rebar bar, RebarUpdateCurvesData data) { RebarFreeFormAccessor barAccess = bar.GetFreeFormAccessor(); ElementId id = new ElementId(bar.LookupParameter(AddSharedParams.m_CurveIdName).AsInteger()); return(data.GetDocument().GetElement(id) as CurveElement); }
/// <summary> /// function used to extract current rebar /// </summary> /// <param name="data"> data used to pass or get information regarding constraints cover</param> /// <returns>Current rebar element being regenerated</returns> Rebar getCurrentRebar(RebarUpdateCurvesData data) { ElementId rebarId = data.GetRebarId(); return(data.GetDocument().GetElement(rebarId) as Rebar); }