Message 1 of 3
The TakeoffFitting I create via Revit API replaced by revit in background?why?
Not applicable
09-30-2018
07:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I use the code below to creat takeofffiting between connector and pipe:
foreach (var v in toConnects)
{
ElementId tempTypeId = Util.GetPipeType(doc, v.ConType);//PipetypeId
ElementId zhiTypeId = v.Connector.Owner.GetTypeId();
Pipe ppp = v.Connector.Owner as Pipe;
v.Connector.Owner.ChangeTypeId(tempTypeId);
zhu.ChangeTypeId(tempTypeId);
FamilyInstance takeofff = doc.Create.NewTakeoffFitting(v.Connector, zhu);
sb_aaa.Append(takeofff.Id.ToString() + ",");
string s = takeofff.Symbol.Family.Name;
sb2.Append(takeofff.Id.ToString() + ":" + s+"\n");
doc.Regenerate();
ppp.ChangeTypeId(zhiTypeId);
}the variable "sb_aaa" is used to record the elementid I created.
The firist line of the picture below is record of elementid I created; I use the "select by ID" command in Revit and paste the first line ,it shows me like the second picture. It seems tha all the element I created is deleted by Revit .
How can I avoid this?