Code Red > .NET

Best Approaches

(1/6) > >>

DBARANAS:
About 2 years ago when i was trying to develop an App in vba/vb6 I ran into a big memory leak problem. memory would leak and then when I could not get more memory it would go BANG

I kind of solved that problem by using UDT types and writing UDT types into binary files instead of using xData. This quieted that problem down and then the app got bigger and did more stuff. Using xdata was a safe place to be until it leaked and crashed acad.  Now the app is bigger and the memory leak problem reared it's swamp monster head again.

I am thinking about doing the xRecord thing again but want to know if real world programers do it this way.

Anyway this thread is about best practices. I you are writing a commercial app do you still use the autodesk db model or do you put data in a safer place.

MP:
I don't meet the RWP criteria but I'll pipe in anyway. Generally speaking, for modest amounts of data I'll use internal data structures (xdata / xrecords / dictionaries / xdictionaries) but beyond that I'll go external and use database(s), normally via ADO.

Also, if the data is highly relational trying to replicate a database structure using the afore mentioned internal structures is do-able but you tend to write more code to manage "the system" rather than direct data storage / retrieval.

Shooting in the dark: Can you keep a window of data rather than all of it? e.g. A program that logs select user activities (primarilly for post mortem investigations) may only need to keep a window of say 1000 entries, discarding anything beyond that.

Any way we can get you to provide a little more info about the kind and magnitude of data you're storing?

PS: I don't use CAO if that's what you mean by "the Autodesk db model".

/ramble on

Jim Yadon:
I am not a professional programmer. I do have mixed feelings on this issue though. What I consider to be average amounts of data for a user session consists of anywhere from 5000 to 40,000 individual pieces of data, usually Integers, Decimals or Strings, that I read into MDA of UDT. Similar to what you do I'd suspect from what I read in your post. My largest endeavor contained just under 3,000,000.  I've experimented with various forms of storage (I'm currently toying with the limits of using SQL databases in my spare time) and am still not set on any one method of storage other than I will not store it within the drawing itself. I have taken more beatings over the shear size of drawing files when I do this than any other complaint. I am partial to attaching XData to entities to use as keys for accessing my data from other locations. I also see the drawing files corrupt more often when I am storing my data within them. I think it's a wonderful ideal to want to have one stop shopping for our data. I just don't think it realistic with the dynamic and varied possibilities of software combinations that are present across multiple machines within even the same network. Not to mention the collander like memory management that ACAD already possesses without any help from folks like us.

DBARANAS:
My app is kind of like ADT/Mitek/VisionRes. I parametrically model 3D framing and pull it apart for prefabrication and load pieces onto trucks. Then build back the model as assemblies get craned off so a site guy can look at his pocket PC and see where that assembly goes. I isolate assemblies for all the work stations in my factory....i.e cut station, sub assembly station. assembly station, swing crane, etc.

I have about ~20 structures and they average about 1,000 elements each for each object.
There usually is about 100 to 200 of every object type in a model. Each assembly has about 20 to 100 solid elements. Everything is positioned in modelspace.

I store all the handles as I need to bring objects back and move them around (make bundles for trucks,machinery,etc)

In com/interop life was simple but memory climbed most noticably at every xdata write. I went to UDT's and the leaks were 95% stopped. Using VB put and get methods were lean, quick and mean...not pretty but they did the job great.

Then add more features and it was back again.

.Net to the rescue!!! If I could rewrite the app I could break free and take control.

If I made an EXE things worked but it was WAY TOO slow. I decided to go in process .DLL evrything would be nice and fast like VBA....but you cannot stream structures to a binary file and get them back from inside the DLL. The read part blows up. OK then I can do it in XML....but now I have bloated XML files. The average read and write making a wall assembly reads and writes about ~20 times. The disk read and write times are now an issue.

...........That is why I was asking the "Best Approach" question. I am a coder/carpenter/labourer, and eveything else in between. I wish I could ask the guy in the cubicle next door and get a simple answer.

Going to Autocad development in .Net is off the beaten path. I am damn grateful a forum like this even exists!

.....enough ranting...I am now thinking about using some low down dirty database appproach. All I wish for Christmas is to be about to store data structures in binary(or something close) and get them back fast. This stuff should just be a couple functions where I can pass the arguments too.

Jay...

I took my beatings too...when I started to do things this way then Autocad could crash and I could fire it up again and not lose any work. The model could rebuild itself.

I learned the hard way...after getting a condominium project 80% finished and having Autocad die was too much to handle. I was saving things every 15 minutes in MY OWN FILE that I CHOSE and I had to go back 30 saves to find a file that was usable.

That was it, I went to external data storage.

I was in VBA and thought that I was going too far in an environment not suited for what I was trying to do.

My hope was that maybe in the .Net world all was OK by using xdata

MickD:
I use 3d solids pretty much in the same way as you mention but I keep my 'data' in the drg to a minimum. We do steel detailing which is very similar to how you describe.
I'm currently using xdata to store just the bare minimum of info related to the object such as a db key or world points etc and all other database type work is done with queries or reports using access for the data grunt work. This allows us to free form model anything we like, it wouldn't be too hard to combine a bit of automation in there though for simple structures/assemblies. I don't even use acad for matlists in the drg, I make sure my main model db is up to date and run a query based on the assemblies in the detailed drg.

Is it possible that you are 'appending' to your xdata each time you access it and not deleting and replacing?? Maybe it's a COM thing??


--- Quote ---I decided to go in process .DLL evrything would be nice and fast like VBA....but you cannot stream structures to a binary file and get them back from inside the DLL.

--- End quote ---

This shouldn't be a problem at all, in fact it would be faster than vba, if you are using the arx wrappers and no interop to read data from the autocad db. If your data structures inherit the ISerializable interface you can read/write to binary pretty much as fast a C from where ever you want.

Navigation

[0] Message Index

[#] Next page

Go to full version