0 Members and 1 Guest are viewing this topic.
module ListLoadedCommandsopen Autodesk.AutoCAD.EditorInputopen Autodesk.AutoCAD.Runtimetype acApp = Autodesk.AutoCAD.ApplicationServices.Applicationlet CCAtype = typeof<CommandClassAttribute>let CMAtype = typeof<CommandMethodAttribute>let toCCA (o: obj) = o :?> CommandClassAttributelet toCMA (o: obj) = o :?> CommandMethodAttributelet typeToCommandMethods (tp: System.Type) = tp.GetMethods() |> Array.collect (fun mi -> mi.GetCustomAttributes(CMAtype, true)) let typeArrayToCommandMethodNames = Array.collect typeToCommandMethods >> Array.map (fun o -> (toCMA o).GlobalName)[<CommandMethod "LLC">]let listLoadedCommandsCmd() = let ed = acApp.DocumentManager.MdiActiveDocument.Editor let asms = System.AppDomain.CurrentDomain.GetAssemblies() for asm in asms do let cmdsMarked = asm.GetCustomAttributes(CCAtype, true) |> Array.map (fun o -> (toCCA o).Type) |> typeArrayToCommandMethodNames let cmdsUnmarked = asm.GetExportedTypes() |> typeArrayToCommandMethodNames |> Array.filter (fun cmd -> match Array.tryFind ((=) cmd) cmdsMarked with | Some _ -> false | None -> true ) if not(Array.isEmpty cmdsUnmarked) then ed.WriteMessage( "\n{0}\n{1}\n{2}\n ", asm.ManifestModule.Name, asm.FullName, System.String.Join(", ", cmdsUnmarked) )
Starting point was Kean's post from almost 4 years ago, http://through-the-interface.typepad.com/through_the_interface/2007/03/getting_the_lis.html#comments.< .. > Cheers, Thorsten