Notifications
Clear all

[Closed] Centerpivot or $.pos doesn’t work when running from batch

Hello,

I have a script that needs to move a group to 0,0,0.
I found the code that doing this code and it’s perfect, but when running from batch file it just stays at the original place (both pivot and group position). When running the script normally within max it’s fine.

I know it’s a really weird problem.
Thanks in advance

8 Replies

Can you show us the code you’ve got? There’s nothing special about centering pivot or moving a group to 0,0,0 so the problem will probably be easy to solve if you show the code you’re running

The code that doesn’t work is centerpivot and $.pos=[0,0,0]
It’s just not Hapenning when running the script from batch file. When running from max it’s perfect. The script also imports FBX tiles and put them in group but that works in both cases…

$ represents current selection.
I’m 99% sure that when you load your scene $ is undefined and you have nothing selected and thus nothing is centered as a result.

99.99% – that you are right

No. $.pos was just an example, I’m putting an object in a variable and then I do that.
As I said, when running this script on empty max scene it’s working perfect, but from batch file not.

You may want to bear in mind that this is not an official Autodesk forum, so those of us who decide to contribute do expend the time we could use for other things trying to help. In that sense, what you want is to shorten the time we have to expend to understand and solve a given problem.

Being said that, it is imperative that you contribute as much as you can to your own cause.
That could include:

  • The best possible description of the problem
  • The used Max version
  • The code that has problems
  • The complete procedure to reproduce the problem
  • If there are files involved, the file/s in question (might not be your case)

You can’t share the code or a file?
Take the time to create one that serves to your purposes.

@threedian asked you to show the problematic code and your answer was:

The code that doesn’t work is centerpivot and $.pos=[0,0,0]

@Serejah and @denisT gave you a clue of what may be happening and your answer was:

No. $.pos was just an example, I’m putting an object in a variable and then I do that.

Based on your last post, it seems that $.pos is not the problem, as you previously stated. So the question remains open, what is the problematic code and procedure?

Is there a way we can reproduce this behavior without having to expend half an hour trying to recreate what we can deduct from the bare given description?

@tomerr173

you ask us – “I was seating, eating chips, watching TV, and suddenly the sound disappeared. What happened?”

How can we answer you, if you did not tell us that at this moment, when the sound disappeared, you not only watched and ate chips, but also picked at the ear with a screwdriver?

I needed to do 3 things:

Import FBX files and group them

Move the group pivot to center of object and the position to 0,0,0

Use cameras to render.

If I’m doing it all together it’s fine. But when launching the script from batch the second action doesn’t happen. The group stays where it was.
After trying to play with every part of the code (for example, tried to change cameras position but when running all together from batch it doesn’t work). I just used a rollout and clicked a button to separate the processes…

Thanks anyway