.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1774 Views, 3 Replies

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

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

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.

3 REPLIES 3
Message 2 of 4
Alexander.Rivilis
in reply to: Anonymous

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 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

Message 3 of 4
Anonymous
in reply to: Alexander.Rivilis

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

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.

Message 4 of 4
Alexander.Rivilis
in reply to: Anonymous

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

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report