Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 39

Thread: Calling DrLavas LaserDACLibrary (UDAC) from C#.NET

  1. #11
    Join Date
    Sep 2007
    Location
    Omaha, NE
    Posts
    769

    Default

    Hey There,
    I played around with a wrapper quite some time ago, but didn't have much luck either. I was chomping at the bit to make a working wrapper for it but hit a snag then got distracted. Unfortunately I got hung up on the first stage of any laser app, the "init" of the dac(s). I will attach the test program I started to mess with, if you would like to compare notes. If you can get it to fly, that would be great. I sold my Riya DAC, and now just have a couple of old easylase to fiddle with. I haven't been laser coding too much in the last few years, but I do kinda miss the torture Good luck, I'm rootin' for ya.
    -Mike

    edit: I looked more closely in that project and I didn't implement the SendFrame yet-
    One thing that I typically did in the past when making wrappers like this was to look at existing wrappers that I knew worked.
    Here is a snippet of the DLLIMPORT lines from the easylase wrapper- they should still have this sample code available for download somewhere on the jmlaser website.
    [DllImport(@"easylase.dll", CallingConvention = CallingConvention.StdCall)]
    private static extern bool EasyLaseClose();
    [DllImport(@"easylase.dll", CallingConvention = CallingConvention.StdCall)]
    private static extern int EasyLaseGetCardNum();
    [DllImport("easylase.dll")]
    private static extern int EasyLaseGetStatus(ref int cardNumber);
    [DllImport(@"easylase.dll", CallingConvention = CallingConvention.StdCall)]
    private static extern bool EasyLaseStop(ref int cardNumber);
    [DllImport(@"easylase.dll", CallingConvention = CallingConvention.StdCall)]
    private static extern bool EasyLaseWriteFrame(ref int cardNumber, EasyLasePoint[] datapointer, int bytecount, ushort speed);
    [DllImport("easylase.dll")]
    private static extern int EasyLaseDMXOut(ref int cardNumber,byte[] dmxdata,ushort basechannel,ushort numchannels );

    -Mike
    Attached Files Attached Files
    Last edited by mikkojay; 07-25-2012 at 22:52.


  2. #12
    Join Date
    Mar 2012
    Location
    Urduliz, Spain
    Posts
    65

    Default

    Thanks mikkojay

    I will take a look right now, and write back later to say something.

    I think I have no problems with DLLIMPORT or calling Laser library Functions. I get no Error on Etherdream Init, number of devices=1, but no DEVICE NAME shows when calling getDACinfo.

    And when it begin sending frames everything goes wrong, projector just paints a bunch of linesClick image for larger version. 

Name:	wrapper.jpg 
Views:	26 
Size:	89.3 KB 
ID:	33956.

    I have also attached my test code, maybe you can see something on it. I will test yours.
    Attached Files Attached Files
    Last edited by Osithlon; 07-26-2012 at 00:17.

  3. #13
    Join Date
    Mar 2012
    Location
    Urduliz, Spain
    Posts
    65

    Default

    After some holidays, I´m back.

    I´ve decide to continue with C++ and not try to export UDAC to C#.

    Thanks everybody

  4. #14
    Join Date
    Feb 2009
    Location
    East Coast of Southern Virginia
    Posts
    536

    Default

    I have a C++ class wrapper that I have been working on. If you are interested I can email you a copy of it.

  5. #15
    Join Date
    Mar 2012
    Location
    Urduliz, Spain
    Posts
    65

    Default

    Quote Originally Posted by cfavreau View Post
    I have a C++ class wrapper that I have been working on. If you are interested I can email you a copy of it.
    Hi Chris

    Of course Im interested, I have made some nice improvements in my project with C++, but Im sure I can be faster and more efficient if I use C#.

    Send me aprivate.

    Thanks in advance

  6. #16
    Join Date
    Oct 2011
    Location
    Graz, Austria
    Posts
    43

    Default

    Let me know if you still need a sample C# project or file. I talked to drLava a while ago and we successfully wrapped the basic functions. Works absolutely fine. I'm just not lucky with the blanking bit yet, but can't be such a big issue.

    Matthias

  7. #17
    Join Date
    Jul 2006
    Location
    Belgium
    Posts
    306

    Default

    Quote Originally Posted by Osithlon View Post
    How to use DRLavas Library from C#.NET. I tried using DLLIMPORT, but there are lots of pointers and other types that gives sosme problems converting to C#.
    Create an unsafe .net wrapper DLL.

  8. #18
    Join Date
    Mar 2012
    Location
    Urduliz, Spain
    Posts
    65

    Default

    Hi Nagilo,

    Im working with C++, but it wil lbe great if you can give access to you code and make some test with your C# wrapper.

    Let me know wher eto download it, or sen it to my email.

    Thnaks in advance

  9. #19
    Join Date
    Oct 2011
    Location
    Graz, Austria
    Posts
    43

    Default

    Hey Osithlon.

    Sorry for the delay - I was a bit busy these days. Here the link for the C# version. It was created in .NET Framework 4.0 using VisualStudio 2010. Set the right enum for your DAC in Program.cs and checkout the DAC.cs and NativeMethods.cs on how to use the underlying unmanaged LaserDAC_Demo that was originally created by drLava. Many thanks to him.

    Download here

    Mat

  10. #20
    Join Date
    Mar 2012
    Location
    Urduliz, Spain
    Posts
    65

    Default

    Thanks Nagilo, i will try it and tell you something about it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •