The customer is using the aligned distribution from UI. In this case he will need to create a free form with constraints. To do this they will need to use the function that takes a server GUID, the overload CreateFreeForm Method (Document, Guid, RebarBarType, Element):
There are two solutions:
- Create your own server
- Use the existing server that is also used for UI
To create your own server, implement IRebarUpdateServer interface:
The RebarFreeForm SDK sample shows how to do it.
However, since you want to do from API what you can do from UI, I’m recommending the following second solution:
Use the already existing server. In this case you will need to pass the GUID - 78CE2A95-71E7-4FE2-96EE-A38554320EA6.
After the rebar was created, you need to set constraints for all the RebarConstrainedJHandles:
You can call GetCustomHandleTag() to get the tag and identify each handle:
Here are the possible values:
enum FreeFormAlignedHandleTags
{
HostSurface = 0,
DistributionPath1 = 1,
DistributionPath2 = 2,
StartDistribPath = 3,
EndDistribPath = 4,.
SetOrientation = 5,
StartOfBar = 6,
EndOfBar = 7
};
It looks like the Guids and the handles tags that are used for servers implemented in Revit (and used in UI) are not clearly exposed, and this is why I provided them. I submitted a development ticket REVIT-225775 for this to be fixed.