Message 1 of 5
Not applicable
01-02-2019
08:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am trying to create an automated script to generate duct from Air Terminal to Main Duct. Following is my code:
// Create first Duct
Duct firstduct = Duct.Create(document, filterelements2.Where(o => o.Name == selectedDuctType).First().Id, selectedDuct.ReferenceLevel.Id, AirTerminalConnector, B);
// Get unused connector of the first duct
ConnectorSet unusedConnector1 = firstduct.ConnectorManager.UnusedConnectors;
List<Connector> list3 = new List<Connector>();
foreach (Connector c in unusedConnector1)
{
list3.Add(c);
}
Connector unused1 = list3.First();
// Create seconduct
Duct seconduct = Duct.Create(document, pipeSysTypeId, firstduct.DuctType.Id, selectedDuct.ReferenceLevel.Id, B, D);
ConnectorSet seconductConnectors = seconduct.ConnectorManager.Connectors;
List<Connector> list4 = new List<Connector>();
foreach (Connector c in seconductConnectors)
{
list4.Add(c);
}
// Connect 2 connectors of 2 pipe to create the fitting
unused1.ConnectTo(list4.First());
// Create take off fitting
document.Create.NewTakeoffFitting(list4.Last(), selectedDuct);
// seconduct.Document.Regenerate();
and the result is as following image:
The problem is the Second Duct have difference size with the first Duct. Then I tried to change the size of the Second Duct equal to the First Duct by following Code:
BuiltInParameter daimeterpara = BuiltInParameter.RBS_CURVE_DIAMETER_PARAM;
Parameter parameter = seconduct.get_Parameter(daimeterpara);
parameter.Set(Convert.ToDouble(firstduct.Diameter));
seconduct.Document.Regenerate();
But the result is the First Duct disconnected with the Second Duct as following image:
If anyone had experience with this issue please help me, I would be very appreciated your help :).
Thank you.
Best Regards,
Cherry Truong
Solved! Go to Solution.