Python Forum

Full Version: Help coding 3d software automation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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. Shifty
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)