static public void GetXData() { AcAp.Document doc = AcApp.DocumentManager.MdiActiveDocument; AcEd.Editor ed = doc.Editor; AcEd.PromptEntityOptions opt = new AcEd.PromptEntityOptions("\nSelect entity: "); AcEd.PromptEntityResult res = ed.GetEntity(opt); if (res.Status == AcEd.PromptStatus.OK) { using (AcDb.Transaction tr = doc.TransactionManager.StartTransaction()) { AcDb.DBObject obj = tr.GetObject(res.ObjectId, AcDb.OpenMode.ForRead); AcDb.ResultBuffer rb = obj.XData; if (rb == null) { ed.WriteMessage("\nEntity does not have XData attached."); } else { int n = 0; foreach (AcDb.TypedValue tv in rb) { ed.WriteMessage("\nTypedValue {0} - type: {1}, value: {2}", n++, tv.TypeCode, tv.Value); } rb.Dispose(); } } } }
private static void SetAssignmentsDict() { using (var rb = new _AcDb.ResultBuffer(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Text, "c:Plan2AutoIdVergabeSetAssignments"))) { int stat = 0; _AcDb.ResultBuffer res = CADDZone.AutoCAD.Samples.AcedInvokeSample.InvokeLisp(rb, ref stat); if (stat == RTNORM && res != null) { res.Dispose(); } } }
public static void SetXData(AcDb.ObjectId objectId, AcDb.ResultBuffer valueXData) { AcAp.Document doc = AcApp.DocumentManager.MdiActiveDocument; using (AcDb.Transaction tr = doc.TransactionManager.StartTransaction()) { AcDb.DBObject obj = tr.GetObject(objectId, AcDb.OpenMode.ForWrite); AddRegAppTableRecord((string)valueXData.AsArray()[0].Value); obj.XData = valueXData; valueXData.Dispose(); tr.Commit(); } }
public static void InvokeCGeoin() { _AcDb.ResultBuffer args = new _AcDb.ResultBuffer(); int stat = 0; args.Add(new _AcDb.TypedValue(RTSTR, "c:geoin")); _AcDb.ResultBuffer res = InvokeLisp(args, ref stat); if (stat == RTNORM && res != null) { PrintResbuf(res); res.Dispose(); } }
public static void InvokeCLisp(string funcNameWithoutC) { _AcDb.ResultBuffer args = new _AcDb.ResultBuffer(); int stat = 0; args.Add(new _AcDb.TypedValue(RTSTR, "c:" + funcNameWithoutC)); _AcDb.ResultBuffer res = InvokeLisp(args, ref stat); if (stat == RTNORM && res != null) { PrintResbuf(res); res.Dispose(); } }
internal List <ZuweisungsInfo> GetAssignmentsDictOld() { List <ZuweisungsInfo> zwInfos = new List <ZuweisungsInfo>(); try { //using (var rb = new ResultBuffer(new TypedValue((int)Autodesk.AutoCAD.Runtime.LispDataType.Text, "c:Plan2AutoIdVergabeSetAssignments"))) using (var rb = new _AcDb.ResultBuffer(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Text, "c:GetPlan2AutoIdVergabeAssignmentsDict"))) { int stat = 0; _AcDb.ResultBuffer res = CADDZone.AutoCAD.Samples.AcedInvokeSample.InvokeLisp(rb, ref stat); if (stat == RTNORM && res != null) { var arr = res.AsArray(); if (arr != null && arr.Length > 1) { int pos = 0; while (pos < arr.Length) { // list begin var rbFrom = arr[pos + 1]; var rbTo = arr[pos + 2]; // dotted pair zwInfos.Add(new ZuweisungsInfo() { FromAtt = rbFrom.Value.ToString(), ToAtt = rbTo.Value.ToString() }); pos += 4; } } res.Dispose(); } } } catch (Exception) { // todo: log error } return(zwInfos); }
private static void GetConfiguration() { _CurrentConfig = string.Empty; using (var rb = new _AcDb.ResultBuffer(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Text, "c:Plan2CurrentConfig"))) { int stat = 0; _AcDb.ResultBuffer res = CADDZone.AutoCAD.Samples.AcedInvokeSample.InvokeLisp(rb, ref stat); if (stat == RTNORM && res != null) { _CurrentConfig = res.AsArray()[0].Value.ToString(); res.Dispose(); } else { throw new InvalidOperationException("Konnte Konfigurationsdateiname nicht ermitteln!"); } } }
public static void TestInvokeLisp() { _AcDb.ResultBuffer args = new _AcDb.ResultBuffer(); int stat = 0; args.Add(new _AcDb.TypedValue(RTSTR, "getplan2config")); //args.Add(new TypedValue(RTSTR, "vlax-ldata-get")); //args.Add(new TypedValue(RTSTR, "AA_PLAN2")); //args.Add(new TypedValue(RTSTR, "ConfigFile")); //args.Add(new TypedValue(RTLONG, 100)); //args.Add(new TypedValue(RTLONG, 200)); _AcDb.ResultBuffer res = InvokeLisp(args, ref stat); if (stat == RTNORM && res != null) { PrintResbuf(res); res.Dispose(); } }
static public void SetXData() { AcAp.Document doc = AcApp.DocumentManager.MdiActiveDocument; AcEd.Editor ed = doc.Editor; AcEd.PromptEntityOptions opt = new AcEd.PromptEntityOptions("\nSelect entity: "); AcEd.PromptEntityResult res = ed.GetEntity(opt); if (res.Status == AcEd.PromptStatus.OK) { using (AcDb.Transaction tr = doc.TransactionManager.StartTransaction()) { AcDb.DBObject obj = tr.GetObject(res.ObjectId, AcDb.OpenMode.ForWrite); AddRegAppTableRecord("KEAN"); AcDb.ResultBuffer rb = new AcDb.ResultBuffer( new AcDb.TypedValue(1001, "KEAN"), new AcDb.TypedValue(1000, "This is a test string") ); obj.XData = rb; rb.Dispose(); tr.Commit(); } } }