In order to help out programmers starting to program AutoCAD Addins I’ve created a class library to make our lives a bit easier. I also hope other people here will contribute to this class library so we can create an AutoCAD frame work off building blocks. We all have to create layers, load line types create text styles and dimension styles.
At this moment I created a Layer Class, LineType Class and a general Enum Class So we can use StrongType names instead of text strings. I only added an enums for all Linetypes in acad.lin.
But I can think of some other enums like color witch returns color numbers.
The Second project in the solution is for testing and has some examples on how to use the classes.
The Solution is created in Visual Studio 2010. The AutoCAD version I used is AutoCAD 2011 and is coded in C#. My knowledge of VB.NET is limited but it would be nice if there is someone who could convert It.
For the next versions I will add classes for creating text styles and dimension styles.
If any of you have comments about my code please don’t hesitate to tell me about it or change the code.
If anyone has an idée to keep the source on a central place please tell me so we can place it there. Some kind of versioning would be nice. For now please attach your classes with your post and I will add them to the solution and post a new version of it.
I hope we as community can create something we all can use. And make developing for AutoCAD a bit Easier.
Had a little sparetime this weekend so I added a new class for inserting blocks.
I’ve created a new control AcDgDwgThumbnail derived from the standard picturebox. I added 2 new properties to this control as you can see in the following picture.
The DwgFile takes a string value witch hold a dwg including it’s path. If the file exists the dwgthumbnail wil be displayed in the AcDgDwgThumbnail control.
In the test application I added a simple function to display a dwg’s preview. See printscreen.
I've also added the new Solution V1.02.
A good issue to figure out is how to handle Transaction management.
And if I may add,
you probably or definitely need some type of management.
So the class library will mold nicely.
And some standards would need to be added.
Just say you got group of smart guys.
They build great classes but one did one for layers and his function names are AddLayer to add to database.
Another guy did text and his is CreateText but he has a function called AddText but that is to add it to some static collection or something.---You see where that is going
Here is how a current project for Lisp is being handled for some ideas.
Just go here http://www.theswamp.org/index.php?topic=37684.90 and enter "Group Project: Change item(s) to Layer"
in search. There are too man threads--- ideas, sign-up, vote....etc
I have been busy rewriting my classes and tought it was about time to share theme with you all. I've structered the code so they all work the same way. Here is the new AcDgClassLibrary - Classdiagram.
Fot the next version i will create an new class for creating new dimensionstyles ad a block jigging class and wil try to document my code as best as i can.
Jeff could you explain what mean with how to handle transactions?
For now i hope this will help people here and i will continue work on this project and hop more people will be involved.
If you have wishes please post them.
I've changed the version number to 188.8.131.52
To keep the user from having to deal with transactions and at the same time handle different databases, methods called in loops.....etc
Do you have any ideas on how to handle that??? If so please let me know. I think we can win alot if we can create something like that.
"In order to help out programmers starting to program AutoCAD Addins..."
For those of us (Me) who are starting, a readme file of some sort would help just to get this going. What to do and where to start (after download and extract of course)
FWIW [comming from a beginners perspective] Awesome work by the way.
I second your suggestion. Also, I would love to have a version written in / converted to VB.NET code.
I have just finished a beginning AutoCAD VB.NET class (4-day, live or 4 hour live online sessions includes a book, many code snippets and instruction with a custom project day. It is around $1,000 and HIGHLY RECOMMENDED! See www.vbcad.com )
Irvin, This is a great initiative, thank you. I have a question regarding best practices. I note that you pass both the document and transaction to the class. Are you able to explain the reason for this? I generally pass the database, then start the transaction within the function. This is fundamental to building a reusable library so I would like to understand the best approach. Thanks, Dale.