第 1 条消息(共 7 条)
I was trying to generate a tee with two disjoint pipes, but the error was raised as shown in picture. Due to my language level, I was unable to find accurate information about the "routing preference". I want to know what it is and how to debug.
And this is my code.
var pipe_system = new FilteredElementCollector(doc);
pipe_system.OfClass(typeof(PipingSystemType));
var pipe_system_type = pipe_system.ToList().First() as PipingSystemType;
var pipe_type = new FilteredElementCollector(doc);
pipe_type.OfClass(typeof(PipeType));
var type = pipe_type.ToList().First() as PipeType;
var pipe5 = Pipe.Create(doc, pipe_system_type.Id, type.Id, level.Id, new XYZ(10, 10, 15), new XYZ(17, 10, 15));
var pipe8 = Pipe.Create(doc, pipe_system_type.Id, type.Id, level.Id, new XYZ(18, 0, 15), new XYZ(18, 20, 15));
pipe_list = GetMainPipe(pipe5, pipe8);
ConnectWithTakeoff(doc, pipe_list[0], pipe_list[1]);
private static void ConnectWithTakeoff(Document doc, Pipe duct1, Pipe duct2)
{
double min_distance = double.MaxValue;
Curve curve1 = (duct1.Location as LocationCurve).Curve;
Connector connector2 = null;
foreach (Connector con2 in duct2.ConnectorManager.Connectors)
{
var dis = curve1.Distance(con2.Origin);
if (dis < min_distance)
{
min_distance = dis;
connector2 = con2;
}
}
if (connector2 != null)
{
var takeoff = doc.Create.NewTakeoffFitting(connector2, duct1);
}
}
已解决! 转到解答。