コード例 #1
0
        private Dictionary <string, AnnotationSymbol> GetAnnotationSheets(ViewSheet view, Document doc)
        {
            ElementClassFilter filter = new ElementClassFilter(typeof(FamilyInstance));
            Dictionary <string, AnnotationSymbol> dictAnot = new Dictionary <string, AnnotationSymbol>();

            foreach (ElementId elid in view.GetDependentElements(filter).ToList())
            {
                Element elsymbol = doc.GetElement(elid);
                if (elsymbol.Category.Name == "Типовые аннотации")
                {
                    AnnotationSymbol symbol = elsymbol as AnnotationSymbol;
                    if (symbol.AnnotationSymbolType.FamilyName == "# Reports - Схема - Силовой щит - Данные - ГРЩ" |
                        symbol.AnnotationSymbolType.FamilyName == "# Reports - Схема - Силовой щит - Данные" |
                        symbol.AnnotationSymbolType.FamilyName == "# Reports - Схема - Силовой щит - Данные - ГРЩ1")
                    {
                        foreach (Parameter pr in symbol.ParametersMap)
                        {
                            if (pr.Definition.Name == "Обозначение")
                            {
                                dictAnot.Add(pr.AsString(), symbol);
                            }
                        }
                    }
                }
            }
            return(dictAnot);
        }
コード例 #2
0
        private Dictionary <string, string> CompareAnnotations(AnnotationSymbol A1, AnnotationSymbol A2)
        {
            Dictionary <String, String> change = new Dictionary <String, String>();

            foreach (Parameter parameterА1 in A1.Parameters)
            {
                if (parameterА1.HasValue & !parameterА1.IsReadOnly
                    & (parameterА1.Definition.Name != "Высота")
                    & (parameterА1.Definition.Name != "Image - Index"))
                {
                    if (parameterА1.StorageType == StorageType.Integer)
                    {
                        string            name1       = parameterА1.Definition.Name;
                        int               value1      = parameterА1.AsInteger();
                        IList <Parameter> parameterА2 = A2.GetParameters(name1);
                        int               value2      = parameterА2[0].AsInteger();
                        if (value1 != value2)
                        {
                            change.Add(name1, "Изменено  с " + value1 + " на " + value2);
                            parameterА1.Set(value2);
                        }
                    }
                    if (parameterА1.StorageType == StorageType.String)
                    {
                        string            name1       = parameterА1.Definition.Name;
                        string            value1      = parameterА1.AsString();
                        ElementId         id1         = parameterА1.Id;
                        IList <Parameter> parameterА2 = A2.GetParameters(name1);
                        string            value2      = parameterА2[0].AsString();
                        if (value1 != value2)
                        {
                            change.Add(name1, "Изменено значения с " + value1 + " на " + value2);
                            parameterА1.Set(value2);
                        }
                    }

                    if (parameterА1.StorageType == StorageType.Double)
                    {
                        string            name1       = parameterА1.Definition.Name;
                        double            value1      = parameterА1.AsDouble();
                        ElementId         id1         = parameterА1.Id;
                        IList <Parameter> parameterА2 = A2.GetParameters(name1);
                        double            value2      = parameterА2[0].AsDouble();
                        if (value1 != value2)
                        {
                            change.Add(name1, "Изменено значения с " + value1 + " на " + value2);
                            parameterА1.Set(value2);
                        }
                    }
                }
            }
            return(change);
        }
コード例 #3
0
        /// <summary>
        /// Create tools for the shape toolbox and sort them into custom categories
        /// </summary>
        private void CreateTools()
        {
            toolSetPresenter.ToolSetController.Clear();
            toolSetPresenter.ToolSetController.AddTool(new SelectionTool(), true);

            string         category      = "Database Entities";
            DatabaseSymbol databaseShape = (DatabaseSymbol)project.ShapeTypes["Database"].CreateInstance();

            databaseShape.Width          = 120;
            databaseShape.Height         = 120;
            databaseShape.FillStyle      = project.Design.FillStyles.Yellow;
            databaseShape.CharacterStyle = project.Design.CharacterStyles.Heading3;
            databaseShape.Text           = "Database";
            CreateTemplateAndTool("Database", category, databaseShape);

            EntitySymbol tableShape = (EntitySymbol)project.ShapeTypes["Entity"].CreateInstance();

            tableShape.Width                = 100;
            tableShape.Height               = 160;
            tableShape.FillStyle            = project.Design.FillStyles.Red;
            tableShape.CharacterStyle       = project.Design.CharacterStyles.Heading3;
            tableShape.ParagraphStyle       = project.Design.ParagraphStyles.Title;
            tableShape.ColumnCharacterStyle = project.Design.CharacterStyles.Caption;
            tableShape.ColumnParagraphStyle = project.Design.ParagraphStyles.Label;
            CreateTemplateAndTool("Entity", category, tableShape);

            RectangularLine line;
            ShapeType       relationShapeType = project.ShapeTypes["RectangularLine"];

            line           = (RectangularLine)relationShapeType.CreateInstance();
            line.LineStyle = project.Design.LineStyles.Thick;
            CreateTemplateAndTool("Relationship", category, line);

            line             = (RectangularLine)relationShapeType.CreateInstance();
            line.LineStyle   = project.Design.LineStyles.Thick;
            line.EndCapStyle = project.Design.CapStyles.ClosedArrow;
            CreateTemplateAndTool("1:n Relationship", category, line);

            line               = (RectangularLine)relationShapeType.CreateInstance();
            line.LineStyle     = project.Design.LineStyles.Thick;
            line.StartCapStyle = project.Design.CapStyles.ClosedArrow;
            line.EndCapStyle   = project.Design.CapStyles.ClosedArrow;
            CreateTemplateAndTool("n:m Relationship", category, line);

            CloudSymbol cloudShape = (CloudSymbol)project.ShapeTypes["Cloud"].CreateInstance();

            cloudShape.FillStyle      = project.Design.FillStyles.Blue;
            cloudShape.CharacterStyle = project.Design.CharacterStyles.Heading1;
            cloudShape.Width          = 300;
            cloudShape.Height         = 160;
            cloudShape.Text           = "WAN / LAN";
            CreateTemplateAndTool("Cloud", category, cloudShape);

            category = "Description";
            Text text = (Text)project.ShapeTypes["Text"].CreateInstance();

            text.CharacterStyle = project.Design.CharacterStyles.Normal;
            text.Width          = 100;
            CreateTemplateAndTool("Text", category, text);

            AnnotationSymbol annotationShape = (AnnotationSymbol)project.ShapeTypes["Annotation"].CreateInstance();

            annotationShape.FillStyle      = project.Design.FillStyles.White;
            annotationShape.CharacterStyle = project.Design.CharacterStyles.Caption;
            annotationShape.ParagraphStyle = project.Design.ParagraphStyles.Text;
            annotationShape.Width          = 120;
            annotationShape.Height         = 120;
            CreateTemplateAndTool("Annotation", category, annotationShape);

            category = "Miscellaneous";
            RoundedBox roundedRectangle = (RoundedBox)project.ShapeTypes["RoundedBox"].CreateInstance();

            roundedRectangle.FillStyle = project.Design.FillStyles.Green;
            roundedRectangle.Width     = 120;
            roundedRectangle.Height    = 80;
            CreateTemplateAndTool("Box", category, roundedRectangle);

            Ellipse ellipse = (Ellipse)project.ShapeTypes["Ellipse"].CreateInstance();

            ellipse.FillStyle = project.Design.FillStyles.Yellow;
            ellipse.Width     = 120;
            ellipse.Height    = 80;
            CreateTemplateAndTool("Ellipse", category, ellipse);

            Picture picture = (Picture)project.ShapeTypes["Picture"].CreateInstance();

            picture.FillStyle = project.Design.FillStyles.Transparent;
            picture.Width     = 120;
            picture.Height    = 120;
            CreateTemplateAndTool("Picture", category, picture);

            ShapeType   arcShapeType = project.ShapeTypes["CircularArc"];
            CircularArc arc;

            arc           = (CircularArc)arcShapeType.CreateInstance();
            arc.LineStyle = project.Design.LineStyles.Thick;
            CreateTemplateAndTool("Arc", category, arc);

            arc             = (CircularArc)arcShapeType.CreateInstance();
            arc.LineStyle   = project.Design.LineStyles.Thick;
            arc.EndCapStyle = project.Design.CapStyles.ClosedArrow;
            CreateTemplateAndTool("Bowed Arrow", category, arc);

            arc               = (CircularArc)arcShapeType.CreateInstance();
            arc.LineStyle     = project.Design.LineStyles.Thick;
            arc.StartCapStyle = project.Design.CapStyles.ClosedArrow;
            arc.EndCapStyle   = project.Design.CapStyles.ClosedArrow;
            CreateTemplateAndTool("Bowed Double Arrow", category, arc);
        }
コード例 #4
0
        private void Stream( ArrayList data, AnnotationSymbol annoSym )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( AnnotationSymbol ) ) );

              data.Add( new Snoop.Data.Object( "Annotation symbol type", annoSym.AnnotationSymbolType ) );
              data.Add( new Snoop.Data.Enumerable( "Leaders", annoSym.GetLeaders() ) );
        }
コード例 #5
0
ファイル: RequestHandler.cs プロジェクト: inktan/RevitApi_
        }//execute

        //外部事件方法建立
        /// <summary>
        /// 新建户型_1T2H_aa_1DY 函数架构 文档开启 在前 文档关闭 在后
        /// </summary>
        /// <param name="uiapp"></param>
        public void GridReName(UIApplication uiapp)
        {
            #region 与revit文档交互入口
            UIDocument uidoc     = uiapp.ActiveUIDocument;
            Document   doc       = uidoc.Document;
            Selection  sel       = uidoc.Selection;
            View       acvtiView = doc.ActiveView;
            #endregion
            //获取所有的假轴号
            List <Element> AnnotationSymbolEles = (new FilteredElementCollector(doc)).OfCategory(BuiltInCategory.OST_GenericAnnotation).WhereElementIsNotElementType().ToElements().ToList();

            List <AnnotationSymbol> allFakeGridNumbers = new List <AnnotationSymbol>();//找到当前所有的目标假轴号
            foreach (Element _ele in AnnotationSymbolEles)
            {
                AnnotationSymbol _annotationSymbol = _ele as AnnotationSymbol;
                if (_annotationSymbol.Name == "A-SYMB-Grid Head")
                {
                    allFakeGridNumbers.Add(_annotationSymbol);
                }
            }

            List <Reference> pickFakeGridNumber = sel.PickObjects(ObjectType.Element, new SelPickFilter_GenericAnnotation(), "请多选择假轴号").ToList();

            List <AnnotationSymbol> FakeGridNumbers = new List <AnnotationSymbol>();
            foreach (Reference _reference in pickFakeGridNumber)
            {
                AnnotationSymbol annotationSymbol = doc.GetElement(_reference) as AnnotationSymbol;
                if (annotationSymbol.Name == "A-SYMB-Grid Head")
                {
                    FakeGridNumbers.Add(annotationSymbol);
                }
            }
            int FakeGridNumCount = FakeGridNumbers.Count;
            if (FakeGridNumCount <= 0)
            {
                _Methods.TaskDialogShowMessage("未选择假轴号");
            }
            else
            {
                //高亮显示所有目标假轴号
                //sel.SetElementIds(selGridsIds);

                //根据窗口所选轴号类型进行轴网编号
                if (CMD.changeCommand == "gridCrosswise123")     //横向轴号//采用1,2,3,4,5,6,,,的形式
                {
                    IList <string> GridName = GetGridName1_10(); //手动创建进深方向的轴号1、2、3、4、5、6、7、8、9、10、……
                    SetGridNumber(doc, FakeGridNumCount, GridName, allFakeGridNumbers, FakeGridNumbers);
                }
                else if (CMD.changeCommand == "gridVerticalA1") //竖向轴号//采用A1,B2,C3,,,的形式
                {
                    IList <string> GridName = GetGridNameA1();  //手动创建进深方向的轴号1、2、3、4、5、6、7、8、9、10、……
                    SetGridNumber(doc, FakeGridNumCount, GridName, allFakeGridNumbers, FakeGridNumbers);
                }
                else if (CMD.changeCommand == "gridVerticalAA") //竖向轴号//采用AA,BA,CA,,,的形式
                {
                    IList <string> GridName = GetGridNameAA();  //手动创建进深方向的轴号1、2、3、4、5、6、7、8、9、10、……
                    SetGridNumber(doc, FakeGridNumCount, GridName, allFakeGridNumbers, FakeGridNumbers);
                }
                else
                {
                    _Methods.TaskDialogShowMessage("未选择轴网类型");
                }
            }//else
        }
コード例 #6
0
        /// <summary>
        /// Reads symbol record from symbol references for the specified index.
        /// </summary>
        /// <param name="index">Index of the symbol record.</param>
        private SymbolRecord GetSymbol(int index)
        {
            // Since DictionaryCache is allowing only single thread to call this function, we don't need to lock reader here.
            SymbolRecordReference reference = references[index];

            Reader.Position = reference.DataOffset;
            switch (reference.Kind)
            {
            case SymbolRecordKind.S_GPROC32:
            case SymbolRecordKind.S_LPROC32:
            case SymbolRecordKind.S_GPROC32_ID:
            case SymbolRecordKind.S_LPROC32_ID:
            case SymbolRecordKind.S_LPROC32_DPC:
            case SymbolRecordKind.S_LPROC32_DPC_ID:
                return(ProcedureSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_PUB32:
                return(Public32Symbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_CONSTANT:
            case SymbolRecordKind.S_MANCONSTANT:
                return(ConstantSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_LDATA32:
            case SymbolRecordKind.S_GDATA32:
            case SymbolRecordKind.S_LMANDATA:
            case SymbolRecordKind.S_GMANDATA:
                return(DataSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_PROCREF:
            case SymbolRecordKind.S_LPROCREF:
                return(ProcedureReferenceSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_TOKENREF:
                return(TokenReferenceSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_UDT:
            case SymbolRecordKind.S_COBOLUDT:
                return(UdtSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_LTHREAD32:
            case SymbolRecordKind.S_GTHREAD32:
                return(ThreadLocalDataSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_GMANPROC:
            case SymbolRecordKind.S_LMANPROC:
                return(ManagedProcedureSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_BLOCK32:
                return(BlockSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_OEM:
                return(OemSymbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            case SymbolRecordKind.S_UNAMESPACE:
                return(NamespaceSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_MANSLOT:
                return(AttributeSlotSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_END:
            case SymbolRecordKind.S_INLINESITE_END:
                return(EndSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_ANNOTATION:
                return(AnnotationSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_ANNOTATIONREF:
                return(AnnotationReferenceSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_REGREL32:
                return(RegisterRelativeSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_OBJNAME:
                return(ObjectNameSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_COMPILE2:
                return(Compile2Symbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_COMPILE3:
                return(Compile3Symbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_ENVBLOCK:
                return(EnvironmentBlockSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_BUILDINFO:
                return(BuildInfoSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_FRAMEPROC:
                return(FrameProcedureSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_LABEL32:
                return(LabelSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_HEAPALLOCSITE:
                return(HeapAllocationSiteSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_CALLSITEINFO:
                return(CallSiteInfoSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_FRAMECOOKIE:
                return(FrameCookieSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_THUNK32:
                return(Thunk32Symbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            case SymbolRecordKind.S_LOCAL:
                return(LocalSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_DEFRANGE_REGISTER:
                return(DefRangeRegisterSymbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            case SymbolRecordKind.S_DEFRANGE_REGISTER_REL:
                return(DefRangeRegisterRelativeSymbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            case SymbolRecordKind.S_DEFRANGE_SUBFIELD_REGISTER:
                return(DefRangeSubfieldRegisterSymbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            case SymbolRecordKind.S_DEFRANGE_FRAMEPOINTER_REL:
                return(DefRangeFramePointerRelativeSymbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            case SymbolRecordKind.S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE:
                return(DefRangeFramePointerRelativeFullScopeSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_CALLEES:
            case SymbolRecordKind.S_CALLERS:
                return(FunctionListSymbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            case SymbolRecordKind.S_FILESTATIC:
                return(FileStaticSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_TRAMPOLINE:
                return(TrampolineSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_SECTION:
                return(SectionSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_COFFGROUP:
                return(CoffGroupSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_EXPORT:
                return(ExportSymbol.Read(Reader, this, index, reference.Kind));

            case SymbolRecordKind.S_INLINESITE:
                return(InlineSiteSymbol.Read(Reader, this, index, reference.Kind, reference.DataLen));

            default:
#if DEBUG
                throw new NotImplementedException($"Unknown reference kind: {reference.Kind}");
#else
                return(null);
#endif
            }
        }