ZBrushCentral

Zbrush Import/Export Script

Hi guys

i dont have much info about scripting, I have this script for zbrush import/export, its for windows and I’m using Mac osx, i tried to use it on Mac but apparently only “Obj out”(export) works fine but the “Obj in”(import) Dosen’t work, can anyone help me to rewrite this script for Mac ? i tried it on windows and it worked fine.(btw i tried to fix it by changing the location of the folder to match Mac path )

Copy the 2 files into your Zplusg64, and the two button will show on your right button on you zbrush screen.

Thanks in advance !

I don’t think this can work on Mac at all in the current shape since paths seem to be a funny thing on the ZB OSX version (at least up to 4R8 which is the most recent one I’ve used). Just putting in a Mac filesystem path will not do in my experience.

You could try this:

Make a directory in your user folder to store the OBJ file in that does not contain spaces or special characters in the filename. Lets name it “/Users/alihh12/objs/” Put a valid obj file named “1.obj” there as well - in my experience the Mac version crashes instantly if you feed it a path that does not exist.

Then - I can’t test this atm but looking through my own mac-related ZStartup scripts - replace line 9 in your script with this one
[VarDef, Object1, “ZBRUSH_\objs\1.obj” ]

Make a symbolic link in your filesystem to the folder you just created in the ZBrush install directory. For that use Terminal(.app), “cd” to the ZB installation folder under /Applications and from that ZB directory use

ln -s /Users/alihh12/objs/ ./

That should create a symlink called “objs” right in the ZB folder. If you are unsure about what this does, check google to learn more or read this: https://www.howtogeek.com/297721/how-to-create-and-use-symbolic-links-aka-symlinks-on-a-mac/
Still from the ZB install directory use

ls -al

and check the output, you’ll see the symlink appearing in the file list like so objs@ -> /Users/alihh12/objs/ . In Finder it will look like a shortcut.

Now place your script where it’s supposed to be (and launch the application and see if it shakes out.

Here’s a revised version of the script. When you first press a button it will ask you for a file name. This is so you can set the file name and location to what you want. Once that’s set the buttons will export or import without more input. There’s also a third button called “Reset” which simply deletes the saved file path. Pressing one of the other buttons will then give you the file dialog again so you can choose a new name/location.

Be sure to delete the old version. The zscript text file is included in the zip.

ObjOut_rev.zip (2.95 KB)

HTH,ObjOut_rev.zip (2.95 KB)

Hey marcus

i tried your script but apparently there is a problem in it , when i tried to import or export the mac give me this message:

file error Sorry, the disk space is critically low. Please clear more disk space (by emptying the trash, deleting files, etc.) and then click OK to resume.

maybe its a path script problem ? btw i picked the folder location and followed your instruction and i do have a lot of space on my mac.

Thank you again for helping

sorry for my english

Hi,

I guess you are trying to use the script in an old version of ZBrush. It will only work with ZBrush 2018.1. (Upgrades are free to registered users.)

Thanks for the tips. I confirm it was a versioning issue.


Alexandra from W2C

Hi Marcus,
I tried your code in my script, it works quite well with obj, but when I try to replace it with ma file, I can’t export the file, there is a .ma file in the directory I choose but import, when it goes into maya nothing shows up.
The code I edited according to your file:
[RoutineDef,SetPath,
[If,[FileExists,[FileNameResolvePath,“ZPUBLIC_Temp/OBJpath.zvr”]],
[VarLoad,Object1,[FileNameResolvePath,“ZPUBLIC_Temp/OBJpath.zvr”]]
,//else
[If,md,
[VarSet, Object1,[FileNameAsk,“Maya (*.ma)|*.ma||”,“Model.obj”,“Please Save File…”]]
,
[VarSet, Object1,[FileNameAsk,“Maya (*.ma)|*.ma||”, ,“Please Open File…”]]
]
[If,[StrLength,Object1],
[VarSave,Object1,[FileNameResolvePath,“ZPUBLIC_Temp/OBJpath.zvr”]]
,//else exit if no file name
[Exit]
]
]
,md]

Hi @SonBX ,

For the Maya MA format, special code needs to be used for export as a template is used. (These are located in the ZStartup/ExportTamplates folder - the same method can be used for the GoZ and x3d formats.)
I have revised the script so that it will work for MA files.

MayaOutIn.txt (1.8 KB)

HTH,
Marcus

1 Like

Thank you very much, @marcus_civis!
It seems that saving a ghost file has to save a template before, I really didn’t know this before.
However there is one thing in your code, do you mean
[ISet, Tool:Export:Grp, 0 ]
instead of
[ISet, Preferences:ImportExport:Grp, 0 ]
Because when I look in “Preferences:ImportExport” there is no “Grp” tab.
There is one more problem when I try this, that is when I export the file from zbrush to Maya, the mesh is in the right position, but after I edit the mesh a bit (for example, remove the face) and import it back into zbrush, mesh is out of position…


Do you know if this problem is caused by exporting files from Maya or by importing ghost files into Zbrush?
Anyway, thank you very much!

My code is correct for ZBrush 2021.7 - the Export options have been moved.

I’ve no idea why you would get a change of position between Maya and ZBrush. But also I suggest you use GoZ to go between the programs - that’s what it is designed to do!

-Marcus

Yes i understand that!
However, I accidentally deleted the Goz folder and can’t reinstall it from within Zbrush, and I don’t know how to download and reinstall Goz. :frowning:
So I thought of writing a script that can transfer files between Zbrush and Maya.

You can reinstall GoZ like this:

  1. In the C:\Program Files\Pixologic\ZBrush 2021\Troubleshoot Help folder, run the GoZ_for_ZBrush_Installer_WIN.exe file. This will rebuild your GoZ installation.
  2. Start ZBrush and press Preferences>GoZ>Force reinstall. Make sure you choose the correct path for the application you want and make sure you select “Install”.
  3. If the application is not found then use the Preferences>GoZ>path to button to select the path. Make sure to select “Install” when the option appears.

I hope this helps,
Marcus

1 Like

Hi Marcus,
I have been trying your script for Obj Out revised and it works fine for the in portion but when I use the out it gives me the following message

Both the revised script and txt file are in the Zstartup Zplugins 64. This happens at home and out Uni accounts. I was wondering what I might be doing wrong? 2021.7.1 Zbrush.
Many thanks
Ant

Hi @Ant_Gregory,
these options has been moved from Tool:Export:Grp into Preferences:ImportExport:Grp

Hope this Helps
Nicolas

1 Like

Hi @Ant_Gregory,

Welcome to ZBC! :slight_smile:

Try this version:
ObjOutIn_2021.zip (3.0 KB)

Make sure you remove the previous version so that they don’t conflict!

HTH,
Marcus

1 Like

Be sure to delete the previously generated .zsc file.

1 Like

Many thanks for the welcome :slightly_smiling_face: and thank you for the new files they worked a treat.

1 Like

Where can I find the zsc file?
Thanks in advance…