Exemple #1
0
        public void processOld(TFFrameListClass frame, ref bool dirty, bool updateImidiatly)
        {
            // TODO необходимо полностью обновить старые проходки,
            // т.к. нужно назначить правильные Level всем элементам проходки

            // либо поэтапно ...

            // TODO формализовать список обновлений через Enum

            TFProjectionList projList = frame.GetProjectionList();
            string           name     = projList.AsTFProjection.GetName();

            // bool isCorrect = isProjectionListCorrect(projList);
            if (!hasRefPoint(projList))
            {
                dirty = true;

                if (updateImidiatly)
                {
                    Point3d origin = frame.Get3DElement().AsCellElement().Origin;
                    frame.AddProjection(
                        ElementHelper.createPoint(origin),
                        "refPoint",
                        PenetrTaskBase.LevelRefPoint
                        );
                }
            }
        }
Exemple #2
0
        public void process(TFFrameListClass frameList, ref bool dirty, bool updateImidiatly)
        {
            // smartsolids раскладываются на примитивы: окружности, линии

            TFProjectionList projList = frameList.GetProjectionList();
            string           name     = projList.AsTFProjection.GetName();

            if (!isProjectionListCorrect(projList))
            {
                dirty = true;
            }
        }
Exemple #3
0
        //添加元素
        public void draw_Elements(Element[] elements, string name)
        {
            TFFrameList frame_list = new TFFrameListClass();
            TFFrame     frame      = frame_list.AsTFFrame;

            for (int i = 0; i < elements.Length; i++)
            {
                frame.Add3DElement(elements[i]);
            }
            frame.SetName(name);
            TFApplicationList tfapp_list = new TFApplicationList();
            TFApplication     tfapp      = tfapp_list.TFApplication;

            tfapp.ModelReferenceAddFrame(app.ActiveModelReference, frame);
        }
Exemple #4
0
        public void scanForUpdate(TreeView treeView) // TODO без TreeView
        {
            treeView.AfterCheck -= TreeView_AfterCheck;
            treeView.AfterCheck += TreeView_AfterCheck;

            checkedCellsForUpdate_.Clear();
            modelsCellsForUpdate_.Clear();
            cellFrames_.Clear();

            /* TODO
             * Поиск:
             * - по имени Cell;
             * - по CatalogGroupName
             */

            ElementScanCriteria scanCriteria = new ElementScanCriteriaClass();

            scanCriteria.ExcludeNonGraphical();
            scanCriteria.IncludeOnlyVisible();

            scanRecurse(App.ActiveModelReference, scanCriteria, false);

            treeView.Nodes.Clear();

            foreach (var pair in modelsCellsForUpdate_)
            {
                ModelReference     model      = pair.Key;
                List <CellElement> updateList = pair.Value;

                TreeNode modelNode =
                    treeView.Nodes.Add(model.Name + $" ({updateList.Count})");

                foreach (var cell in updateList)
                {
                    TFFrameListClass frame    = cellFrames_[cell.MdlElementRef()];
                    TreeNode         cellNode = modelNode.Nodes.Add(cell.ID.ToString());
                    cellNode.Tag = cell;
                }
                modelNode.Checked = true;
            }
        }
Exemple #5
0
        private void scanRecurse(ModelReference model, ElementScanCriteria criteria,
                                 bool updateImidiatly)
        {
            if (modelsCellsForUpdate_.ContainsKey(model))
            {
                return;
            }

            var cellsToUpdateList = new List <CellElement>();

            foreach (string cellName in new string[]
                     { PenConfigVariables.CellName.Value, PenConfigVariables.CellNameOld.Value })
            {
                criteria.IncludeOnlyCell(cellName);

                ElementEnumerator iter = App.ActiveModelReference.Scan(criteria);
                iter.Reset();
                while (iter.MoveNext())
                {
                    if (!iter.Current.IsCellElement() && !iter.Current.IsCompundCell())
                    {
                        continue;
                    }

                    bool dirty = false;

                    CellElement cell = iter.Current.AsCellElement();

                    if (updateImidiatly && null == checkedCellsForUpdate_.Find(
                            x => x.MdlElementRef() == cell.MdlElementRef()))
                    {
                        continue;
                    }

                    TFFrameListClass frameList = new TFFrameListClass();
                    try
                    {
                        if (cellName.Equals(PenConfigVariables.CellName.Value))
                        {
                            //frameList.InitFromElement(cell);
                            //process(frameList, ref dirty, updateImidiatly);
                        }
                        else if (cellName.Equals(PenConfigVariables.CellNameOld.Value))
                        {
                            processOld(ref cell, ref dirty, updateImidiatly); // CELL
                            frameList.InitFromElement(cell);                  // FRAME
                            processOld(frameList, ref dirty, updateImidiatly);
                        }
                    }
                    catch (Exception ex)
                    {
                        // TODO log exception
                        continue;
                    }

                    if (dirty)
                    {
                        cellFrames_.Add(cell.MdlElementRef(), frameList);
                        cellsToUpdateList.Add(cell);
                    }
                }
            }

            if (cellsToUpdateList.Count > 0)
            {
                modelsCellsForUpdate_.Add(model, cellsToUpdateList);
            }

            foreach (Attachment attachment in model.Attachments)
            {
                if (!attachment.IsActive || !attachment.IsMissingFile || !attachment.IsMissingModel)
                {
                    return;
                }

                ModelReference modelRef =
                    App.MdlGetModelReferenceFromModelRefP(attachment.MdlModelRefP());
                scanRecurse(modelRef, criteria, updateImidiatly);
            }
        }