0 Members and 1 Guest are viewing this topic.
if (ent.ExtensionDictionary.IsNull) { Application.ShowAlertDialog("No Dictionary"); } else { Application.ShowAlertDialog("Dictionary exists"); DBDictionary dict = (DBDictionary)tr.GetObject(ent.ExtensionDictionary, OpenMode.ForRead); foreach (DBDictionaryEntry entry in dict) { Application.ShowAlertDialog(entry.Key.ToString()); }
As far as I know, ldatas (LISP datas) can only be acessed from LISP.
[<DllImport("acdb18.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?acdbGetAdsName@@YA?AW4ErrorStatus@Acad@@AAY01JVAcDbObjectId@@@Z")>]let acdbGetAdsName(e: byref<int64>, oid: ObjectId) = ErrorStatus.FileNotFound[<DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)>]let acdbEntGet(e: byref<int64>) = System.IntPtr.Zerolet entGet oid = let mutable e = 0L if acdbGetAdsName(&e, oid) <> ErrorStatus.OK then None else let res = acdbEntGet &e if res = IntPtr.Zero then None else ResultBuffer.Create(res, true) |> Some let test (dic: string) (key: string) = let doc = Application.DocumentManager.MdiActiveDocument let db = doc.Database let ed = doc.Editor use tr = db.TransactionManager.StartTransaction() let nod = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) :?> DBDictionary if nod.Contains dic then let ld = tr.GetObject(nod.GetAt dic, OpenMode.ForRead) :?> DBDictionary if ld.Contains key then entGet(ld.GetAt key) |> Option.iter(fun rb -> for tv in rb do ed.WriteMessage("\n{0} {1} ", tv.TypeCode, tv.Value) rb.Dispose() ) tr.Commit() [<CommandMethod "TEST">]let testCmd() = let ed = Application.DocumentManager.MdiActiveDocument.Editor let psr1 = ed.GetString "dict name" if psr1.Status = PromptStatus.OK then let psr2 = ed.GetString "key name" if psr2.Status = PromptStatus.OK then test psr1.StringResult psr2.StringResult
Does p/invoke entget count as lisp?