D
D
DWS112021-02-18 12:26:14
Programming
DWS11, 2021-02-18 12:26:14

How to get shapes from dxf?

Hello!
Tell me, are there ready-made solutions for getting figures from dxf using (absolutely any PL here)?
In fact, you just need to understand what is drawn, a circle, a trapezoid, a square ... Ie. some simple closed geometric objects.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Chernyshev, 2021-02-25
@DWS11

Ready-made solutions are the API of AutoCAD and all its numerous clones (based on ODA Teigha). If you are satisfied with writing not a separate program, but a plug-in for any of this CAD, then this will be the easiest option. There is a C++ API (ObjectARX), under .Net and, for example, C# . If AutoCAD is installed in the system, there is such a thing as AcCoreConsole with which you can call the AutoCAD API from external programs. And finally, there are expensive libraries from Autodesk (RealDWG) and ODA (Teigha) for full-fledged work with DWG and DXF without installing any CAD.
In some very simple cases, it is possible to read and parse the DXF file itself - usually it is plain and understandable text (although DXF can theoretically be binary)

A
Alexander Skusnov, 2021-02-18
@AlexSku

Perhaps convert to emf, and read it as a list of commands.
Similarly, it can work through svg, but you need to look for ways to extract commands.

I
Ivan, 2021-02-22
@Iv_and_S

"shapes from dxf" is an ambiguous definition of what you have.
if conditionally, the circle is drawn with one primitive, then:
through the "your CAD" API, you can get the type of the object (meaning the type of CAD classification), without any problems.
usually something like:
id.ObjectClass.DxfName == "CIRCLE"
or
RXObject.GetClass(typeof(Line)
however, if our conditional circle consists of 100500 segments forming a circle, this method will certainly not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question