Closed dmarc3 closed 3 months ago
When calling read_bdf there’s a save_file_structure=False flag. Set that to True and there is an integer ifile flag on every card.
You can then use the model.write_bdfs(…) method and write out all/a subset of files you’ve changed. The out_filenames/renamed to include_file_map in the latest (I think) is a dictionary of old_name to new_name that uses the ifile and model.include_files (maybe filenames) to map the includes.
The docs are quite a bit better in the latest dev version.
On Tue, Jun 4, 2024 at 11:07 PM Marcus Bakke @.***> wrote:
Hi there! First off, thanks for the great work here! pyNastran is very useful.
I have a use case where it would be helpful to be able to determine the name of the file in which the card has come from. i.e. something like this:
from pyNastran.bdf.bdf import BDF model = BDF()model.read_bdf('PATH_TO_MODEL') for nid, node in sorted(model.nodes.items()): print(node.source) # source = run deck name or include file path in which this GRID card is found in
I'd mainly like to be able to determine the source for elements in my use case but I think it probably makes sense to include this as an attribute on all cards. Thoughts?
— Reply to this email directly, view it on GitHub https://github.com/SteveDoyle2/pyNastran/issues/789, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAICUWLSPM6UIEZH2W5MN4LZF2TKZAVCNFSM6AAAAABIZ73LPSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZTIOJYGQYDSNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@SteveDoyle2 I was looking through the code a bit last night and I figured it might have been implemented somewhere after I saw a lot of the ilines
callouts. I believe this should get me what I need.
from pyNastran.bdf.bdf import BDF
model = BDF()
model.read_bdf('PATH_TO_MODEL')
for nid, node in sorted(model.nodes.items()):
print(f"Source file is: ${model.active_filenames[node.ifile]}")
Closing as already implemented!
Hi there! First off, thanks for the great work here!
pyNastran
is very useful.I have a use case where it would be helpful to be able to determine the name of the file in which the
card
has come from. i.e. something like this:I'd mainly like to be able to determine the source for elements in my use case but I think it probably makes sense to include this as an attribute on all cards. Thoughts?