How to set rigid body locked Pos Axis and locked Rot Axis in script

How to set rigid body locked Pos Axis and locked Rot Axis in script?

I’m currently using rigidprimview to test the collision of the object. With rigidprimview, gracity works and the object cannot be in the air. I want to use disabled_gravities or locked pos to make the object in the air. Is there any way through script?

Help me please!!!

from omni.isaac.examples.base_sample import BaseSample
from omni.isaac.core.utils.extensions import get_extension_path_from_name
from omni.importer.urdf import _urdf
from omni.isaac.franka.controllers import RMPFlowController
from omni.isaac.franka.tasks import FollowTarget
import omni.kit.commands
from omni.isaac.core.prims.rigid_prim_view import RigidPrimView
import omni.usd
import numpy as np
import torch
from omni.isaac.core.objects import DynamicCuboid
from omni.isaac.core.objects import FixedCuboid

class HelloWorld(BaseSample):
def init(self) → None:
super().init()
return

def setup_scene(self):

    world = self.get_world()
    world.scene.add_default_ground_plane()

    fancy_cube = world.scene.add(
        FixedCuboid(
            prim_path="/World/random_cube",
            name="fancy_cube", 
            position=np.array([0, 0, 1.0]), 
            scale=np.array([0.5015, 0.5015, 0.5015]),
            color=np.array([0, 0, 1.0]),
        ))
    self._cube_contact = RigidPrimView(
        prim_paths_expr="/World/random_cube",
        name="cube_vew",
        reset_xform_properties=False,
        track_contact_forces=True,
        prepare_contact_sensors=True,
    )
    self._cube_contact.disable_gravities()
    world.scene.add(self._cube_contact)
    
    return

async def setup_post_load(self):
    self._world = self.get_world()
    self._cube = self._world.scene.get_object("fancy_cube")
   
    self._world.add_physics_callback("sim_step", callback_fn=self.print_cube_info) 

    return

def print_cube_info(self, step_size):
    contact_forces = self._cube_contact.get_net_contact_forces()
    in_contact = self.check_contact_forces(contact_forces)
    print(f"Contact Forces: {contact_forces}")
    print(f"In Contact: {in_contact}")

def check_contact_forces(self, contact_forces):
    """
    Check if any contact forces are non-zero, indicating contact.
    Args:
        contact_forces: A numpy array or torch tensor of shape (M, 3) representing contact forces.
    Returns:
        A boolean indicating whether any contact force is non-zero.
    """
    if isinstance(contact_forces, np.ndarray):
        contact_magnitudes = np.linalg.norm(contact_forces, axis=1)
        in_contact = np.any(contact_magnitudes > 0)
    elif isinstance(contact_forces, torch.Tensor):
        contact_magnitudes = torch.norm(contact_forces, dim=1)
        in_contact = torch.any(contact_magnitudes > 0)
    else:
        raise TypeError("Unsupported type for contact_forces. Must be numpy.ndarray or torch.Tensor.")
    
    return in_contact