.NET

.NET

Reply
Member
jonathan.talisman
Posts: 4
Registered: ‎02-22-2012
Message 1 of 5 (464 Views)

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

464 Views, 4 Replies
03-21-2012 07:48 AM

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 

 

 


*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 2 of 5 (433 Views)

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

03-22-2012 03:40 PM in reply to: jonathan.talisman

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
*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 3 of 5 (428 Views)

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

03-22-2012 04:34 PM in reply to: jonathan.talisman

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

Dave O.                                                                  Sig-Logos32.png
Member
jonathan.talisman
Posts: 4
Registered: ‎02-22-2012
Message 4 of 5 (417 Views)

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

03-22-2012 11:32 PM in reply to: chiefbraincloud

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, 

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 5 of 5 (405 Views)

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

03-23-2012 11:14 AM in reply to: jonathan.talisman

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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.