http://opalkelly.com/

Author Topic: Eagle negative printing  (Read 1498 times)

0 Members and 1 Guest are viewing this topic.

Offline l3VGV

  • Newbie
  • Posts: 3
  • Country: ru
Eagle negative printing
« on: November 15, 2016, 11:29:09 AM »
So i made some hobby project in eagle only to find out that in 2016 i cannot print it in negative(for photoresist dry film). Well i do not have Adobe Post script editor, or gerber viewer.  But i have more than 20years of windows programming experience...

How hard can it be to modify a program without source code for some feature that exist in all other similar apps. Well, its pretty simple - microsoft did everething to make it so.

I made a Detours dll wich hack inside eagle process and get things right.
How to use it,
1) we need withdll.exe its a part of microsoft detours (express version is free and limited to x86 u can get it there https://www.microsoft.com/en-us/research/project/detours/ )
2) eaglecad_helper.dll with all the magic
3) we need to use withdll.exe to load that dll into eagle process. i doing that with shortcut like that
withdll.exe -d:eaglecad_helper.dll "e:\elec\EAGLE-7.2.0\bin\eagle2.exe"

where bold part is path to your eagle executable.

withdll.exe will run a new copy of eagle with dll injected and then if u print somethin it will come out in negative colors. If u need normal printing just restart eagle normaly.


Work good on my laser jet 1018 and canon ink printer mg5340, and some other. Should work with any eagle version but only 32bit build.



**********



Here is source code, so complicated that thay can not do it without my help:

Code: [Select]
__declspec(dllexport) int WINAPI  MyEndPage(__in HDC hdc)
{
printInAction = 0;


PatBlt ( hdc, 0, 0, GetDeviceCaps ( hdc, HORZRES ), GetDeviceCaps ( hdc, VERTRES ), DSTINVERT );


return TrueEndPage(hdc);
}


BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}



if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)TrueEndPage, MyEndPage);
DetourTransactionCommit();
}
else if (ul_reason_for_call == DLL_PROCESS_DETACH)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)TrueEndPage, MyEndPage);
DetourTransactionCommit();
}


return TRUE;
}

PatBlt ( hdc, 0, 0, GetDeviceCaps ( hdc, HORZRES ), GetDeviceCaps ( hdc, VERTRES ), DSTINVERT );
that part is doing actual work, 1 line of code. everething else is just detour hack sturtup code...


I attached compiled version and sources, u can build it with visual studio express.
« Last Edit: November 15, 2016, 07:43:07 PM by l3VGV »
 
The following users thanked this post: vzoole

Offline jgarc063

  • Regular Contributor
  • *
  • Posts: 69
  • Country: us
Re: Eagle negative printing
« Reply #1 on: November 16, 2016, 03:57:57 AM »
Wow I3VGV,

That is very impressive. I just wanted to let you know that in the CAM processor you can use the PS_INVERTED device in order to get inverted postscript for generating your negatives.

I enjoyed reading about how you did the hack, I'm sure others will find it useful for other applications.

Best Regards,
Jorge Garcia
Autodesk Support
 

Offline l3VGV

  • Newbie
  • Posts: 3
  • Country: ru
Re: Eagle negative printing
« Reply #2 on: November 16, 2016, 09:21:36 PM »
What one do with postscript files nowdays? Is there any good and free software to view and print it? I wasnt able to find any.
 

Online timb

  • Super Contributor
  • ***
  • Posts: 2336
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Eagle negative printing
« Reply #3 on: November 16, 2016, 11:32:19 PM »
What one do with postscript files nowdays? Is there any good and free software to view and print it? I wasnt able to find any.

GSView/Ghostscript for viewing/printing, etc.

And yes, PostScript is still widely used today. You may even use it on a daily basis and not even know it! The entire macOS/iOS display subsystem (Quartz) is based on PostScript. PDF is also based on PostScript.

Fun Fact: PostScript is actually a (Turing complete) programming language.
« Last Edit: November 16, 2016, 11:38:35 PM by timb »
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline technotronix

  • Regular Contributor
  • *
  • Posts: 209
  • Country: us
    • PCB Assembly
Re: Eagle negative printing
« Reply #4 on: December 30, 2016, 06:52:31 PM »
Thanks for sharing your eagle project here. I really enjoyed.
 

Offline richardlawson1489

  • Regular Contributor
  • *
  • Posts: 125
  • Country: us
    • PCB Assembly
Re: Eagle negative printing
« Reply #5 on: February 01, 2017, 06:43:33 PM »
What one do with postscript files nowdays? Is there any good and free software to view and print it? I wasnt able to find any.

Learn more on postscript from here. http://www.howtogeek.com/100016/printing-what-is-postscript/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf