Python Forum

Full Version: School project
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. I'm struggling with a school project. I'm fairly new to Python, and I'm hoping for some great suggestions to solve my problem.

What I am trying to achieve is to simplify an operation up against the BIM program Solibri. By creating a script to, among other things, automate rule checking. Today one is dependent on a bat.file and an xml.file. the bat file opens the xml file and runs the references located there.
The references in the xml file are entered manually. What I hope to achieve is to create a script that retrieves the references automatically from given folders.

The text below show the bat file and the xml file.

Looking forward to hear from you.

Sincerely, Jan.

The bat-file

@ECHO off

ECHO Thank you for using Autorun
ECHO Autorun is running...

REM You can modify the line below to suit your needs.
"C:\Program Files\Solibri\SOLIBRI\Solibri.exe" "C:\Users\Desktop\Solibri Autorun\autorun.xml"

exit



the xml-file

<?xml version="1.0" encoding="ISO-8859-1"?>
<batch name="Simple Batch" default="root">
<!-- This is the starting task -->
<target name="root">

<openmodel
file="C:\Users\Desktop\Solibri Autorun\IFC\HJ3_Modell.ifc" />


<openmodel
file="C:\Users\janiv\Desktop\Solibri Autorun\IFC\SM3.ifc" />

<openclassification
file="C:\Users\Public\Solibri\SOLIBRI\Classifications\MEP Components.classification"/>

<openruleset
file="C:\Users\Public\Solibri\SOLIBRI\Rulesets\MEP Rules\Intersections in MEP Models.cset"/>

<check />

<autocomment zoom="TRUE" />

<createpresentation />

<bcfreport
file="C:\Users\Public\Solibri\SOLIBRI\Samples\reports\Found issues.bcfzip" version="2" />

<savemodel
file="C:\Users\Desktop\Solibri Autorun\SMC\BIMBAR.smc" />

<exit />

</target>
</batch>
show what you have tried (python code).
Thanks for reply.

Som nevnt er jeg ny til koding. For dette prosjektet har jeg i hovedsak brukt Sublime Text 3 og tkinter.
I do not have much. Just breadcrumbs that I have tried to put together, without success. I have tried different features but not found the right one. I know what I want the function to be.

I'm not looking for a conclusion. Just set in the right direction.

I add what I have, but I know it's wrong and it does not work.

Sincerely, Jan.


# Importerer tkinter. Dette følger med, er innebygd i Python
from tkinter import *
from PIL import ImageTk,Image
from tkinter import filedialog

# Dette må stå først
root = Tk()
# Endre overskriften på boksen
root.title("BIMBARIANS Autorun")
root.iconbitmap('C:/Users/jan/Desktop/SolibriAutorun/Ikon/BIMBARIANS.ico')
root.geometry("400x400")

def button_open1():
	global my_file
	root.filename = filedialog.askopenfilename(initialdir="C:/Users/jan/Desktop/SolibriAutorun", title="Select A File", filetypes=(("IFC files", "*.ifc"),("all files", "*.*")))
	my_label = Label(root, text=root.filename).pack()
	#my_image = ImageTk.PhotoImage(Image.open(root.filename))
	#my_image_label = Label(image=my_image).pack()

button_1 = Button(root, text="Add IFC", padx=59, pady=20, command=button_open1)
button_2 = Button(root, text="Add ruleset", padx=46, pady=20, command=open)
button_3 = Button(root, text="Add classification", padx=33, pady=20, command=open)
button_4 = Button(root, text="Run Solibri Autorun", padx=38, pady=20, command=open) 

button_1.grid(row=1, column=0)
button_2.grid(row=2, column=0)
button_3.grid(row=3, column=0)
button_4.grid(row=4, column=0)



mainloop()
# Når man lukker vinduet, slutter man loopen
Please show your code cause its a lot difficult to understand what are trying to say now without proper code.
Thanks