.NET

Reply
*Expert Elite*
_gile
Posts: 2,115
Registered: ‎04-29-2006
Message 11 of 12 (204 Views)

Re: SendStringToExecute

03-21-2012 11:00 AM in reply to: _gile

Another way using F# is to define three functions so that the arguments order allows to use the "pipe forward" operator (|>).

 

let get prop param obj =
    obj.GetType().InvokeMember(prop, BindingFlags.GetProperty, null, obj, param)

let set prop param obj =
    obj.GetType().InvokeMember(prop, BindingFlags.SetProperty, null, obj, param) |> ignore

let invoke meth param obj =
    obj.GetType().InvokeMember(meth, BindingFlags.InvokeMethod, null, obj, param)

[<CommandMethod("foo")>]
let foo() =
    let acad = Application.AcadApplication
    acad |> invoke "ZoomExtents" null |> ignore
    acad |> get "Preferences" [||] |> get "Display" [||] |> set "CursorSize" [| 5 |]

 

Gilles Chanteau
Contributor
Hans530
Posts: 11
Registered: ‎03-03-2012
Message 12 of 12 (185 Views)

Re: SendStringToExecute

03-22-2012 08:38 AM in reply to: _gile

Thank you all for your responce

Hans P

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!