Author Topic: Using AutoCAD's classes or recreating classes when needed?  (Read 1530 times)

0 Members and 1 Guest are viewing this topic.

ds22L

  • Mosquito
  • Posts: 5
Using AutoCAD's classes or recreating classes when needed?
« on: December 30, 2022, 08:36:20 PM »
Should I be using AutoCAD classes more? The more I have dug into AutoCAD's .NET API and honestly even the underlying C++, I find myself massively confused by the layers of abstraction and end up spending more time trying to fight data into the correct type to start working with the data. This almost always results in me iterating items of interest and making their generic counter part, like a list of lists[2] for 3d or 1 for 2d...It's frustrating. Does this go away with more practice and learning (the past year and a half)? Follow up, is it worth it? Does anyone benefit from learning the intricacies of AutoCAD .NET or it's underlying C++ when you can just abstract completely out of AutoCAD and use tried and true Math libraries and recreate classes in AutoCAD as needed? Seems to me that without the pressure of a direct need to use AutoCAD classes, you should avoid it... The only thing that I really like is XRecords, and that can be annoying to work with as well for the same reasons above...

Side note, even ChatGPT struggles with AutoCAD class translations and it's weird document db and transaction setup. And that is saying something...

I could also be daft and not dedicated enough, idk  :uglystupid2:

Thoughts? Criticisms?

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8662
  • AKA Daniel
Re: Using AutoCAD's classes or recreating classes when needed?
« Reply #1 on: December 30, 2022, 11:46:05 PM »
first post? welcome to the swamp  :-)

Depends on the complexity of what you want to write and your skill level. What data? What math? How would you abstract completely out of AutoCAD?
personally, I use what’s in the API because its unit tested. Sometimes you have to roll your own if it’s not in the API, but I still use the API classes when possible.


kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2124
  • class keyThumper<T>:ILazy<T>
Re: Using AutoCAD's classes or recreating classes when needed?
« Reply #2 on: December 31, 2022, 04:12:07 AM »
Hi David, welcome to the Swamp

I think that by the time we learnt enough of the API to be able to abstract everything that we needed , we probably wouldn't need to spend the effort abstracting it.

It may be worth searching the AutoDesk University courses for
Scott McFarlane's AU2015 AU class  SD12077: Being a Remarkable C# .NET AutoCAD Developer
 /// https://www.autodesk.com/autodesk-university/class/Being-Remarkable-C-NET-AutoCAD-Developer-2015#handout

and for https://github.com/gileCAD/Gile.AutoCAD.Extension
by Gilles Chanteau

It's well worth locking yourself away for couple days to explore their work.

Regards,
« Last Edit: December 31, 2022, 04:54:48 AM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.