我正在Revit族中创建一个线型类别,在我设置它之后,它存在但我无法在族中找到它,但是如果尝试重新创建它,revit会创建一个它已经存在的错误。我尝试使用再生,但这不起作用。
ElementId solidLineId = LinePatternElement.GetSolidPatternId();
// The new linestyle will be a subcategory of the Lines category
Categories categories = doc.Settings.Categories;
Category lineCat = categories.get_Item(BuiltInCategory.OST_Lines);
using (Transaction t = new Transaction(doc, "Create LineStyle"))
{
t.Start();
Category newLineStyleCat = categories.NewSubcategory(lineCat, "Black-01-Solid");
newLineStyleCat.SetLineWeight(1, GraphicsStyleType.Projection);
newLineStyleCat.LineColor = new Color(28,28, 28);
newLineStyleCat.SetLinePatternId(solidLineId, GraphicsStyleType.Projection);
t.Commit();
}