python
astragin
BJUTer
展开
-
Python 异常处理 (20210804)
Python 异常处理 (20210804)def divide(x,y): try: x=float(x) y=float(y) x/y except Exception as e: print(e)if __name__ =="__main__": x=input("Please input x") y=input("Please input y") divide(x,y)...原创 2021-08-04 14:25:47 · 69 阅读 · 0 评论 -
python数组切片(2021-07-02)
python数组切片from numpy import arrayfrom math import log10from matplotlib.pyplot import plot,showa=[]for i in range(1,100): a.append((i/100,log10(i/100)))a=array(a)a1=a[...,0] #切出来第一列a2=a[...,1] #切出来第二列a1=a1.tolist()a2=a2.tolist()plot(a1,a2)原创 2021-07-02 19:32:43 · 89 阅读 · 0 评论 -
AbqGui开发笔记01-主窗口(2021-06-09)
AbqGui开发笔记01-主窗口from abaqusGui import *import sysclass MyAFXMainWindow(AFXMainWindow): def __init__(self,a,title): AFXMainWindow.__init__(self,a,title) # Register the "persistent" toolsets. # self.registerToolset(File原创 2021-06-09 14:23:48 · 155 阅读 · 0 评论 -
prototypeApp二次加载app(2021-06-08)
达索学习社区提供的prototypeApp启动方法:abaqus cae -custom prototypeApp -noStartupappIcons.py"""This module defines icons used for the prototype application."""dialogIconData = ["24 24 2 1"," c navy","X c None s None","XXXXXXXXXXXXXXXXXXXXXXXX","XXXXXXXXXX翻译 2021-06-08 09:04:12 · 165 阅读 · 0 评论 -
python类外定义函数(2021-06-08)
python可以在类外定义函数,和C++类似类外绑定函数通常有两种方法,一是直接通过类名绑定函数,而是利用对象绑定函数。方法一:对于类 a=ClassName(),若需要定义函数Fun()则通常采用如下格式:def ClassName(object): passdef Fun(self,*argv): .......ClassName.Fun=Fun#注意,类外的函数也要有self形式参数class a(object): def __init__(self):原创 2021-06-08 08:46:47 · 1235 阅读 · 1 评论 -
@property修饰器(2021-06-07)
@property用于限制类中属性,经测验,以下代码适用python3.x,不适用2.x# encoding: utf-8class Student: def __init__(self,score): self.__score=score @property def score(self): return self.__score @score.setter def score(self,score): if sc原创 2021-06-07 21:16:41 · 114 阅读 · 0 评论 -
解决pyside2的uic转换C++代码的问题( 2021-05-27)
解决pyside2的uic转换C++代码的问题不能直接用pyside2包目录下的uic.exe文件。可能是电脑上面安装了C++的Qt,所以Uic会将ui文件装换成C++源代码,而不是Python源代码。为此,pyside2提供了专门的装换插件,pyside2-uic,该插件能将ui文件装换为Python代码。from PySide2.QtCore import *from PySide2.QtGui import *from PySide2.QtWidgets import *import s原创 2021-05-27 09:52:19 · 1282 阅读 · 1 评论 -
Odb处理
########################################################################################################################################################from odbAccess import *from abaqusConstants import *from math import sin,pimyOdb = openOdb原创 2021-05-24 13:16:54 · 211 阅读 · 0 评论 -
remove mask
session.journalOptions.setValues(replayGeometry=COORDINATE,recoverGeometry=COORDINATE)原创 2021-04-13 22:04:23 · 382 阅读 · 0 评论 -
常用的py命令流
去除掩码session.journalOptions.setValues(replayGeometry=COORDINATE,recoverGeometry=COORDINATE)原创 2020-12-06 10:29:36 · 178 阅读 · 0 评论 -
py读取inp文件
按行读取(first of all)#read the inp fileinpfile=open(r'D:\abaqusWorkDir\voxel\Job-1.inp')lines=inpfile. readlines() #按行读取inpfile.close()print(lines)原创 2020-12-06 13:41:52 · 1399 阅读 · 0 评论