update
This commit is contained in:
parent
e910547106
commit
531b6957e6
119169
nxopen_api_know/nxopen.txt
119169
nxopen_api_know/nxopen.txt
File diff suppressed because it is too large
Load Diff
@ -19,43 +19,41 @@ lw.Open()
|
|||||||
# 定义要检查的模块列表,具体要检查的模块自行设定,不建议设置太多模块同时导出,会卡死你的!
|
# 定义要检查的模块列表,具体要检查的模块自行设定,不建议设置太多模块同时导出,会卡死你的!
|
||||||
modules = [NXOpen]
|
modules = [NXOpen]
|
||||||
|
|
||||||
#输出代码缩进级别
|
|
||||||
def print_with_indent(indent_level):
|
def print_with_indent(indent_level):
|
||||||
indent = " " * indent_level
|
indent = " " * indent_level
|
||||||
return indent
|
return indent
|
||||||
|
|
||||||
def print_with(cls_name,head_str,indent_level):
|
|
||||||
if not cls_name.startswith('__') and not cls_name.startswith('_'):
|
|
||||||
lw.WriteLine(f"{print_with_indent(indent_level)}{head_str}:{cls_name}")
|
|
||||||
def main():
|
def main():
|
||||||
for module in modules:
|
for module in modules:
|
||||||
lw.WriteLine(f"module name:{module.__name__}")
|
lw.WriteLine(f"module name:{module.__name__}")
|
||||||
classes = inspect.getmembers(module)
|
classes = inspect.getmembers(module)
|
||||||
for cls_name,cls in classes:
|
for cls_name,cls in classes:
|
||||||
print_with(cls_name,"class",1)
|
# 过滤掉以双下划线开头的成员
|
||||||
subs = inspect.getmembers(cls)
|
if not cls_name.startswith('__') and not cls_name.startswith('_'):
|
||||||
for sub_name,sub in subs:
|
lw.WriteLine(f"{print_with_indent(1)}class:{module.__name__}.{cls_name}")
|
||||||
if inspect.isclass(sub):
|
# 获取类的所有成员
|
||||||
print_with(sub_name,"class",2)
|
members = inspect.getmembers(cls,inspect.isclass)
|
||||||
attrs=inspect.getmembers(sub)
|
for member_name, member in members:
|
||||||
for attr_name,attr in attrs:
|
if not member_name.startswith('__'):
|
||||||
if attr_name not in ('ValueOf', 'mro'):
|
lw.WriteLine(f"{print_with_indent(4)}member:{member_name}")
|
||||||
print_with(attr_name,"attribute",3)
|
attrs=inspect.getmembers(member)
|
||||||
elif inspect.ismethoddescriptor(sub):
|
for attr_name,attr in attrs:
|
||||||
print_with(sub_name,"method",2)
|
if not attr_name.startswith('__'):
|
||||||
#lw.WriteLine(f"{sub}")
|
lw.WriteLine(f"{print_with_indent(6)}attr:{attr_name}")
|
||||||
else:
|
|
||||||
print_with(sub_name,"attribute",2)
|
|
||||||
|
|
||||||
|
funcs = inspect.getmembers(cls)
|
||||||
|
for func_name, func in funcs:
|
||||||
|
_type=type(func).__name__
|
||||||
|
# 过滤掉以双下划线开头的成员
|
||||||
|
if not func_name.startswith('__') and not func_name.startswith('_'):
|
||||||
|
#过滤掉影响阅读的成员
|
||||||
|
if not (type(func).__name__).startswith('method_descriptor') \
|
||||||
|
and not (type(func).__name__).startswith('getset_descriptor') \
|
||||||
|
and not (type(func).__name__).startswith('builtin_function_or_method') \
|
||||||
|
and not (type(func).__name__).startswith('type'):
|
||||||
|
_type=type(func).__name__
|
||||||
|
lw.WriteLine(f"{print_with_indent(4)}func:{func_name}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#"----------该脚本屏蔽内容如下:-----------"
|
|
||||||
#"__"
|
|
||||||
#"_"
|
|
||||||
#"method_descriptor"
|
|
||||||
#"getset_descriptor"
|
|
||||||
#f"builtin_function_or_method"
|
|
||||||
#"-------------------------------------"
|
|
||||||
#"屏蔽以上内容方便API的阅读,被屏蔽掉的内容作者认为是python内置或者绑定函数,对象,成员.阅读意义不大"
|
|
||||||
main()
|
main()
|
||||||
Loading…
Reference in New Issue
Block a user