I need some help from someone that has more knowledge then me about using outside applications inside of .net C#.
We have a program written in VB that runs in the background of AutoCAD so when "Qsave" is used,
it saves some attribute information in an AutoCAD block and sends it to our Nesting Program that is outside AutoCAD.
The VB code works for our old R2006 and also our new 2012 Acad.
This is the core of the working code:
Dim objsn As Automation
Set objsn = New Automation
Select Case UCase$(material)
Case "PLYWOOD"
objsn.ExeBatchString "SET,PARTPATH,G:\SNDATA70\PARTS\WOOD\"
objsn.ExeBatchString "SET,MACHINE,LUND"
Case "ALUMINUM"
objsn.ExeBatchString "SET,PARTPATH,G:\SNDATA70\PARTS\ALUMINUM\"
objsn.ExeBatchString "SET,MACHINE,LUNDAlum"
Case "EMBOSSED"
objsn.ExeBatchString "SET,PARTPATH,G:\SNDATA70\PARTS\ALUMINUM\"
objsn.ExeBatchString "SET,MACHINE,LUNDAlum"
Case "PLUSH_CARPET"
objsn.ExeBatchString "SET,PARTPATH,G:\SNDATA70\PARTS\CARPET\"
objsn.ExeBatchString "SET,MACHINE,Lectra"
Case "VINYL_CARPET"
objsn.ExeBatchString "SET,PARTPATH,G:\SNDATA70\PARTS\CARPET\"
objsn.ExeBatchString "SET,MACHINE,Lectra"
End Select
objsn.ExeBatchString "SET,DISPLAYLOGDATA,OFF"
objsn.ExeBatchString "SET,PARTREPLACE,ALL"
objsn.ExeBatchString "SET,REPLACEPATTERN,ON"
objsn.ExeBatchString "SET,MIRROR," & mirror
objsn.ExeBatchString "SET,GRAIN,OFF"
objsn.ExeBatchString "SET,ANGLE," & angle & "," & deg
objsn.ExeBatchString "SET,INTSAMEASEXT,OFF"
objsn.ExeBatchString "SET,LOOKUP,MATERIAL,OFF"
objsn.ExeBatchString "SET,LOOKUP,PROCESS,OFF"
objsn.ExeBatchString "SET,LEADIN,None"
objsn.ExeBatchString "SET,INTERNAL,LEADIN,NONE"
objsn.ExeBatchString "SAVE,PART,ON"
Now I've converted the VB code to C# and compiled it to a .dll.
It builds fine and gives no warnings and it net loads fine.
All the event handlers work when I hit qsave.
All the strings are aquired fine.
As soon as I add the SNAutomation objsn = new SNAutomation();
to the code, it's like everything falls into a black hole.
The program runs but sends nothing to the nesting program
and any writelines I add after getting the instance of the do not show up on the screen.
Just wondering if there something with .net that won't compile this outside nesting application
or if I am just missing something simple when compiling a .dll. :blank:
I've added all the right resouces (type libraries) included with the nesting program install.
Here's the C# code:
Automation objsn = new Automation();
switch (material.ToUpper())
{
case "PLYWOOD":
objsn.ExeBatchString("SET,PARTPATH,G:\\SNDATA70\\PARTS\\WOOD\\");
objsn.ExeBatchString("SET,MACHINE,LUND");
break;
case "ALUMINUM":
objsn.ExeBatchString("SET,PARTPATH,G:\\SNDATA70\\PARTS\\ALUMINUM\\");
objsn.ExeBatchString("SET,MACHINE,LUNDAlum");
break;
case "EMBOSSED":
objsn.ExeBatchString("SET,PARTPATH,G:\\SNDATA70\\PARTS\\ALUMINUM\\");
objsn.ExeBatchString("SET,MACHINE,LUNDAlum");
break;
case "PLUSH_CARPET":
objsn.ExeBatchString("SET,PARTPATH,G:\\SNDATA70\\PARTS\\CARPET\\");
objsn.ExeBatchString("SET,MACHINE,Lectra");
break;
case "VINYL_CARPET":
objsn.ExeBatchString("SET,PARTPATH,G:\\SNDATA70\\PARTS\\CARPET\\");
objsn.ExeBatchString("SET,MACHINE,Lectra");
break;
}
objsn.ExeBatchString("SET,DISPLAYLOGDATA,OFF");
objsn.ExeBatchString("SET,PARTREPLACE,ALL");
objsn.ExeBatchString("SET,REPLACEPATTERN,ON");
objsn.ExeBatchString("SET,MIRROR," + mirror);
objsn.ExeBatchString("SET,GRAIN,OFF");
objsn.ExeBatchString("SET,ANGLE," + angle + "," + deg);
objsn.ExeBatchString("SET,INTSAMEASEXT,OFF");
objsn.ExeBatchString("SET,LOOKUP,MATERIAL,OFF");
objsn.ExeBatchString("SET,LOOKUP,PROCESS,OFF");
objsn.ExeBatchString("SET,LEADIN,None");
objsn.ExeBatchString("SET,INTERNAL,LEADIN,NONE");
objsn.ExeBatchString("SAVE,PART,ON");