extension using c#

extension using c#

Postby icehuli » Tue Dec 31, 2013 4:45 pm

Someone might be interested in using c# and .net stuff.
I created a very simple example to write a ruby extension in c#.
https://bitbucket.org/icehuli/sucsexttutorial
3
User avatar
icehuli 
 

Re: extension using c#

Postby tt_su » Mon Jan 06, 2014 3:37 pm

Cool! That's very interesting.

Last week I was working on a Ruby C Extension in C++ and I started to write a thin wrapper over the Ruby C code so that I could manipulate them as C++ objects. It'd be nice with a set of wrappers like that the various languages.
0
User avatar
tt_su 
SketchUp Team
SketchUp Team
 

Re: extension using c#

Postby icehuli » Fri Mar 14, 2014 4:03 am

The C# stuff works on SketchUp 2014 with Ruby 2.0.0
0
User avatar
icehuli 
 

Re: extension using c#

Postby Dan Rathbun » Fri Mar 14, 2014 5:19 am

icehuli wrote:The C# stuff works on SketchUp 2014 with Ruby 2.0.0

ALL tutorials should show ALL objects being created INSIDE an Author's toplevel module.

We usually use the module name Author or AuthorNamespace or CompanyNamespace, etc., do denote that the end user should replace that name with their own toplevel module name.

Only Ruby and the API (in rare cases,) should ever create classes at the toplevel (aka TOPLEVEL_BINDING.)

:idea:
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    Re: extension using c#

    Postby icehuli » Fri Mar 14, 2014 9:24 pm

    Dan Rathbun wrote:
    icehuli wrote:The C# stuff works on SketchUp 2014 with Ruby 2.0.0

    ALL tutorials should show ALL objects being created INSIDE an Author's toplevel module.

    We usually use the module name Author or AuthorNamespace or CompanyNamespace, etc., do denote that the end user should replace that name with their own toplevel module name.

    Only Ruby and the API (in rare cases,) should ever create classes at the toplevel (aka TOPLEVEL_BINDING.)

    :idea:



    Thanks for the reminding.
    0
    User avatar
    icehuli 
     

    Re: extension using c#

    Postby icehuli » Mon May 14, 2018 12:12 am

    in case somebody using it, added a new project "IHL_CsR22ExtApp0" for Sketchup 2018/2017 x64 with ruby 22
    0
    User avatar
    icehuli 
     

    Re: extension using c#

    Postby jolran » Tue Jun 12, 2018 9:45 am

    Interesting stuff indeed, and nice job Icehuli!

    It looks like you are wrapping a lot of Ruby-communication-code into C#.
    Does it work well ? How is the performance ?
    Ive read the UnmanagedExports-package puts a bit of overhead.
    Was rather old info, I'll be intreseted to know if it has been improved.

    I'm working on a similar project with a WPF application.
    In my project I use a different pattern in using a C++/Cli "Bridge-layer" with a C++/cli ref-class that subclass the WPF app. Then I can use that class to communicate with C++ as normal through exporting the required functions.
    This means off course writing the bussiness-layer and Ruby-Communication layer in C++,
    and (for the most part) only using C# for the front-end.

    I had some problems running the application if I did not put the assembly in the same folder as Sketchup.exe. I don't want to hijack your post but it would be interesting to hear if you have any experience with this.

    The solution I found is to handle the event when the Appdomain cant locate an assembly.
    AppDomain ResolveEventHandler
    This SO-topic has some code: https://stackoverflow.com/questions/137 ... ime-in-net (msarahan C++/Cli version a bit further down).
    This requires a longliving Application though.


    I could also possibly explicitly load the assembly, and then use reflection to create an instance. But it becomes quite complicated when I want to use a C++/Cli ref class as subclass.

    I wonder what the policy is regarding putting dll's in the Sketchup folder ?
    0
    User avatar
    jolran 
    PluginStore Author
    PluginStore Author
     

    SketchUcation One-Liner Adverts

    by Ad Machine » 5 minutes ago



    Ad Machine 
    Robot
     



     

    Return to Developers' Forum

    Who is online

    Users browsing this forum: Google Bot, linrourou, shobair133 and 4 guests

    Visit our sponsors: