[安卓]2dx 执行 create_project.py 创建工程失败

本文介绍如何使用Cocos2d-x的create_project.py脚本创建一个多平台支持的游戏项目。通过正确的命令行操作,可以顺利生成包含iOS、Android等多平台支持的游戏工程,并完成项目的初始化设置。
要先 cd 到 create_project.py 所在的目录下,再执行 create_project.py 脚本
mayas-MacbookPro:cocos2d-x-2.2.3 maya$ /Users/maya/Practice/cocos2d-x-2.2.3/tools/project-creator/create_project.py -project catchCat -package com.maya.catchcat -language cpp
Traceback (most recent call last):
  File "/Users/maya/Practice/cocos2d-x-2.2.3/tools/project-creator/create_project.py", line 205, in <module>
    shutil.copytree(context["src_project_path"], context["dst_project_path"], True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 171, in copytree
    names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '/Users/maya/Practice/cocos2d-x-2.2.3/../../template/multi-platform-cpp'
mayas-MacbookPro:cocos2d-x-2.2.3 maya$ cd /Users/maya/Practice/cocos2d-x-2.2.3/tools/project-creator 
mayas-MacbookPro:project-creator maya$ /Users/maya/Practice/cocos2d-x-2.2.3/tools/project-creator/create_project.py -project catchCat -package com.maya.catchcat -language cpp
proj.ios : Done!
proj.android : Done!
proj.win32 : Done!
proj.winrt : Done!
proj.wp8 : Done!
proj.mac : Done!
proj.blackberry : Done!
proj.linux : Done!
proj.marmalade : Done!
proj.tizen : Done!
proj.wp8-xaml : Done!
New project has been created in this path: /Users/maya/Practice/cocos2d-x-2.2.3/projects/catchCat
Have Fun!
mayas-MacbookPro:project-creator maya$
def create_non_overlapping_shapes(area_um2,top_cell,layer): """ 在第一象限创建互不相交的六种形状(面积相同) :param area_um2: 每个形状的目标面积 (平方微米) :param output_file: 输出GDS文件名 """ # 初始化布局 # 计算基本尺寸 base_size_um = math.sqrt(area_um2) # 正方形边长 # 形状位置偏移量 (确保互不重叠) x_offset = 0 y_spacing = base_size_um * 1.5 # 行间距 # 1. 正方形 side_dbu = int(base_size_um / 0.001) square = pya.Box(x_offset, 0, x_offset + side_dbu, side_dbu) top_cell.shapes(layer).insert(square) x_offset += side_dbu * 1.2 # 增加间距 # 2. 长方形 (长宽比2:1) width_um = math.sqrt(area_um2 * 2.0) height_um = area_um2 / width_um width_dbu = int(width_um / 0.001) height_dbu = int(height_um / 0.001) rect = pya.Box(x_offset, 0, x_offset + width_dbu, height_dbu) top_cell.shapes(layer).insert(rect) x_offset += width_dbu * 1.2 # 3. 圆形 radius_um = math.sqrt(area_um2 / math.pi) radius_dbu = int(radius_um / 0.001) center_x = x_offset + radius_dbu center_y = radius_dbu circle = pya.Disk(pya.Point(center_x, center_y), radius_dbu) top_cell.shapes(layer).insert(circle) x_offset += radius_dbu * 2 * 1.2 # 4. 三角形 (等边) side_um = math.sqrt(4 * area_um2 / math.sqrt(3)) side_dbu = int(side_um / 0.001) tri_height_dbu = int(side_dbu * math.sqrt(3) / 2) points = [ pya.Point(x_offset, 0), pya.Point(x_offset + side_dbu, 0), pya.Point(x_offset + side_dbu / 2, tri_height_dbu) ] triangle = pya.Polygon(points) top_cell.shapes(layer).insert(triangle) x_offset += side_dbu * 1.2 # 5. 中空方形 outer_side_um = math.sqrt(2 * area_um2) inner_side_um = math.sqrt(area_um2) margin_um = (outer_side_um - inner_side_um) / 2 outer_dbu = int(outer_side_um / 0.001) inner_dbu = int(inner_side_um / 0.001) margin_dbu = int(margin_um / 0.001) outer_box = pya.Box(x_offset, 0, x_offset + outer_dbu, outer_dbu) inner_box = pya.Box( x_offset + margin_dbu, margin_dbu, x_offset + outer_dbu - margin_dbu, outer_dbu - margin_dbu ) hollow = pya.Region(outer_box) - pya.Region(inner_box) top_cell.shapes(layer).insert(hollow) x_offset += outer_dbu * 1.2 # 6. 十字形 arm_width_um = math.sqrt(area_um2 / 3) arm_length_um = arm_width_um * 3 arm_width_dbu = int(arm_width_um / 0.001) arm_length_dbu = int(arm_length_um / 0.001) # 水平臂 horiz_arm = pya.Box( x_offset, (arm_length_dbu - arm_width_dbu) // 2, x_offset + arm_length_dbu, (arm_length_dbu + arm_width_dbu) // 2 ) # 垂直臂 vert_arm = pya.Box( x_offset + (arm_length_dbu - arm_width_dbu) // 2, 0, x_offset + (arm_length_dbu + arm_width_dbu) // 2, arm_length_dbu ) cross = pya.Region(horiz_arm) + pya.Region(vert_arm) top_cell.shapes(layer).insert(cross) import klayout.db as pya from ant.ANT_QA_PATTEN.creat_patten import Process_Library as prl from klayout1.create_patten.CT_VIA.p1 import KU_FILE as kfl ly = pya.Layout() rule_name = "UTM6_5" bad_cell_name = "bad_" + rule_name good_cel_name = "good_" + rule_name top_bad = ly.create_cell(bad_cell_name) top_good = ly.create_cell(good_cel_name) AA_LAYER = ly.layer(11, 0) POLY_LAYER = ly.layer(278, 102) SP_LAYER = ly.layer(87, 0) SPW_LAYER = ly.layer(53, 0) SN_LAYER = ly.layer(86, 0) DG_LAYER = ly.layer(61, 0) NW_LAYER = ly.layer(42, 0) DLVMK_LAYER = ly.layer(73,99) LDMK5_LAYER = ly.layer(261,305) HVMK_LAYER = ly.layer(299,99) PSUB_LAYER = ly.layer(256,0) UTM6_LAYER = ly.layer(622,0) PA1_LAYER = ly.layer(171,0) UHV_LAYER = ly.layer(387,99) UTV2_LAYER = ly.layer(154,0) UTV1_LAYER = ly.layer(153,0) V1_LAYER = ly.layer(141,0) V2_LAYER = ly.layer(142,0) V3_LAYER = ly.layer(143,0) V4_LAYER = ly.layer(144,0) CT_LAYER = ly.layer(96,0) M1_LAYER = ly.layer(111,0) M2_LAYER = ly.layer(112,0) M3_LAYER = ly.layer(113,0) M4_LAYER = ly.layer(114,0) M5_LAYER = ly.layer(115,0) UTM1_LAYER = ly.layer(125,0) UTM2_LAYER = ly.layer(126,0) UTM3_LAYER = ly.layer(127,0) UTM4_LAYER = ly.layer(128,0) UTM6_LAYER = ly.layer(622,0) PA1_LAYER = ly.layer(171,0) UHV_LAYER = ly.layer(387,99) UTM6DUM_LAYER = ly.layer(622,1) INDMK_LAYER = ly.layer(285,99) kfl.create_non_overlapping_shapes(2.25,top_bad,UTM6_LAYER) # kfl.single_LAYER_space_with_itself(cell,layer1,space,offset1,mark_layer1 = "define") # kfl.creat_width_second(UTM6_LAYER,top_good,top_bad,35,0,PA1_LAYER,UHV_LAYER ) # kfl.single_space(top_good,UTM6_LAYER,0.95,0,mark_layer1 = "define") # kfl.single_space(top_good,UTM6_LAYER,0.951,5,mark_layer1 = "define") # kfl.single_space(top_good,UTM6_LAYER,0.96,10,mark_layer1 = "define") # kfl.single_space(top_bad,UTM6_LAYER,0.949,0,mark_layer1 = "define") # kfl.single_space(top_bad,UTM6_LAYER,0.94,5,mark_layer1 = "define") # # pattenr1 = kfl.creat_ring(0, 0, 300000, 300000, 20000) # pattenr2 = kfl.creat_ring(0, 0, 300000, 300000, 10000) # pattenr3 = kfl.creat_ring(5780, 5780, 294220,294220, 360) # pattenr4 = kfl.creat_ring(7570, 7570, 292430,292430, 360) # # pattenr5 = kfl.creat_ring(5920, 5920, 294080,294080, 220) # pattenr6 = kfl.creat_ring(7710, 7710, 292290,292290, 220) # # pattenr7 = kfl.creat_ring(4920, 4920, 295080,295080, 220) # pattenr8 = kfl.creat_ring(6710, 6710, 293290,293290, 220) # pattenr9 = kfl.creat_ring(8500, 8500, 291500,291500, 220) # # pattenr10 = kfl.creat_ring(4000, 4000, 296000,296000, 6000) # # patten12_box = pya.Box(1500,1500,2000,2000) # # outer1_region = pya.Region(patten1_box) # # outer2_region = pya.Region(patten12_box) # # patten123_box = outer1_region - outer2_region # # patten2_box = pya.Box(1000,1000,1700,1700) # # patten3_box = pya.Box(4900,4900,15000,15000) # # patten4_box = pya.Box(1600,1600,1900,1900) # # patten5_box = pya.Box(0,0,5000,5100) # # top_bad.shapes(POLY_LAYER).insert(patten123_box) # # top_bad.shapes(AA_LAYER).insert(patten1_box) # # top_bad.shapes(AA_LAYER).insert(patten2_box) # # # # top_bad.shapes(AA_LAYER).insert(patten3_box) # # top_bad.shapes(POLY_LAYER).insert(patten2_box) # # top_bad.shapes(AA_LAYER).insert(patten4_box) # # top_bad.shapes(AA_LAYER).insert(patten5_box) # # # patten1_box = pya.Box(0,0,3000,3000) # # patten2_box = pya.Box(500,500,2500,2500) # top_bad.shapes(POLY_LAYER).insert(pattenr1) # top_bad.shapes(SPW_LAYER).insert(pattenr1) # top_bad.shapes(AA_LAYER).insert(pattenr2) # top_bad.shapes(SP_LAYER).insert(pattenr2) # # # top_bad.shapes(UTV2_LAYER).insert(pattenr3) # top_bad.shapes(UTV1_LAYER).insert(pattenr3) # top_bad.shapes(UTV2_LAYER).insert(pattenr4) # top_bad.shapes(UTV1_LAYER).insert(pattenr4) # top_bad.shapes(V1_LAYER).insert(pattenr5) # top_bad.shapes(V3_LAYER).insert(pattenr5) # top_bad.shapes(V1_LAYER).insert(pattenr6) # top_bad.shapes(V3_LAYER).insert(pattenr6) # # top_bad.shapes(V2_LAYER).insert(pattenr7) # top_bad.shapes(V2_LAYER).insert(pattenr8) # top_bad.shapes(V2_LAYER).insert(pattenr9) # # top_bad.shapes(V4_LAYER).insert(pattenr7) # top_bad.shapes(V4_LAYER).insert(pattenr8) # top_bad.shapes(V4_LAYER).insert(pattenr9) # # top_bad.shapes(CT_LAYER).insert(pattenr7) # top_bad.shapes(CT_LAYER).insert(pattenr8) # top_bad.shapes(CT_LAYER).insert(pattenr9) # # top_bad.shapes(M1_LAYER).insert(pattenr10) # top_bad.shapes(M2_LAYER).insert(pattenr10) # top_bad.shapes(M3_LAYER).insert(pattenr10) # top_bad.shapes(M4_LAYER).insert(pattenr10) # top_bad.shapes(M5_LAYER).insert(pattenr10) # top_bad.shapes(UTM1_LAYER).insert(pattenr10) # top_bad.shapes(UTM2_LAYER).insert(pattenr10) # top_bad.shapes(UTM3_LAYER).insert(pattenr10) # top_bad.shapes(UTM4_LAYER).insert(pattenr10) output = r'/home/user/zhourf/PycharmProjects/pythonProject1/klayout1/create_patten/inout/'+rule_name+".gds" ly.write(output)/CAD/SYSTEM/PYTHON/miniforge3/envs/python36/bin/python /home/user/zhourf/PycharmProjects/pythonProject1/klayout1/generate_patten.py Traceback (most recent call last): File "/home/user/zhourf/PycharmProjects/pythonProject1/klayout1/generate_patten.py", line 47, in <module> kfl.create_non_overlapping_shapes(2.25,top_bad,UTM6_LAYER) File "/home/user/zhourf/PycharmProjects/pythonProject1/klayout1/create_patten/CT_VIA/p1/KU_FILE.py", line 724, in create_non_overlapping_shapes circle = pya.Disk(pya.Point(center_x, center_y), radius_dbu) AttributeError: module 'pya' has no attribute 'Disk' Process finished with exit code 1
12-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值