[Quick question] Screenshot from command

5 views
Skip to first unread message

Maxime Fromentin

unread,
Jan 20, 2025, 3:03:45 PMJan 20
to pyNastran Discuss
Hello, is it possible to take a screenshot of the results (displacements for example) and not just the geometry with the command : >>> pyNastranGUI solid_bending.bdf solid_bending.op2 --postscript take_picture.py

steve

unread,
Jan 20, 2025, 4:05:45 PMJan 20
to pyNastran Discuss
  The easiest way to do it is to flip to the specific result that you're interested in before taking a picture. The log tells you what case you selected:
>>> self.cycle_results(case=20)


You can also access the results directly to loop over the ones you want. It's not the cleanest:


for icase, (obj, res_name) in self.result_cases.items():

    node_centroid = obj.get_location(*res_name)

    class_name = obj.__class__.__name__

    if class_name == 'DisplacementResults2': # ForceResults2

        print(' disp')

        print(obj)

        self.cycle_results(icase)

        break

    continue


The sidebar stuff is a bit fancier and doesn't have a clean API. It's very focused on using the GUI. In that case, you'd call the set_sidebar_args method and then cycle the results. That's going to be slightly different per result.

image.png


Reply all
Reply to author
Forward
0 new messages