.NET

Reply
Distinguished Contributor
Irvin
Posts: 112
Registered: ‎04-22-2009
Message 1 of 17 (1,570 Views)

Discussion Group ClassLibrary, please read!

1570 Views, 16 Replies
04-28-2011 02:01 AM

Hi all,

 

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.

 

ClassDiagram.jpg

 

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.

 

project AcDg.jpg

 

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.

 

Kind regards,

 

Irvin

Distinguished Contributor
Irvin
Posts: 112
Registered: ‎04-22-2009
Message 2 of 17 (1,503 Views)

Re: Discussion Group ClassLibrary, please read!

04-29-2011 01:25 PM in reply to: Irvin

Hello all,

 

I've added a new class to the solution.

 

AcDgTextStyle.cs

 

Kind regards,

 

Irvin

Distinguished Contributor
Irvin
Posts: 112
Registered: ‎04-22-2009
Message 3 of 17 (1,447 Views)

Re: Discussion Group ClassLibrary, please read!

05-02-2011 05:20 AM in reply to: Irvin

Hi All,

 

Had a little sparetime this weekend so I added a new class for inserting blocks.

 

AcDgBlock - Class.jpg

 

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.

 

AcDgwThumbnailPreviewProp.jpg

 

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.

 

Thumbnail.jpg

 

I've also added the new Solution V1.02.

 

Kind regards,

 

Irvin

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 4 of 17 (1,365 Views)

Re: Discussion Group ClassLibrary, please read!

05-07-2011 10:07 PM in reply to: Irvin

Nice Irvin,

 

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

 

 

 

 

You can also find your answers @ TheSwamp
Distinguished Contributor
Irvin
Posts: 112
Registered: ‎04-22-2009
Message 5 of 17 (1,313 Views)

Re: Discussion Group ClassLibrary, please read!

05-11-2011 01:10 PM in reply to: Irvin

Hi all,

 

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.

 

AcDgLibrary -   ClassDiagram.png

 

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 1.1.0.0

 

Kind regards,

 

Irvin

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 6 of 17 (1,307 Views)

Re: Discussion Group ClassLibrary, please read!

05-11-2011 02:08 PM in reply to: Irvin

To keep the user from having to deal with transactions and at the same time handle different databases, methods called in loops.....etc

 

You can also find your answers @ TheSwamp
Distinguished Contributor
Irvin
Posts: 112
Registered: ‎04-22-2009
Message 7 of 17 (1,288 Views)

Re: Discussion Group ClassLibrary, please read!

05-11-2011 11:37 PM in reply to: Irvin

Hi Jeff,

 

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.

 

Kind regards,

 

Irvin

New Member
Oak3s
Posts: 2
Registered: ‎02-17-2010
Message 8 of 17 (1,123 Views)

Re: Discussion Group ClassLibrary, please read!

09-02-2011 02:58 PM in reply to: Irvin

"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) :smileyhappy:

 

FWIW [comming from a beginners perspective] Awesome work by the way.

Distinguished Contributor
chillme1
Posts: 159
Registered: ‎01-30-2008
Message 9 of 17 (1,064 Views)

Re: Discussion Group ClassLibrary, please read!

09-08-2011 04:10 AM in reply to: Oak3s

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 )

Thanks for your comments,

Clint Hill
Distinguished Contributor
Dale.Bartlett
Posts: 138
Registered: ‎01-06-2003
Message 10 of 17 (717 Views)

Re: Discussion Group ClassLibrary, please read!

12-02-2012 04:02 AM in reply to: Irvin

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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community