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); }
public static List <int?> CutLineweight(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 <int?> categoryCutLineweight = new List <int?>(); //iterates through each of the input items. foreach (global::Revit.Elements.Category c in category) { //generate the category id from the input user viewable category Autodesk.Revit.DB.ElementId categoryId = new ElementId(c.Id); //obtain the internal Revit category from the id Autodesk.Revit.DB.Category internalRevitCat = Autodesk.Revit.DB.Category.GetCategory(doc, categoryId); categoryCutLineweight.Add(internalRevitCat.GetLineWeight(GraphicsStyleType.Cut)); } return(categoryCutLineweight); }