Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

C# COM API: Intersection / Interference of Solid and Surface

Anonymous

C# COM API: Intersection / Interference of Solid and Surface

Anonymous
Not applicable

Hi,

I want to control AutoCAD via the COM API in C# (an out-process app) and get possible intersections / interference objects of an AutoCAD.AcadSurface and AutoCAD.Acad3DSolid.

I tried several methods but none works:

  • Acad3DSolid.CheckInterference(AcadSurface, false, out bool interference) => won't compile because this method only wants to take another 3dSolid
  • Acad3DSolid.Boolean() => same as above
  • AcadSurface.IntersectWith(Acad3DSolid, AutoCAD.AcExtendOption.acExtendNone) => exception from HRESULT: 0x80200001
  • Acad3DSolid.IntersectWith(AcadSurface, AutoCAD.AcExtendOption.acExtendNone) => throws an exception: "Not yet implemented"

In .NET API (in-process) there is a method Surface.createInterferenceObjects() (see here: https://forums.autodesk.com/t5/net/solid3d-checkinterference-overload-with-other-entities-e-g/m-p/82...)

 

In C++ ObjectARX there is also a method AcDbSurface::createIntereferenceObjects() (see here: https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2017/ENU/OARXMAC-RefGuide/file...)

 

Is there a way to do this in COM API in C#? I would be very happy if someone could help me. Many thanks in advance.

 

I use AutoCAD Mechanical 2019 and Windows 10.

0 Likes
Reply
Accepted solutions (1)
1,897 Views
3 Replies
Replies (3)

Alexander.Rivilis
Mentor
Mentor
Accepted solution

@Anonymous wrote:

Is there a way to do this in COM API in C#? I would be very happy if someone could help me. Many thanks in advance.


Sorry for bad news but in COM API there is no methods for that. But you can create arx-plugin, load it into AutoCAD and communicate with it.

AcDbSurface::createInterferenceObjects and AcDbSurface::booleanIntersect methods can help you.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes

Anonymous
Not applicable

Thank you very much for your quick answer.

I will try to use another solid instead of a surface then.

I chose to use the COM API instead of the .NET API (for an in-process app) because it gives me full control over AutoCAD. What I need to do is insert a solid and get the return value from the interference method and I prefer to let my out-process app control the inputs and outputs instead of handing it over to AutoCAD, executing a custom command and then reading some user variable. (I tried this and find it a bit unsatisfying.)

And I don't know any C++ yet.

0 Likes

Alexander.Rivilis
Mentor
Mentor

1. AutoCAD COM/ActiveX API has not been developed for more than 10 years.

2. Out-process is much slower than In-process

I think in your case you can use AcCoreConsole. You can start it from your external application and load .NET-plugin into it to use all functionality of AutoCAD .NET API instead of COM API. This is the fastest and most effective method. IMHO.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes