예제 #1
0
        private void UpdateGeometry(List <object> geomObjs)
        {
            if (geomObjs.Count != _previousIds.Count || geomObjs.Count != _previousRefs.Count)
            {
                throw new InvalidOperationException("Cannot update geometry, counts dont match");
            }

            Transaction trans = new Transaction(_document);

            trans.Start("pipe_pull_update");
            for (int i = 0; i < geomObjs.Count; i++)
            {
                Element        elem    = _document.GetElement(_previousIds[i]);
                GeometryObject oldGeom = elem.GetGeometryObjectFromReference(_previousRefs[i]);
                if (oldGeom.GetType() != geomObjs[i].GetType())
                {
                    continue;
                }
                if (typeof(ModelCurve).IsAssignableFrom(elem.GetType()) && typeof(Curve).IsAssignableFrom(geomObjs[i].GetType()))
                {
                    ModelCurve curveElem = (ModelCurve)elem;
                    curveElem.SetGeometryCurve((Curve)geomObjs[i], true);
                }
            }
            trans.Commit();
        }