Message 1 of 7
Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
From a CAD, I am creating piping of a defined layer, using
the method Pipe.CreatePlaceholder(doc,......)
It works well for me, but it gives me a warning, that I should check, PipeSegment, since it gives me null
Try this way,
// ........
using (Transaction curves = new Transaction(doc, "Create P1pe"))
{
curves.Start();
try
{
foreach (Curve c in curves11)
{
XYZ start = c.GetEndPoint(0);
XYZ end = c.GetEndPoint(1);
if (pipeType != null)
{
//dl = doc.Create.NewDetailCurve(doc.ActiveView, c);
Pipe pipeHolder = Pipe.CreatePlaceholder(doc, systemType.Id, pipeType.Id, level, start, end);
Parameter param = pipeHolder.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM);
param.Set(0.041666666);
string pipeSegmentNames = "PVC_ATA - Serie 40";
var dfg = pipeHolder.get_Parameter(BuiltInParameter.RBS_PIPE_SEGMENT_PARAM).AsValueString();
dfg = pipeSegmentNames;
listPlaceholder.Add(pipeHolder.Id);
}
}
doc.Regenerate();
}
catch (System.Exception ex)
{
TaskDialog.Show("Info", ex.Message);
}
curves.Commit();
PipeSegment = null
// ..........
I made another change, adding RoutingPreferenceManager as I show below and it also gives me that the Pipe Segment = null
PipeType pipeType = (from PipeType x in new FilteredElementCollector(doc).OfClass(typeof(PipeType))
where x.Name == "PVC - HID"
select x).First();
RoutingPreferenceManager rpm = pipeType.RoutingPreferenceManager;
int segmentCount = rpm.GetNumberOfRules(RoutingPreferenceRuleGroupType.Segments);
for (int index = 0; index != segmentCount; ++index)
{
RoutingPreferenceRule segmentRule = rpm.GetRule(RoutingPreferenceRuleGroupType.Segments, index);
Segment segment = doc.GetElement(segmentRule.MEPPartId) as Segment;
string nombre = segment.Name;
//.....
}I really don't know how to continue...
Any ideas....??
