import omni import omni.usd from pxr import Sdf, Gf import omni.kit.commands import omni.replicator.core as rep # 環境の設定 rep.settings.set_stage_up_axis("Z") # Zを上軸に設定 rep.settings.set_stage_meters_per_unit(1.0) # メートル単位に設定 # ライトの作成 omni.kit.commands.execute('CreatePrim', prim_type='DomeLight', attributes={'inputs:intensity': 1000, 'inputs:texture:format': 'latlong'}) omni.kit.commands.execute('CreatePrim', prim_type='DistantLight', attributes={'inputs:angle': 1.0, 'inputs:intensity': 1000}) # 人形のmeshをグループ化 omni.kit.commands.execute( 'GroupPrims', prim_paths=['/World/Lego_OBJ/Arm006', '/World/Lego_OBJ/Arm007', '/World/Lego_OBJ/Arm008', '/World/Lego_OBJ/Arm009', '/World/Lego_OBJ/Body001', '/World/Lego_OBJ/Captain', '/World/Lego_OBJ/Torso001', '/World/Lego_OBJ/Sphere001', '/World/Lego_OBJ/Right_leg003', '/World/Lego_OBJ/Right_leg002', '/World/Lego_OBJ/middle001'] ) # Group(人形のmesh)をworldに移動 omni.kit.commands.execute( 'MovePrims', paths_to_move={'/World/Lego_OBJ/Group': '/World/Group'}, keep_world_transform=False, destructive=False ) # 不要なmeshを削除 omni.kit.commands.execute('DeletePrims', paths=['/World/Lego_OBJ'], destructive=False) # Group(人形のmesh)の位置と大きさ等の修正 with rep.get.prim_at_path('/World/Group'): rep.modify.attribute('xformOp:translate', value=(-192.39285, 0.0, 359.39679)) # 人形の位置を調整 rep.modify.attribute('xformOp:translate:pivot', value=(192.39285278320312, 0.0, -359.39678955078125)) # 人形の重心を調整 rep.modify.attribute('xformOp:rotateXYZ', value=(90, 0.0, 0.0)) # 人形の向きを調整 rep.modify.attribute('xformOp:scale', value=(0.01, 0.01, 0.01)) # 人形の大きさを調整