Hello,
What is the correct way to create spiral shaped stirrup rebar?
I have tried to:
var spiralShapeDefinition = new RebarShapeDefinitionByArc (document, 5, 1, 1, 1); var spiralShape = RebarShape.Create (document, spiralShapeDefinition, null, RebarStyle.StirrupTie, StirrupTieAttachmentType.InteriorFace, 0, RebarHookOrientation.Left, 0, RebarHookOrientation.Left, 0); spiralShape.Name = "spiralShape"; var rebar1 = Rebar.CreateFromCurves (document, RebarStyle.StirrupTie, barType, null, null, revitHost, norm, curves, RebarHookOrientation.Left, RebarHookOrientation.Left, true, true); rebar1.RebarShapeId = spiralShape.Id; var rebar2 = Rebar.CreateFromRebarShape (document, spiralShape, barType, revitHost, XYZ.Zero, XYZ.BasisX, XYZ.BasisY);
After creation of rebar1 I get an error: "Can't solve Rebar Shape.". rebar2 creation throws an exception: "Problem evaluating RebarShape spiralShape".
It seems that there is something wrong with the shape. I tried to compare my shape with the inbuilt spiral shape. I found two main differences:
var newParameter = GlobalParameter.Create (document, "param", ParameterType.Number); newParameter.SetValue (new DoubleParameterValue (3)); spiralShapeDefinition.AddConstraintRadius (newParameter.Id, RebarShapeArcReferenceType.Centerline);
Thank You
Hi,
I understand, that this forum topic is very old. However, I faced with this solution and spent 2 or 3 hours to solve it and I didn't find anything useful in the Internet. Hope, my solution could save few hours for someone later.
So, to create a spiral rebar shape we need to define a constraint. It could be radius, diameter or circumreference. To define a constraint we need to add a parameter:
shapeDefinition.AddParameter(prmId, defaultDiameter);
shapeDefinition.AddConstraintDiameter(prmId, RebarShapeArcReferenceType.External);
We need to have a shared parameter in the model to do this. So we can get it with SharedParameterElement.Lookup method:
var prmId = SharedParameterElement.Lookup(new Guid("...."));
Or with RebarShapeParameters.GetElementIdForExternalDefinition as it is suggested by SDK RebarShapeDefinition.AddParameter method description of paramId
One more addition to this topic. There is still a problem to edit the spiral rebar shape family. To solve this, you need to add an additional constraint (meanwhile shapeDefinition.Complete returns true). Something like this:
shapeDefinition.AddParameter(diamPrmId, defaultDiameter);
shapeDefinition.AddConstraintDiameter(diamPrmId, RebarShapeArcReferenceType.External);
shapeDefinition.AddParameter(radiusPrmId, 0.5*defaultDiameter);
shapeDefinition.AddConstraintRadius(radiusPrmId, RebarShapeArcReferenceType.External);
Could you share with us how to create a spiral stirrups for a circular column please ?