コード例 #1
0
        protected override void ProcessVolatileData()
        {
            if (Grouping == DataGrouping.Document)
            {
                if (Kind == GH_ParamKind.floating)
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Document");
                }

                var data      = new GH_Structure <Types.Document>();
                var pathCount = m_data.PathCount;
                for (int p = 0; p < pathCount; ++p)
                {
                    var path   = m_data.Paths[p];
                    var branch = m_data.get_Branch(path);
                    foreach (var item in branch)
                    {
                        if (item is Types.Document doc)
                        {
                            var id = DocumentExtension.DocumentSessionId(doc.Value.GetFingerprintGUID());
                            data.Append(doc, path.AppendElement(id));
                        }
                        else
                        {
                            data.Append(null, path.AppendElement(0));
                        }
                    }
                }

                m_data = data;
            }

            base.ProcessVolatileData();
        }
コード例 #2
0
ファイル: ID.cs プロジェクト: ozanyetkin/rhino.inside-revit
        protected override void ProcessVolatileData()
        {
            if (Grouping != DataGrouping.None)
            {
                if (Kind == GH_ParamKind.floating)
                {
                    if ((Grouping & DataGrouping.Document) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Document");
                    }

                    if ((Grouping & DataGrouping.Workset) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Workset");
                    }

                    if ((Grouping & DataGrouping.DesignOption) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Design Option");
                    }

                    if ((Grouping & DataGrouping.Category) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Category");
                    }
                }

                var data      = new GH_Structure <T>();
                var pathCount = m_data.PathCount;
                for (int p = 0; p < pathCount; ++p)
                {
                    var path   = m_data.Paths[p];
                    var branch = m_data.get_Branch(path);
                    foreach (var item in branch)
                    {
                        if (item is Types.IGH_ElementId value)
                        {
                            var group = path;

                            if ((Grouping & DataGrouping.Document) != 0)
                            {
                                var docId = DocumentExtension.DocumentSessionId(value.DocumentGUID);
                                group = group.AppendElement(docId);
                            }

                            if (Grouping > DataGrouping.Document)
                            {
                                var element = value.Document?.GetElement(value.Id);

                                if ((Grouping & DataGrouping.Workset) != 0)
                                {
                                    var catId = element?.WorksetId?.IntegerValue ?? 0;
                                    group = group.AppendElement(catId);
                                }

                                if ((Grouping & DataGrouping.DesignOption) != 0)
                                {
                                    var catId = element?.DesignOption?.Id.IntegerValue ?? 0;
                                    group = group.AppendElement(catId);
                                }

                                if ((Grouping & DataGrouping.Category) != 0)
                                {
                                    var catId = element?.Category?.Id.IntegerValue ?? 0;
                                    group = group.AppendElement(catId);
                                }
                            }

                            data.Append((T)value, group);
                        }
                        else
                        {
                            data.Append(null, path.AppendElement(int.MinValue));
                        }
                    }
                }

                m_data = data;
            }

            base.ProcessVolatileData();
        }