Beispiel #1
0
 def __init__(self):
     try:
         existingobj = pythoncom.connect(PyFemap.model.CLSID)
         self.model = PyFemap.model(existingobj)
     except:
         self.model = None
         sys.exit("Femap not openned")
     self.model.feAppMessage(constants.FPS_MESSAGES,
                             "Connection with Python openned!")
Beispiel #2
0
def _GetGoodDispatch(IDispatch, clsctx=pythoncom.CLSCTX_SERVER):
    if type(IDispatch) in _GoodDispatchType:
        try:
            IDispatch = pythoncom.connect(IDispatch)
        except pythoncom.ole_error:
            IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
    else:
        # may already be a wrapped class.
        IDispatch = getattr(IDispatch, "_oleobj_", IDispatch)
    return IDispatch
Beispiel #3
0
def _GetGoodDispatch(IDispatch, clsctx = pythoncom.CLSCTX_SERVER):
	if isinstance(IDispatch, _GoodDispatchTypes):
		try:
			IDispatch = pythoncom.connect(IDispatch)
		except pythoncom.ole_error:
			IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
	else:
		# may already be a wrapped class.
		IDispatch = getattr(IDispatch, "_oleobj_", IDispatch)
	return IDispatch
Beispiel #4
0
def _GetGoodDispatch(IDispatch, clsctx = pythoncom.CLSCTX_SERVER):
	# quick return for most common case
	if isinstance(IDispatch, PyIDispatchType):
		return IDispatch
	if isinstance(IDispatch, _GoodDispatchTypes):
		try:
			IDispatch = pythoncom.connect(IDispatch)
		except pythoncom.ole_error:
			IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
	else:
		# may already be a wrapped class.
		IDispatch = getattr(IDispatch, "_oleobj_", IDispatch)
	return IDispatch
            int(i) for i in date.dateTime().toString('yyyy.MM.dd').split('.')
        ]
        return list

    def open_storage(self, filename):
        storage = FileStorage.FileStorage(filename)
        db = DB(storage)
        connection = db.open()
        root = connection.root()
        return root, storage


if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    try:
        pythoncom.connect('Kompas.Application.5')  # Проверка запущен ли КОМПАС
        print('Компас запущен')
    except:
        messagebox = QtGui.QMessageBox
        qt = messagebox.question(
            None, '', "Компас 3D не запущен. \nЗапустить данную программу?",
            messagebox.Yes | messagebox.No)
        if qt == messagebox.Yes:
            module_5, kompas_object, const_5 = get_kompas_api5()
            kompas_object.Visible = True
            proba = Ui_MainWindow()
            proba.show()
            print('done')
    else:
        proba = Ui_MainWindow()
        proba.show()