DomCR / ACadSharp

C# library to read/write cad files like dxf/dwg.
MIT License
429 stars 119 forks source link

Aec architecture objects (wall, doors, windows) #221

Open cpetry opened 11 months ago

cpetry commented 11 months ago

Is your feature request related to a problem? Please describe. When reading a DWG file, aec objects seem not to be included.

Describe the solution you'd like I would like to have either AEC objects directly as entities or some way to access and read attributes (width, height, length, justification etc.).

Additional context Aec objects are AutoCAD Architecture specific, I guess

DomCR commented 11 months ago

Hi @cpetry,

could you provide a file with this kind of specific objects in it that I can use as an example for the implementation? I don't find them in the dxf specification or the Open design document so I'll need to check how they are saved in the document if that's the case.

cpetry commented 11 months ago

Okay here a very simple example: AecObjects.zip

These are the properties of a door: image

DomCR commented 11 months ago

I've been looking into this and there are a few problems that makes the implementation quite difficult. This type of objects are not compatible with dxf which means that I do not have a way to "see" them outside Autocad, also the there is no documentation about the different properties or variables that they have or how are they stored, not even in the OpenDesign document that has the DWG specification in it.

The objects are found in the reader and identified with a DxfClass but to be able to store the geometric data it will require to check the bytes manually which it will require a huge amount of manual work to decode byte by byte.

By now this feature will not be implemented, I'll leave the issue open just in case that I can find some documentation on it.

cpetry commented 11 months ago

I would actually like to try reading it out byte by byte. Can you please give me a headstart on how/where to begin? A branch with some basic setup? I tried already but couldn't wrap my head around your architecture completely.

DomCR commented 11 months ago

Here you go https://github.com/DomCR/ACadSharp/pull/227

I've created a simple setup so you can see how the ObjectReader works.

First the reader needs to identify the ObjectType that is reading, in this case is done by a DxfClass that contains the object name, in the example I added the AEC_WALL, after that, you have to finish the implementation of the method readAecWall() which needs to check manually the bytes in the stream. For that you can use the Explore method, which it will return a dictionary with all the possible values that you can read and then you can manually check them with the values that you have in Autocad.

The problem with all this is that you won't be able to tell if the reader has the whole information of the entity, some value are stored in flags or have conditions in which are only read if a property have a specific value, but you may be able to get the information that you want.

Let me know if I can help in anything.

Good luck!

cpetry commented 11 months ago

Great! I see how for I can get and if I need to add bytes later on. Thanks for the headstart!

rurban commented 10 months ago

I've extracted the unknown bits for all the 287 new AEC classes, and 891 AEC objects, and 4 AEC entities, and will run it through my automatic prolog program to find some fields or patterns. As described here https://savannah.gnu.org/news/?id=9167

cpetry commented 10 months ago

Oh God you are a lifesaver! I tried at first and got stuck after a few bytes. Good to know you had more luck

rurban commented 9 months ago

@cpetry: Can you also please upload the DXF conversion from this AecObjects.dwg? Conversion without the AEC arx only converts to proxy entities, without any hint to the entity or object fields.

DomCR commented 9 months ago

are the AecObjects compatible with DXF?

Note: When you export a drawing to a DXF file, all AEC objects are exploded to AutoCAD primitive objects. Reopening the file in the software does not restore these primitive objects to AEC objects.

https://help.autodesk.com/view/ARCHDESK/2024/ENU/?guid=GUID-E640D193-F6D9-497E-BEC2-D846D720B50B

rurban commented 9 months ago

Oh my. Exploded blocks are ok. I see where they were coming from. They are just so afraid that we can decode them, but they are just parametric dynamic blocks

cpetry commented 9 months ago

Sorry for the long wait. Here it is: AecObjects_dxf.zip

rurban commented 9 months ago

Oh my, they introduced new objects, called BINRECORD AcAecBinRecord for this, in place of proxies. Doesn't help much, sorry