| 1234567891011121314151617181920212223242526272829303132 | 
							- # -*- coding: UTF-8 -*-
 
- from pyautocad import Autocad, APoint
 
- from utils import getarray
 
- import math
 
- #这个true表示没有文件则打开一个,CAD有弹窗时会打开或者创建失败
 
- acad = Autocad(create_if_not_exists = True)
 
- # acad.prompt("Hello, Autocad from Python\n")
 
- # print(acad.doc.Name)
 
- def printObjects():
 
-   #遍历cad图形对象
 
-   for obj in acad.iter_objects():
 
-     print(obj.ObjectName)
 
- def printTheTypeObject(type):
 
-   #按类型查找出所有某种图元
 
-   for text in acad.iter_objects(type):
 
-     print(text.name)
 
- names=['ssdr_800','md_py','md_xs','md_rc']
 
- def moveBlockReference():
 
-   for blockReference in acad.iter_objects("BlockReference"):
 
-     # print(blockReference.name)
 
-     if(blockReference.name == names[3]):
 
-       insertionPoint = blockReference.InsertionPoint
 
-       blockReference.rotate(APoint(insertionPoint[0],insertionPoint[1]),-0.5*math.pi)
 
-       print(insertionPoint)
 
-       # blockReference.move(APoint(insertionPoint[0],insertionPoint[1]),APoint(0,0))
 
- # printObjects()
 
- # printTheTypeObject("BlockReference")
 
- moveBlockReference()
 
- # a = getarray.jieChen(5)
 
- # print(a)
 
 
  |