mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
Run black on utils
This commit is contained in:
+18
-14
@@ -9,23 +9,26 @@ from ifc4d.pp2ifc import PP2Ifc
|
||||
import ifcopenshell
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser .add_argument('-f','--file', action='store', type=str,
|
||||
required=True, help="schedule file name to be parsed")
|
||||
parser .add_argument('-s','--schedule', action='store', required=True,
|
||||
type=str, help='file format as xer, p6xml, mspxml, pp')
|
||||
parser .add_argument('-i', '--ifcfile', action='store', required=False,
|
||||
type=str, help='ifc file name as string e.g. \"file.ifc\"')
|
||||
parser .add_argument('-o', '--output', action='store', required=True,
|
||||
type=str, help='ifc file name as string e.g. \"file.ifc\"')
|
||||
args = parser .parse_args()
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-f", "--file", action="store", type=str, required=True, help="schedule file name to be parsed")
|
||||
parser.add_argument(
|
||||
"-s", "--schedule", action="store", required=True, type=str, help="file format as xer, p6xml, mspxml, pp"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-i", "--ifcfile", action="store", required=False, type=str, help='ifc file name as string e.g. "file.ifc"'
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o", "--output", action="store", required=True, type=str, help='ifc file name as string e.g. "file.ifc"'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def get_file():
|
||||
ifcfile = None
|
||||
if args.ifcfile:
|
||||
ifcfile = ifcopenshell.open(args.ifcfile)
|
||||
elif args.output:
|
||||
ifc = ifcopenshell.file(schema='IFC4')
|
||||
ifc = ifcopenshell.file(schema="IFC4")
|
||||
ifc.create_entity("IfcWorkPlan")
|
||||
ifc.create_entity("IfcProject")
|
||||
ifc.write(args.output)
|
||||
@@ -34,6 +37,7 @@ def get_file():
|
||||
ifcfile = None
|
||||
return ifcfile
|
||||
|
||||
|
||||
if not args.ifcfile:
|
||||
print("You need to provide an ifc file to add schedule")
|
||||
print("Examples python ifc4d -i model.ifc -s xer -f schedule.xer -o newifc.ifc")
|
||||
@@ -41,7 +45,7 @@ elif not args.output:
|
||||
print("an output file is required to save changes")
|
||||
print("python ifc4d -o newfile.ifc -s xer -f schedule.xer")
|
||||
|
||||
elif args.schedule== "xer":
|
||||
elif args.schedule == "xer":
|
||||
p6xer = P6XER2Ifc()
|
||||
p6xer.xer = args.file
|
||||
p6xer.output = args.output
|
||||
@@ -49,7 +53,8 @@ elif args.schedule== "xer":
|
||||
if ifcfile:
|
||||
p6xer.file = ifcfile
|
||||
p6xer.execute()
|
||||
else: raise Exception("No files provided for output")
|
||||
else:
|
||||
raise Exception("No files provided for output")
|
||||
elif args.schedule == "mspxml":
|
||||
msp = MSP2Ifc()
|
||||
msp.xml = args.file()
|
||||
@@ -76,4 +81,3 @@ elif args.schedule == "pp":
|
||||
pp.execute()
|
||||
else:
|
||||
print("schedule type you selected is not implemented at the moment")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user