58 lines
2.6 KiB
Python
58 lines
2.6 KiB
Python
# NX Version:NX 2412
|
|
# Email:809262979@qq.com
|
|
# python .py created by JackLee
|
|
# NX run .py alt+F8
|
|
|
|
import NXOpen
|
|
import NXOpen.CAM
|
|
import NXOpen.UF as UF
|
|
import inspect
|
|
import io
|
|
|
|
from contextlib import redirect_stdout
|
|
# 获取当前会话
|
|
session = NXOpen.Session.GetSession()
|
|
# 打开列表窗口用于输出信息
|
|
lw = session.ListingWindow
|
|
lw.Open()
|
|
|
|
# 定义要检查的模块列表,具体要检查的模块自行设定,不建议设置太多模块同时导出,会卡死你的!
|
|
modules = [NXOpen]
|
|
|
|
def main():
|
|
for module in modules:
|
|
lw.WriteLine(f"-------------module name: {module.__name__}-------------")
|
|
func = inspect.getmembers(module)
|
|
for func_name,func_obj in func:
|
|
# 过滤掉以双下划线开头的成员
|
|
if not func_name.startswith('__') and not func_name.startswith('_'):
|
|
lw.WriteLine(f"func name: {module.__name__}.{func_name}")
|
|
# 获取类的所有成员
|
|
member = inspect.getmembers(func_obj)
|
|
for member_name, member_obj in member:
|
|
# 过滤掉以双下划线开头的成员
|
|
if not member_name.startswith('__') and not member_name.startswith('_'):
|
|
lw.WriteLine(f" member name: {module.__name__}.{func_name}.{member_name}")
|
|
#过滤掉影响阅读的成员
|
|
if not (type(member_obj).__name__).startswith('method_descriptor') \
|
|
and not (type(member_obj).__name__).startswith('getset_descriptor') \
|
|
and not (type(member_obj).__name__).startswith('builtin_function_or_method') \
|
|
and not (type(member_obj).__name__).startswith('type'):
|
|
lw.WriteLine(f" member type: {type(member_obj).__name__}")
|
|
for attr in dir(member_obj):
|
|
if not attr.startswith('__') and not attr.startswith('_'):
|
|
lw.WriteLine(f" attr type: {attr}")
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
lw.WriteLine(f"----------该脚本屏蔽内容如下:-----------")
|
|
lw.WriteLine(f"__")
|
|
lw.WriteLine(f"_")
|
|
lw.WriteLine(f"method_descriptor")
|
|
lw.WriteLine(f"getset_descriptor")
|
|
lw.WriteLine(f"builtin_function_or_method")
|
|
lw.WriteLine(f"-------------------------------------")
|
|
lw.WriteLine(f"屏蔽以上内容方便API的阅读,被屏蔽掉的内容作者认为是python内置或者绑定函数,对象,成员.阅读意义不大")
|
|
main()
|