Call C++ from ruby in Sketchup
-
I'm trying to enable panel optimisation in my plugin and the code to do this properly is exceedingly complex so I've been trying to track down some code that already exists for this... I run a mac and most libraries to run this function work with dll which is no good, but I have managed to track down one that should work with c++ ...
Cut 2D X - wood, glass, metal, sheet, paper, cutting and nesting library
Automation component (library) for rectangular (2D) nesting and cutting optimization of glass, wood, metal, paper, sheets. Can be used with Delphi, Visual Basic, C#, Java, Excel, VC++ etc.
(optimalprograms.com)
So my question is... If this does work (i've sent an email to the company to enquire), can I run / access the c++ file / function from within ruby and obtain the results in ruby...?
would really appreciate it if anyone has any ideas on this or in general the whole panel optimisation / 2d bin backing / 2d stock cutting problem thing???
Thanks
-
You can write a Ruby C Extension - that will et you use C/C++ libraries.
Here's a GitHub repo with example Visual Studio and Xcode examples:
https://github.com/SketchUp/ruby-c-extension-examples -
I notice this was last updated for SU 2015, last commit Nov 7 2014 - does it still work with SU 2016?
Advertisement