.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with multiple drawings | C# Open TransActions & Databases..

4 REPLIES 4
Reply
Message 1 of 5
jonathan.talisman
1206 Views, 4 Replies

Help with multiple drawings | C# Open TransActions & Databases..

Hi ,

Here is something I am trying to accomplish - would appreciate some pointers // ->better rephrase 'guidelines'

 

Write a C# DLL that exposes a function to AutoLisp , get 2 args from the ResultBuffer -

dwgName [full path] 

AutoCAD script to run on this drawing.

and return a true/false if successful. 

 

This brings up another  related  question -   When would I need to 'open' a drawing versus opening the database > manipulating the db and closing ? // does this falls under 'transactions ' ? 

 

Pointing me to existing examples would be very appreciated

 

Jonathan 

 

 


4 REPLIES 4
Message 2 of 5

So, you just declare your function with the LispFunction attribute, accepting args as ResultBuffer and returning boolean.

 

This article on through the interface has a simple example of a LispFunction, and a couple of links to ADN articles if you are a member.

http://through-the-interface.typepad.com/through_the_interface/2006/07/breathe_fresh_l.html

 

I don't have a handy link to it, but I'm sure the AutoCAD .NET developers guide has some info on LispFunctions.

 

As far as your other question, if you are going to run a script on the drawings, then you will have to open them fully into the editor.  If you want to do some direct manipulation of the Database without opening it into the editor, you can do that, but the methods exposed by the EditorInput Namespace are not available.  (There may be more than that not available, but that is the big one)

Dave O.                                                                  Sig-Logos32.png
Message 3 of 5

As one more note, hopefully you are aware that lisp code does not survive across the document boundary?

Dave O.                                                                  Sig-Logos32.png
Message 4 of 5

Hi CheifBrainCload,

Thanks for the pointers , I have actually seen this post on TTIF , even though it VB.NET I can understand how does that work.

With regards to Lisp - you can access the drawing manager, open another drawing manipulate it, and with AutoCAD I hear you can actually save and close it, with AutoCAD Architecture (which I am using ) - do that and you are guaranteed a crash. There are several references to this in discussion groups (here and AUGI and some other). So VLA-CLOSE on ACA or MEP == UnHandled Exception ...

Back to .NET -> You are suggesting that the question whether to open the drawing in autocrat vs. opening and manipulating the Database is a question of what is exposed to Autodesk.AutoCAD.EditorInput VS. Autodesk.AutoCAD.DatabaseServices; ? 

The .NET developers guide [http://goo.gl/fTtS8] contains samples how to open / close /save drawings , but these are save the current drawing kind of samples ... I guess I should be able to solve this with what I got.

Thanks, 

Message 5 of 5


@jonathan.talisman wrote:

Back to .NET -> You are suggesting that the question whether to open the drawing in autocrat vs. opening and manipulating the Database is a question of what is exposed to Autodesk.AutoCAD.EditorInput VS. Autodesk.AutoCAD.DatabaseServices; ? 


Yes, basically that is what meant in my previous comment, and as I suggested, "There may be more" that is not available.  I was poking around the Object browser, and I am fairly certain there are more things to add to the list of available and unavailable.  Maybe someone from Autodesk could chime in on this one, but it appears to me that it is likely Nothing from the AcMgd.dll is available, while everything, or most everything from AcDbMgd.dll should be available.  That means ApplicationServices is out, (no document object), GraphicsSystem is out, but Geometry is available.

EditorInput seems to be the one that comes up most often, because the Selection methods are there and people seem to want to use them to create selection sets while working on side databases.

Dave O.                                                                  Sig-Logos32.png

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost