Initialization code in your F# AutoCAD application
Back from a nice long weekend, although I spent most of it sick with a cold. I find this increasingly the way with me: I fend off illness for months at a time (probably through stress, truth be told) but then I get a few days off and wham. A shame, as we had a huge dump of snow over the weekend... we get white Christmases here every five years or so, but it's really uncommon to get a white Easter.
I had a very interesting question come in by email from 冷血儿, who wanted to get the technique shown in this post working in his F# application.
Here's the F# code I managed to put together after consulting hubFS, in particular:
type InitTest() =
let ed =
interface IExtensionApplication with
member x.Initialize() =
("\nInitializing - do something useful.")
member x.Terminate() =
printfn "\nCleaning up..."
module MyApplication =
let ed =
let f () =
ed.WriteMessage("\nThis is the TST command.")
[<assembly: ExtensionApplication(type InitTest)>]
Here's what happens when we load our module and run the TST command:
Initializing - do something useful.
This is the TST command.