Author Topic: errorr message  (Read 1810 times)

0 Members and 1 Guest are viewing this topic.

pBe

  • Bull Frog
  • Posts: 402
errorr message
« on: December 08, 2016, 04:05:23 PM »

I have a code up and running on our office , so far so good, but when i use the same .net code at home it gives an error message:

Missed Type = AcSmSheetSelSet

and worst, other .net programs doesnt even work at all.

************** Exception Text **************
System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
   at ACSMCOMPONENTS21Lib.IAcSmSheetSetMgr.OpenDatabase(String filename, Boolean bFailIfAlreadyOpen)

I could've have sworn it was working before. Tried looking for that particular file on my pc, but all i found was Interop.ACSMCOMPONENTS21Lib.dll and its not even on any Autocad folder.

Any ideas?

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: errorr message
« Reply #1 on: December 08, 2016, 04:59:59 PM »
Hi pBe,

I'm not sure it's the dll that's the problem, check the path for the drawing file you're trying to open and make sure it exists.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

n.yuan

  • Bull Frog
  • Posts: 348
Re: errorr message
« Reply #2 on: December 08, 2016, 05:39:35 PM »
Interop.ACSMCOMPONENTS21.dll is not included in AutoCAD install folder.

Not like COM AutoCAD type library/objectDBX common  type library, interop assemblies of which are provided by AutoCAD installation, other COM components installed with AutoCAD do not come with interop assemblies.

Interop.ACSMCOMPONENTS21.dll is generated by Visual Studio when you add referenece to COM AcSmComponents2x 1.0 type library. You can also use .NET utility tlbimp.exe to generate the interop assembly.

In the VS project, make sure to set "Embed Interop Types" to "false" and set "Copy Local" to true. So, when run your CAD add-in, the interop dll should be in the same folder as your add-in DLL.

Also, AcSmComponent2x.dll has dependncy to AutoCAD ObjectDBX Common library. When adding reference to it, VS also generate an interop assembly of ObjectDBX common library. You probably can get rid of it and use the one that comes with AutoCAD (or ObjectARX SDK) Autodesk.AutoCAD.Interop.Common.dll.

« Last Edit: December 08, 2016, 05:54:31 PM by n.yuan »

pBe

  • Bull Frog
  • Posts: 402
Re: errorr message
« Reply #3 on: December 12, 2016, 01:30:25 PM »
Thank you MickD, I will look into that.

Apparently its a message within the .net code i copied from http://through-the-interface.typepad.com/ and not an internal code exception error

@n.yuan

Thank you for the info Interop.ACSMCOMPONENTS21.dl

So far i still haven't found what's causing that error, I'm in the process of re-writing the code in pure .net c# code. What i have now is a mix of lisp and .net. Not a very efficient way of doing it i know :)

Keep you guys posted.

While i'm at it, might as well ask a question

How do i pass an "argument" to a WPF dialog?

Code - C#: [Select]
  1.    
  2. ...        
  3. // Get SheetSet
  4.             AcSmSheetSetMgr ssmgr = new AcSmSheetSetMgr();
  5.             IAcSmDatabase db = ssmgr.OpenDatabase(ssFilePath, false);
  6.             IAcSmSheetSet ss = db.GetSheetSet();
  7.  
  8.             List<string> propNames = GetSheetSetCustomProperties(ss);
  9.             string Tolisp = db.GetSheetSet().GetObjectId().GetHandle();
  10.  
  11.             propNames.Add("ObjectID | " + Tolisp);
  12.             var myArray = propNames.ToArray();
  13.  
  14.             // WPF
  15.             System.Windows.Window win = new WPF_Dialog1(); // <--- Here
  16.             Autodesk.AutoCAD.ApplicationServices.Application.ShowModalWindow(win);
  17.  
  18.  

Is it  the same method as a sub-function in lisp?
myArray as a string array. ?

WPF_Dialog1(myArray)
or is propNames already an Array?

EDIT: BTW i'm using  GetSheetSetCustomProperties(ss) from throughtheinterface by Kean Walmsley ( I think, I'm not sure now, gone through a lot of sites for SSM )

Code - C#: [Select]
  1.         private static List<string> GetSheetSetCustomProperties(IAcSmSheetSet sheetSet)
  2.         {
  3.             List<string> propNames = new List<string>();
  4.             IAcSmEnumProperty propEnum = sheetSet.GetCustomPropertyBag().GetPropertyEnumerator();
  5.  
  6.             // Allocating space for variable name
  7.             string propName;
  8.             AcSmCustomPropertyValue propVal;
  9.  
  10.             do
  11.             {
  12.                 propEnum.Next(out propName, out propVal);
  13.                 if (!String.IsNullOrEmpty(propName)) propNames.Add(propName + " | " + propVal.GetValue());
  14.             } while (!String.IsNullOrEmpty(propName));
  15.             return propNames;
  16.         }

I originally use the above snippet to collect the data then write to a text file from the result.
« Last Edit: December 13, 2016, 02:29:01 AM by pBe »

pBe

  • Bull Frog
  • Posts: 402
Re: errorr message
« Reply #4 on: December 12, 2016, 02:23:42 PM »
Hang on. should i just run it inside the  WPF_Dialog1 right after this line InitializeComponent(); ?