Trying to create a script in the ides that , opens file, changes pose, saves file

i have a file that conations a charcater , and i want to open it, change the character pose to a different pose  that is store in my content libary, then i want to save the file


i have been trying for ages to get a script make that

1 - opens a file / a scene already saved on my computer

2 - changes the pose of the character in the scene

3 - saves the file / scene on my computer


var oContentMgr = App.getContentMgr();// Open the first fileoContentMgr.openFile("C:/Users/me/Documents/DAZ 3D/Studio/My Library/RENDER-SCENCES/Amatera-8.1-cyborg/character/clothing/pose4/pose4-clothing-set5.duf", true);// Change the pose of the main character for the first scenevar mainCharacter1 = Scene().findNodeByName("Amatera 8.1 Cyborg HD"); // Adjust the character node name if neededif (mainCharacter1 !== null) {    // Example: Change pose to a predefined pose named "Pose4"    mainCharacter1.setPose("MTW Tac Knife Standing 03 G8F");} else {    print("Main character not found in the first scene.");}// Save the modified first sceneApp.saveScene("C:/Users/me/Documents/DAZ 3D/Studio/My Library/RENDER-SCENCES/Amatera-8.1-cyborg/character/clothing/pose5/pose5-clothing-set5.duf");


the code above i have got out of  a long process with forum/google/gpt, it seems to not no anything about daz studio scripting at all

the script above opens the file ok

we run into a error on line 7  finding the scene

and i am not sure if the changing the pose and saving the scene after are correct either, can anyone adivse, thanks




  • Richard HaseltineRichard Haseltine Posts: 98,312

    Scene is an object, not a fucntions, so you want

    var mainCharacter1 = Scene.findNodeByName("Amatera 8.1 Cyborg HD");

    though you should use one of the label methods rather than name, which will be the base figure name.

    Wheer are you findign setPose()? Ti apply a pose the usual method would be, with the figure selected, to merge the pose preset into the scene.

  • xop32xop32 Posts: 0

    i had made very small amount of progress

    i have open the file ok
    i have detected the character ok

    i am now stuck on how to change the pose of the charctaer to one stored on my computer

    and finally saving the resulting file

    the pose i want to change to is

    labeled = MTW Tac Knife Standing 03 G8F

    location = D:\3D-MODELS\D-DAZ3D Libary\People\Genesis 8 Female\Poses\Polish\Military Tactical Weapons\Poses


    heres the updated code

    var oContentMgr = App.getContentMgr();// Open the fileoContentMgr.openFile("C:/Users/me/Documents/DAZ 3D/Studio/My Library/Scenes/RENDER-SCENCES/Amatera-8.1-cyborg/character/clothing/pose4/pose4-clothing-set5.duf", true);// Get the main character node by its namevar mainCharacter = Scene.findNodeByLabel("Amatera 8.1 Cyborg HD");// Check if the main character node was foundif (mainCharacter !== null) {    // Print a confirmation message    print("Main character found in the scene.");        // Change pose to a predefined pose named "MTW Tac Knife Standing 03 G8F"    mainCharacter.setPose("MTW Tac Knife Standing 03 G8F");        // Save the modified scene to a new file    var newFilePath = "C:/Users/me/Documents/DAZ 3D/Studio/My Library/Scenes/RENDER-SCENCES/Amatera-8.1-cyborg/character/clothing/pose5/pose5-clothing-set5.duf";    App.saveSceneAs(newFilePath);} else {    print("Main character not found in the scene.");}


  • xop32xop32 Posts: 0

    hello richard

    i did in fact find the character after opening it up by the label method, so we end up have the scene open, the charcater now selected, this is where i am now stuck

    what api/obeject referance would i need to use to apply a pose to the character in the scene after selecting it?

    any pointers to the correct why to to this would be great

    and also the last part of simply saving it after apply the pose


    i got the script setPose() out of chatgpt, but it seems to be completly useless and scripting in the daz studio ide, i think its just doing generic naming as its not up to speed on  daz scipting

    by the way i am new to scripting in daz this is my first attempt at creating this simple script that will be a real time saver for me instead of having to manually open hunderds of files and change poses and save etc


  • xop32xop32 Posts: 0

    how do i merge the pose preset into the scene.


    i have the character selected

  • Richard HaseltineRichard Haseltine Posts: 98,312

    ChatGPT is pretty unhelpful - its previous offering for DS scripting have included a Python script. Inventing methods that don't exist is no surprise. It seems to be excellent at rehashing what has already been written, and interpolating, but not for things where there is not a wealth of relevant, pre-existing material from which it can gernate probabilities.

    Merge is in fact the default for OpenFile (or OpenNativeFile, but the former is the prefered option) so you don't need to do anything but open the pose preset with the figure selected in the scene (if it isn't use true ); from DzNode )

  • OmnifluxOmniflux Posts: 366

    Example script attached.

    Change the variables at the top of the script to this:

    	var loadFile = 'C:/Users/me/Documents/DAZ 3D/Studio/My Library/RENDER-SCENCES/Amatera-8.1-cyborg/character/clothing/pose4/pose4-clothing-set5.duf';
    	var mergeFile = 'D:/3D-MODELS/D-DAZ3D Libary/People/Genesis 8 Female/Poses/Polish/Military Tactical Weapons/Poses/MTW Tac Knife Standing 03 G8F.duf';
    	var saveFile = loadFile;
    	var nodeLabel = 'Amatera 8.1 Cyborg HD';
    Load Merge Save Example.dsa
Sign In or Register to comment.