Help coding 3d software automation - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Help coding 3d software automation (/thread-17244.html) |
Help coding 3d software automation - danishaikh - Apr-03-2019 I'm trying to alter code written by the software when recording a macro to refer to a general location so that I can use the macro to run for any new individual case I am in. geo.open(0, 1, u'Y:\\01008-003\\01008-003 APPROVAL\\01008-003 SFA.dxf') geo.import_file(1, 1, u'Y:\\01008-003\\01008-003s\\01008-003_stn2_stn2_2019-04-02__09-17-23 Model 1 Low.stl')The Y drive is our network folder and the '01008-003 is a folder within that drive. The first line opens a file in the '01008-003 Approval' folder within the parent folder. The next line imports another file in another sub folder. I want to be able to perform this action on any parent folder I am working in. The software is called Geomagic. It is a 3d modeling software. Any help is appreciated. RE: Help coding 3d software automation - Gribouillis - Apr-03-2019 You can try this import os import datetime as dt drive = 'Y:' base = '01008-03' dd = dt.datetime(2019, 4, 2, 9, 17, 23) folder_a = os.path.join(drive, base, '{} APPROVAL'.format(base)) file_a = os.path.join(folder_a, '{} SFA.dfx'.format(base)) folder_s = os.path.join(drive, base, '{}s'.format(base)) file_s = os.path.join(folder_s, '{base}_stn2_stn2_{dd:%Y-%m-%d__%H-%M-%S} Model 1 Low.stl'.format(base=base, dd=dd)) print(file_a) print(file_s) |