GetAllModule.py 687 B

1234567891011121314151617181920212223
  1. # -*- coding: UTF-8 -*-
  2. from pyautocad import Autocad, APoint
  3. import sys
  4. #这个true表示没有文件则打开一个,CAD有弹窗时会打开或者创建失败
  5. acad = Autocad(create_if_not_exists = True)
  6. acad.prompt("Hello, Autocad from Python\n")
  7. # print(acad.doc.Name)
  8. def printObjects():
  9. #遍历cad图形对象
  10. for obj in acad.iter_objects():
  11. print(obj.ObjectName)
  12. def printTheTypeObject(type):
  13. #按类型查找出所有某种图元
  14. for text in acad.iter_objects(type):
  15. print(text.TextString, text.InsertionPoint)
  16. printObjects()
  17. # print("syspath",sys.path)
  18. # gatarray.jieChen(5)
  19. # print("-------")
  20. # printTheTypeObject('Text')
  21. printTheTypeObject('BlockReference')