public static List <string> LinePattern(List <global::Revit.Elements.Category> category) { //obtains the current document for later use Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument; //category stuff - list to append the results to List <string> linePattern = new List <string>(); //iterates through each of the input items. foreach (global::Revit.Elements.Category cat in category) { //generate the category id from the input user viewable category Autodesk.Revit.DB.ElementId categoryId = new ElementId(cat.Id); //obtain the internal Revit category from the id Autodesk.Revit.DB.Category c = Autodesk.Revit.DB.Category.GetCategory(doc, categoryId); //get the projection line pattern name if (c.GetLinePatternId(GraphicsStyleType.Projection).ToString() == "-3000010") { linePattern.Add("Solid"); } if (c.GetLinePatternId(GraphicsStyleType.Projection).ToString() == "-1") { linePattern.Add("No Pattern"); } if (!c.GetLinePatternId(GraphicsStyleType.Projection).ToString().Contains("-")) { string linePatternName = doc.GetElement(c.GetLinePatternId(GraphicsStyleType.Projection)).Name; linePattern.Add(linePatternName); } } return(linePattern); }
protected override void SolveInstance(IGH_DataAccess DA) { Autodesk.Revit.DB.Category category = null; if (!DA.GetData("Category", ref category)) { return; } var doc = Revit.ActiveDBDocument; DA.SetData("LineWeight [projection]", category?.GetLineWeight(GraphicsStyleType.Projection)); DA.SetData("LineWeight [cut]", category?.GetLineWeight(GraphicsStyleType.Cut)); DA.SetData("LineColor", category?.LineColor.ToRhino()); DA.SetData("LinePattern [projection]", doc.GetElement(category?.GetLinePatternId(GraphicsStyleType.Projection))); DA.SetData("LinePattern [cut]", doc.GetElement(category?.GetLinePatternId(GraphicsStyleType.Cut))); DA.SetData("Material", category?.Material); }
protected override void SolveInstance(IGH_DataAccess DA) { DB.Category category = null; if (!DA.GetData("Category", ref category)) { return; } var doc = category?.Document(); DA.SetData("LineWeight [projection]", category?.GetLineWeight(DB.GraphicsStyleType.Projection)); DA.SetData("LineWeight [cut]", category?.GetLineWeight(DB.GraphicsStyleType.Cut)); DA.SetData("LineColor", category?.LineColor.ToRhino()); DA.SetData("LinePattern [projection]", doc?.GetElement(category.GetLinePatternId(DB.GraphicsStyleType.Projection))); DA.SetData("LinePattern [cut]", doc?.GetElement(category.GetLinePatternId(DB.GraphicsStyleType.Cut))); DA.SetData("Material", category?.Material); DA.SetData("Cuttable", category?.IsCuttable); }