Example #1
0
        //public Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
        //{
        //    ElementUpdater updater = new ElementUpdater(application.ActiveAddInId);
        //    UpdaterRegistry.RegisterUpdater(updater);
        //    ElementClassFilter elementFilter = new ElementClassFilter(typeof(Element));
        //    UpdaterRegistry.AddTrigger(updater.getUpdaterId(), elementFilter, Element.GetChangeTypeParameter());

        //    return Result.Succeeded;
        //}

        //public Result OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
        //{
        //    return Result.Succeeded;
        //}

        void GetStyles(ref Element dynVolatileStyle, ref Element dynPersistentStyle,
                       ref Element dynXStyle, ref Element dynYStyle, ref Element dynZStyle)
        {
            Curve                tick      = m_revit.Application.Create.NewLineBound(new XYZ(), new XYZ(0, 1, 0));
            Plane                p         = new Plane(new XYZ(0, 0, 1), new XYZ());
            SketchPlane          sp        = m_doc.Document.Create.NewSketchPlane(p);
            ModelCurve           ml        = m_doc.Document.Create.NewModelCurve(tick, sp);
            ElementArray         styles    = ml.LineStyles;
            ElementArrayIterator styleIter = styles.ForwardIterator();

            while (styleIter.MoveNext())
            {
                Element style = styleIter.Current as Element;
                if (style.Name == "dynVolatile")
                {
                    dynVolatileStyle = style;
                }
                else if (style.Name == "dynPersistent")
                {
                    dynPersistentStyle = style;
                }
                else if (style.Name == "dynX")
                {
                    dynXStyle = style;
                }
                else if (style.Name == "dynY")
                {
                    dynYStyle = style;
                }
                else if (style.Name == "dynZ")
                {
                    dynZStyle = style;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Get SpanDirection and SpanDirectionSymobols of Floor
        /// </summary>
        /// <param name="floor"></param>
        void GetSpanDirectionAndSymobls(Floor floor)
        {
            if (null != floor)
            {
                // get SpanDirection angle of Floor(Slab)
                // The angle returned is in radians. An exception will be thrown if the floor
                // is non structural.
                String spanDirAngle = "Span direction angle: " + floor.SpanDirectionAngle.ToString() + "\r\n";

                // get span direction symbols of Floor(Slab)
                String               symbols     = "Span direction symbols: \r\n\t";
                ElementArray         symbolArray = floor.SpanDirectionSymbols;
                ElementArrayIterator symbolIter  = symbolArray.ForwardIterator();
                symbolIter.Reset();
                while (symbolIter.MoveNext())
                {
                    Element elem = symbolIter.Current as Element;
                    if (elem != null)
                    {
                        symbols += (m_docment.get_Element(elem.GetTypeId()) as ElementType).Name + "\r\n";
                    }
                }

                MessageBox.Show(spanDirAngle + symbols, "Revit Direction", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                new Exception("Get Floor and SpanDirectionAngle and Symbols failed!");
            }
        }