duh преди 6 години
родител
ревизия
509f778e3d
променени са 2 файла, в които са добавени 11 реда и са изтрити 10 реда
  1. 3 3
      phxb/utils/GetAllModule.py
  2. 8 7
      phxb/utils/main.py

+ 3 - 3
phxb/utils/GetAllModule.py

@@ -48,7 +48,7 @@ def moveBlockReferenceWithNewIndex(position,moduleIndex):
       if(blockReference.name == item):
         blockReferences.append(blockReference)
   for index in moduleIndex:
-    moveBlockReferenceToWall(blockReferences[index],position[conf.names.index(item)])
+    moveBlockReferenceToWall(blockReferences[index],position[moduleIndex.index(index)])
 # 重置已使用墙的长度
 def resetConfUsed():
   conf.roomUsedLengths=[1200,0,0,1000]
@@ -69,5 +69,5 @@ def resetModuleIndex():
 # printTheTypeObject("BlockReference")
 
 # moveBlockReference('222')
-# a=[1,0,2]
-# moveBlockReferenceWithNewIndex('222',a)
+# a=[0,1,2]
+# moveBlockReferenceWithNewIndex('001',a)

+ 8 - 7
phxb/utils/main.py

@@ -105,17 +105,18 @@ def myprocess(m, n):
         number = getarray.getitemIndexArrayNumber(positons[positon], m, n)
         if (number == 1):
             newFileName = _rootPath + "newfile" + str(positons[positon]) + ".dwg"
-            # if(not os.path.exists(newFileName)):
-            #     copyfile(_rootPath + _originFile, newFileName)
-            #     moveSingleTemplate(newFileName,positons[positon])
+            if(not os.path.exists(newFileName)):
+                copyfile(_rootPath + _originFile, newFileName)
+                moveSingleTemplate(newFileName,positons[positon])
                 # break
         else:
             moduleIndexs = getarray.getModuleIndex(positons[positon],m,n)
             for moduleIndex in moduleIndexs:
                 newFileName = _rootPath + "newfile" + str(positons[positon]) + str(moduleIndex) + ".dwg"
-                copyfile(_rootPath + _originFile, newFileName)
-                moveMultipleTemplate(newFileName,positons[positon],moduleIndex)
-            break
+                if(not os.path.exists(newFileName)):
+                    copyfile(_rootPath + _originFile, newFileName)
+                    moveMultipleTemplate(newFileName,positons[positon],moduleIndex)
+            # break
 def moveSingleTemplate(fileName,position):
     # openFile(fileName)
     GetAllModule.resetConfUsed()
@@ -129,7 +130,7 @@ def moveSingleTemplate(fileName,position):
 def moveMultipleTemplate(fileName,position,moduleIndex):
     GetAllModule.resetConfUsed()
     GetAllModule.moveBlockReferenceWithNewIndex(position,moduleIndex)
-    time.sleep(3)
+    time.sleep(1)
     acad = Autocad(create_if_not_exists = False)
     acad.prompt("Hello, Autocad from Python\n")
     acad.doc.SaveAs(fileName)