We are in the middle of implementing AutoCAD 2013 to replace 2010 so at the moment I am converting / modifying our own code to suit the AutoCAD 2013 API.
One of our routines collects data from drawings (drawings are not fysically opened in AutoCAD) using the system variables 'LimMin' and 'LimMax' in order to collect all objects drawing within the titleblock.
Point2d min2d = (Point2d) Application.GetSystemVariable("LimMin");
Point2d max2d = (Point2d) Application.GetSystemVariable("LimMax");
Only the objects in the titleblock area need to be processed and this gives the engineers also the opportunity to add extra information outside the titleblock. We have used this method in 2007 and 2010 releases of AutoCAD succesfully.
But with AutoCAD 2013 I have run into a snag. As said does this routine not fysically open the drawing in AutoCAD it merely adresses the 'autocad database' so to speak. It seems that 2013 selects the variables from an opened active drawing instead of the 'opened' drawing by the routine. What do I need to modify in the lines of codes stated above to get this rouine up and running?
The workaround for this moment is to skip the collection in the titleblock area al together and select all objects in the entire drawing which does not speed up things very much
thanks in advance of any assistence.
Acad system variables can be at session level or drawing level. The drawing level sys variable is stored with drawing. To me it is logical enough that Application.GetSystemVariable() get this type of variables' value from active document, not from the side database you created with Database.ReadDwgFromFile(). Just think, what if you have multiple side databases, which's LimitMax/Min the GetSystemVariable() should return?
Well, you could try HostApplicationService.WorkDatabase o your side database before calling Application.GetSystemVariable() . I have not tried this, so do not know if it works. The point is, I do not bother to try it: I can call Database.Limmax/Limmin property on the side database.
Did you try the Database.Limmin and Database.Limmax properties with your side database instance ?
Where did you get the idea that GetSystemVariable() operates on anything but the active document's database to begin with? If you just give it a little thought, the API doesn't ask for a database, so if there are more than one possible databases, which of them are you assuming it will return the value for?
GetSystemVariable() operates on the database of the active document that's open in the editor, not on any other database. You can use the properties of the same name on the Database you're working with, but you should also know that the limits of a drawing that's not open in the editor may not be valid.
First of all .. my apologies for the late response. Somehow your reactions got delivered in my spambox.
Unfortunately I have not designed the mentioned code and the person responsible for this is not working with our company anymore. I have no idea why he used / developed the current code but is was working in AutoCAD 2010.
In the upcoming weeks I will try your suggestions. Much thanks!
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.