Code Red > .NET

Rewriting program - opinions?

(1/9) > >>

quamper:
Currently I've got a VB COM app that I'm toying around with rewriting from the ground up using the .net api stuff as I've hit some limitations over time. I've already rewritten a few smaller ones with good success.

I've got a chance to change a few fundamental things and I'm wondering whether I should or not before I get too far into it.

One of the big components of my program is that it creates 3-4 different overall styles of Blocks based on a whole lot of different criteria, and inserts them into the drawing. Each of these blocks has a ton of attributes (most of the hidden/non-visible attributes). A typical drawing may have 5-30 of these "intelligent blocks". Alot of the reason for this program was previous to dynamic blocks, but it still does alot more than dynamic blocks do so thats not really an issue.

I'm mostly wondering at this point:

1. Currently using blocks if I create one and insert it into the drawing, then I delete the block, it's still in the database unless I do a purge. Ideally I don't want multiple references to the same block in the drawing, nor do I want a block not referenced at all. Is there another way to do that or should I have an event that watches for deletion of these blocks and purge them programatically, and also prevents multiple instances? The geometry in the blocks isn't terribly complicated. Are blocks the most efficient way to handle this?

2. Attributes vs. Xrecords? Is there any advantage to using xrecords? Are there limitations of using xrecords that I should be aware of, as I've not used them much at all, except in learning the basics of how to use them.  Currently the attributes never get edited via Autocad dialogs and strictly by the application.

Thanks :)

Draftek:
One question I would ask is - What are the limitations you've hit and will re-coding the thing in .Net actually eliminate those?

As far as using blocks or not and the worry of references vs inserts - it all depends - if your worried about the user manipulating the geometry then your either stuck with blocks or a custom object, I guess. If not then you could use primitives and attach xdata or xrecords / dictionaries. I've used these before along with handles to create kind of a poor mans custom object. I would avoid monitoring events at all cost...

LE:
I'm too would like to know what are those limitations (perhaps you refer about future compability or accessibility to the API's that might required in example C#?)


About those inserts - can they be anonymous - so in case they are deleted, they will be purge by acad once the drawing is closed ?

I am working in my first COM project but it is in C++ and ObjectARX - and the reason they want to have this, it is because it will be used in a VB or VBA application's [and for now it is easier to them to go this way, instead of porting or re-coding all what they have in VB to C++/ARX/or C#]. I use dictionaries to save some of the data too.

quamper:
"What are the limitations you've hit and will re-coding the thing in .Net actually eliminate those?"

The short answer is, yes. Some of it is because of performance, some of it is because Autocad seems to be heading away from supporting VB/COM stuff and more support for the .net api. I have run into a few specific instances where I just couldn't accomplish what I wanted to do. It's been a little while I'm sure I have some notes somewhere of what it was. And I've got the time to do it so I'm not really worried about that aspect.

"I've used these before along with handles to create kind of a poor mans custom object."

I guess thats in essence what I'm currently doing...and I guess creating my own custom object isn't really any option unless I dive into ObjectARX which isn't really an option. So since creating blocks and tying info to them is fairly easy and accomplishes what I'm needing. Is there any benefit then to tons of attributes vs xdata/dictionaries for all the extra data I'm associating with the block
 

 

quamper:
"About those inserts - can they be anonymous - so in case they are deleted, they will be purge by acad once the drawing is closed ?"

Right now they are all named, but theres no reason they couldn't be anonymous I suppose. So thats an acceptable solution.

Navigation

[0] Message Index

[#] Next page

Go to full version