ritchie46 / anaStruct

2D structural analysis in Python
GNU General Public License v3.0
356 stars 101 forks source link

Importing structure geometry from dxf #22

Closed lukaszlaba closed 4 years ago

lukaszlaba commented 5 years ago

I have made first test with importing geometry from dxf. EZDXF package was used to grab data from dxf file. I have used this package a lot before. Here is DxfLoader class draft https://github.com/lukaszlaba/anaStruct/blob/dxfloader/anastruct/fem/dxfloader/dxfloader.py It is also possible to make that section be loaded from dxf to. Is it possible to change section or other section proprieties of element after the element was crated? Some proprieties must be still defined with script code - like hinges for example, so some existing elements must be modified. I think only structure geometry and sections is what we want to import from dxf to be happy.

lukaszlaba commented 5 years ago

Here is dxf loader demo https://youtu.be/ydhOSAow6j0 All needed data can be loaded from dxf - just add_element(..), add_support_fixed() etc. command need to be placed (with no 'location' and 'node_id' argument) in dxf near line or point. Almost done, need to be tested.

ritchie46 commented 5 years ago

Looks cool. Do you make the dxf with something you build?

lukaszlaba commented 5 years ago

No. AutoCad has been used for this demo. It can be any dxf editor - like Autocad, Draftsight or even LibreCad. I think the interface for this feature should be new ss method, like ss.load_data_from_dxf_file (dxf_file_path).

lukaszlaba commented 5 years ago

It looks dxfloader works fine now. Here is the fork branch https://github.com/lukaszlaba/anaStruct/tree/dxfloader And added use example https://github.com/lukaszlaba/anaStruct/blob/dxfloader/anastruct/fem/examples/ex_25_geting_data_from_dxf.py look like this

import os

from anastruct.fem.system import SystemElements

THIS_SCRIPT_DIR_PATH = (os.path.dirname(os.path.abspath(__file__)))
DXF_FILE_NAME = 'ex_25_model.dxf'
DXF_FILE_PATH = os.path.join(THIS_SCRIPT_DIR_PATH, DXF_FILE_NAME)

ss = SystemElements()

ss.load_dxf_data_to_system(DXF_FILE_PATH)

ss.show_structure()

Ritchie please try to think about merging sectionbase and dxfloader features in to your main version of anastruct and what still need to be done before. I hope you are interested in development of your project and still have some time for it. For now I will merge all new features in one branch in my fork.

lukaszlaba commented 5 years ago

All new features merged to master branch of my fork. New features listed in readme file. https://github.com/lukaszlaba/anaStruct Comparing changes https://github.com/ritchie46/anaStruct/compare/master...lukaszlaba:master

ritchie46 commented 5 years ago

Could you make pull requests per feature?

lukaszlaba commented 5 years ago

Yes, it is right way. I need some time to prepare my fork for that.

lukaszlaba commented 5 years ago

Great job! After sectionbase feature was merged, it take me next few days to make dxf import feature ready for merging.

ritchie46 commented 4 years ago

It is a cool extensions. But in my opinion it deviates a bit too much from the core of anaStruct, so I am going to close this.