private List <MyShape> parseStringDataToListShapeObject(string data) { List <MyShape> myShapes = new List <MyShape>(); string firstWord = null; string[] listShape = data.Split('\n'); for (int i = 0; i < listShape.Length; i++) { if (listShape[i] != "") { firstWord = listShape[i].Substring(0, listShape[i].IndexOf(" ")); } switch (firstWord) { case "Line": MyShape myLine = new MyLine(); myLine.Open(listShape[i]); myShapes.Add(myLine); break; case "Rectangle": MyShape myRectangle = new MyRectangle(); myRectangle.Open(listShape[i]); myShapes.Add(myRectangle); break; case "Circle": MyShape myCircle = new MyCircle(); myCircle.Open(listShape[i]); myShapes.Add(myCircle); break; case "Ellipse": MyShape myEllipse = new MyEllipse(); myEllipse.Open(listShape[i]); myShapes.Add(myEllipse); break; case "Polygon": MyShape myPolygon = new MyPolygon(); myPolygon.Open(listShape[i]); myShapes.Add(myPolygon); break; case "Bezier": MyShape myBezier = new MyBezier(); myBezier.Open(listShape[i]); myShapes.Add(myBezier); break; case "Polyline": MyShape myPolyline = new MyPolyline(); myPolyline.Open(listShape[i]); myShapes.Add(myPolyline); break; } firstWord = ""; } return(myShapes); }
public static Entity ConverToCustomEntity(ObjectId CurrentEntityOI, int ProductCode, int ProductType) { Entity ent = Atend.Global.Acad.UAcad.GetEntityByObjectID(CurrentEntityOI); MyCircle c = ent as MyCircle; if (c != null) { #region Convert to mycircle c.AdditionalDictionary.Add("ProductType", ProductType); c.AdditionalDictionary.Add("ProductCode", ProductCode); ent = c; #endregion } else { MyPolyline p = ent as MyPolyline; if (p != null) { #region convert to polyline p.AdditionalDictionary.Add("ProductType", ProductType); p.AdditionalDictionary.Add("ProductCode", ProductCode); ent = p; #endregion } else { MyLine l = ent as MyLine; if (l != null) { #region convert to line l.AdditionalDictionary.Add("ProductType", ProductType); l.AdditionalDictionary.Add("ProductCode", ProductCode); ent = l; #endregion } else { // it was nothing } } } return(ent); }