Pārlūkot izejas kodu

可行性判断

duh 6 gadi atpakaļ
vecāks
revīzija
844979b3cb
2 mainītis faili ar 23 papildinājumiem un 7 dzēšanām
  1. 13 1
      phxb/utils/GetAllModule.py
  2. 10 6
      phxb/utils/main.py

+ 13 - 1
phxb/utils/GetAllModule.py

@@ -65,9 +65,21 @@ def changeConfModuleIndex(moduleIndex):
 def resetModuleIndex():
   conf.names=['md_py','md_xs','md_rc']
   conf.moduleLengths = (800,1000,800)
+def isWorkable(position):
+  resetConfUsed()
+  print("position=",position)
+  needLength=[0]*4
+  for positionIndex in range(len(position)):
+    wallIndex = int(position[positionIndex])
+    needLength[wallIndex]+=conf.moduleLengths[positionIndex]
+    if(needLength[wallIndex]+conf.roomUsedLengths[wallIndex] > conf.roomLengths[wallIndex%2]):
+      print(needLength[wallIndex]+conf.roomUsedLengths[wallIndex],conf.roomLengths[math.floor(wallIndex/2)],wallIndex)
+      return 0
+  return 1
 # printObjects()
 # printTheTypeObject("BlockReference")
 
 # moveBlockReference('222')
 # a=[0,1,2]
-# moveBlockReferenceWithNewIndex('001',a)
+# moveBlockReferenceWithNewIndex('001',a)
+# print(isWorkable('222'))

+ 10 - 6
phxb/utils/main.py

@@ -101,7 +101,7 @@ def createNewFileAndMove(newFil):
 def myprocess(m, n):
     positons = getarray.getAllPosition(m, n)
     for positon in positons:
-        indexAndPositionArray = getarray.getitemIndexAndPositionArray(positons[positon], m, n)
+        # indexAndPositionArray = getarray.getitemIndexAndPositionArray(positons[positon], m, n)
         number = getarray.getitemIndexArrayNumber(positons[positon], m, n)
         if (number == 1):
             newFileName = _rootPath + "newfile" + str(positons[positon]) + ".dwg"
@@ -111,12 +111,16 @@ def myprocess(m, n):
                 # break
         else:
             moduleIndexs = getarray.getModuleIndex(positons[positon],m,n)
-            for moduleIndex in moduleIndexs:
-                newFileName = _rootPath + "newfile" + str(positons[positon]) + str(moduleIndex) + ".dwg"
-                if(not os.path.exists(newFileName)):
-                    copyfile(_rootPath + _originFile, newFileName)
-                    moveMultipleTemplate(newFileName,positons[positon],moduleIndex)
+            if(GetAllModule.isWorkable(positons[positon])):
+                for moduleIndex in moduleIndexs:
+                    newFileName = _rootPath + "newfile" + str(positons[positon]) + str(moduleIndex) + ".dwg"
+                    if(not os.path.exists(newFileName)):
+                        copyfile(_rootPath + _originFile, newFileName)
+                        moveMultipleTemplate(newFileName,positons[positon],moduleIndex)
+            else:
+                print(positons[positon],"is not workable !!")
             # break
+
 def moveSingleTemplate(fileName,position):
     # openFile(fileName)
     GetAllModule.resetConfUsed()