Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Spiral stirrup rebar

3 REPLIES 3
Reply
Message 1 of 4
Klaidas.Strazdauskas
762 Views, 3 Replies

Spiral stirrup rebar

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:

  1. Inbuilt shape's definition had a single radius constraint. I replicated that constraint. However that did not help.
    var newParameter = GlobalParameter.Create (document, "param", ParameterType.Number);
    newParameter.SetValue (new DoubleParameterValue (3));
    spiralShapeDefinition.AddConstraintRadius (newParameter.Id, RebarShapeArcReferenceType.Centerline);
  2. Inbuilt shape has more parameters than the one that I created. Even if the lack of those parameters is the reason that my shape is invalid there is no way to add them manually and because they are readonly I cannot duplicate the inbuilt shape and reuse it.image.png

Thank You

Tags (3)
3 REPLIES 3
Message 2 of 4

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

Message 3 of 4
aignatovich
in reply to: aignatovich

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);

 

Message 4 of 4

Could you share with us how to create a spiral stirrups for a circular column please ?

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community