Beispiel #1
0
        private static Xrecord GetValueRecord(this AcTransaction trans, string valName)
        {
            valName = Ac.GetValidName(valName);

            var valDict = trans.GetGeo7Dict("Values");

            if (valDict.Contains(valName))
            {
                var valId = valDict.GetAt(valName);
                return(trans.GetObject <Xrecord>(valId));
            }
            else
            {
                var typedVal = new TypedValue((int)DxfCode.Text, "");
                using (var resBuff = new ResultBuffer(typedVal))
                {
                    var xRec = new Xrecord();
                    xRec.Data = resBuff;
                    valDict.SetAt(valName, xRec);
                    trans.AddNewlyCreatedDBObject(xRec, true);
                    return(xRec);
                }
            }



            //ResultBuffer resbuf = new ResultBuffer(  new TypedValue((int)DxfCode.Text, "HELLO"),
            //     new TypedValue((int)DxfCode.Int16, 256),
            //     new TypedValue((int)DxfCode.Real, 25.4));
        }
Beispiel #2
0
        private void ChangePolygonLayer(AcTransaction trans, Polyline polygon, List <DBText> texts)
        {
            polygon.UpgradeOpen();
            string layerName = "";

            if (texts.Count < 1)
            {
                layerName = "#PolygonsWithoutTextInside";
            }
            else if (texts.Count == 1)
            {
                layerName = texts[0].TextString;
            }
            else
            {
                var textStrings = from t in texts select t.TextString.Trim();

                string prefix = "#" + textStrings.Count().ToString() + "-";
                layerName = prefix + textStrings.ToList().Join("-");
            }

            layerName       = Ac.GetValidName(layerName);
            polygon.LayerId = trans.CreateLayer(layerName);
        }