Author Topic: Autocad entity extension methods  (Read 2468 times)

0 Members and 1 Guest are viewing this topic.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Autocad entity extension methods
« on: October 22, 2009, 03:05:06 PM »
Sinc got me looking into extension methods, and now i think they are one of the nicest things about .net.
I do think one must keep them organized, as you could go crazy with scattering them around.
I am keeping one project for each set of extension methods - one for extending C# base types, one for Autocad types, one for my own prog's types to work with acad, one for bricscad...and so on.

It would sure be nice to have a library going for the acad types.  Just today I was thinking a BlockReference.Highlight method would be nice, given that you have to set up the FullSubentityPath object to highlight all the entities.

I know Tony T did some for result buffers, and others must have sets of them too.  While it would mean sharing code, it would also mean less questions to answer, and more concise example code if we all used the methods.  I'd be happy to contribute my twenty or so functions.
Its so nice being able to use intellisense to see what the library has for a given object type.
Is there a simpler way than sourceforge for maintaining a code set like this?
James Maeding

Glenn R

  • Guest
Re: Autocad entity extension methods
« Reply #1 on: October 22, 2009, 03:43:14 PM »
Great idea! You've got my vote. I've been doing a bit of navel gazing on this very topic recently and decided I need to start writing some of my own. However, if there was a community one, like a community codec pack, it would be great.

I know Mark has offered to setup some subversion repositories and I think this would be better as it keeps it 'in-house' so to speak.

Off the top of my head, if the above was possible, I suggest the following:

1. List of people who can actively commit - must have or it turns into a dogs breakfast really fast.
2. Possibly a dedicated forum to 'the Swamp Extension Methods' where anybody can post.
3. A Commit-only sub-forum for those who can commit to thrash out ideas.
4. Code standards. After my recent foray into StyleCop, it's as good as any and enforces some consistency.

I'm sure I'll think of more, but I would be in - would be very handy to have tried and tested methods to use to make code more readable and consistent, whilst also applying some very handy helpers.

Also, it's some cred for da swamp.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Autocad entity extension methods
« Reply #2 on: October 22, 2009, 04:05:30 PM »
good point, it would be a style guide as well.
I wonder if codeproject would be a good medium for this, only the author can update I think though.
I guess what we want is contributors can get source code, visitors just get dll, something like that.
James Maeding

Glenn R

  • Guest
Re: Autocad entity extension methods
« Reply #3 on: October 22, 2009, 04:08:02 PM »
That's not a bad idea as well.

Anybody else want to chime in?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Autocad entity extension methods
« Reply #4 on: October 22, 2009, 04:09:44 PM »
It could be interesting, but I don't feel strong enough with C# .Net to participate much.  I haven't even coded in C# in awhile.  :oops: :cry:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Glenn R

  • Guest
Re: Autocad entity extension methods
« Reply #5 on: October 22, 2009, 04:15:06 PM »
I guess what we want is contributors can get source code, visitors just get dll, something like that.

To clarify, unless somebody suggests a better way, this is what I was agreeing with.

Also, I think the code should be free to use as you see fit, as long as the usual credits remain in place blah blah.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Autocad entity extension methods
« Reply #6 on: October 22, 2009, 04:29:18 PM »
well, maybe we just make code available to everyone.
I like the idea of motivating participation, but many people will have to do a lot of catchup just to get to the point of seeing any gaps and filling them.  Its hard enough to get open source projects rolling, and only really major ones limit source code, so I'd be ok with posting code right off the bat.  I've been the one learning from others mostly in the past, so don't have much ground to stand on for anything being private.

As I was thinking this through, it occurred to me that we need to establish a few patterns of use.
I have functions that add an entity to current "space".  You feed in the entity, it does the transaction to add it.
So we could make that an extension to the database object, like db.AddEntity(ent, layer, color...) or we could make it an extension to a transaction, so we could avoid one transaction per entity.
I am still settling on those patterns myself, and have tended to make an overload of each function that accepts a db and transaction so I could do it either way.
So it would be good to decide what objects a given operation should go with.
Seeing how that turns out would really be useful.
James Maeding

Glenn R

  • Guest
Re: Autocad entity extension methods
« Reply #7 on: October 22, 2009, 04:39:12 PM »
The code could be available to anyone, but only certain users have commit rights. With subversion I believe people can submit 'merge' files, which then have to be vetted before being added to the code base...I will have to research that to be certain though...