Page 1 of 1

RhinoScript and Maxwell

Posted: Wed Jul 24, 2013 5:46 pm
by kami
Is there a way to read the settings from the scene manager with rhino-script and/or change them?
Sorry, I did not find any overview of the commands.

What I am trying to do is to modify the render buttons so that they use a different path.
I want the normal render to point to a specific folder on my local drive and the the network render to export to a network location.
This would only mean a changement in the drive letter (D: for local renderings and S: for network renderings)

Re: RhinoScript and Maxwell

Posted: Thu Jul 25, 2013 6:43 am
by JDHill
I'm not sure (I am away from my machine) if this is exactly possible, but you may be able to use the Maxwell_OutputSettings (I think that is it) command to set the paths using separate toolbar buttons. Just check the various options on that command.

Re: RhinoScript and Maxwell

Posted: Thu Jul 25, 2013 11:28 am
by kami
I looked at that too, but the ScenePath and ImagePath there point to a different location than the settings in the Scene Manager -> Output -> Folder. That's why I thought it might not have any influence...
But when you change it via the Maxwell_OutputSettings it overwrites the Scene Manager Setting. So I'll try to make it work that way!

Re: RhinoScript and Maxwell

Posted: Thu Jul 25, 2013 4:25 pm
by kami
We got it working. I'll post the script later.
One additional question though: Is there any possibility to send a network job so that the "Send Dependencies" comes disabled? Is there a flag or something for that?

Re: RhinoScript and Maxwell

Posted: Fri Jul 26, 2013 1:55 am
by JDHill
I asked the developer, who says that no, there is no way to change that, except through the UI.

Re: RhinoScript and Maxwell

Posted: Fri Jul 26, 2013 12:05 pm
by kami
Ok, thank you for that info.

Concerning the script, I have one problem.
With strPath = Maxwell.Output.scenePath() I can get the current path, but only if it is set via the Maxwell_Outputsettings.
If it is changed in the UI of the scene manager, I cannot get the value which is standing there. Do you know if this is possible?
Why isn't the Maxwell_Outputsetting changing if I change the value there?

The whole script is looks like that at the moment:
Code: Select all
Call ChangeRenderPath()
Sub ChangeRenderPath()
	
	Dim Maxwell, strPath, strImagepath, strDefaultNetworkPath, strFileName, strImagename, strDrive
	
	strDrive = "S"
	strFileName = rhino.Documentname

	' create the ScriptObject
	Set Maxwell = CreateObject("Maxwell.Script.ScriptObject")
	' successfully created?
	If Maxwell Is Nothing Then
		Rhino.Print("Unable to create Maxwell.Script.ScriptObject.")
		Exit Sub
	End If
	' successfully connected?
	If Not Maxwell.IsConnected Then
		Rhino.Print("Unable to connect to the current Maxwell scene.")
		Exit Sub
	End If
	
	If Not isnull(strfilename) Then
		strFilename = replace(strfilename, "3dm", "")
	Else
		
		strfilename = CStr(Year(now) & Month(now) & Day(now))
			
	End If
	
	strDefaultNetworkPath = "S:\TESTRENDER\" & strfilename & "\"
	
	'Get default Maxwell render path
	strPath = Maxwell.Output.scenePath()
	
	
	If right(strPath, 11) = "default.mxs" Then
		
		Maxwell.Output.scenePath() = strDefaultNetworkPath
		
		
	ElseIf Left(strPath, 3) = "D:\" Then
		
		Maxwell.Output.scenepath() = Replace(strPath, "D:\", strDrive & ":\")
	
	ElseIf Left(strPath, 3) = "C:\" Then
		
		Maxwell.Output.scenepath() = Replace(strPath, "C:\", strDrive & ":\")
		
	Else Rhino.Print("Not a valid path.")
		
	End If
	
	'Rhino.Print("Path changed to: " & Maxwell.Output.scenePath())
	
End Sub

Re: RhinoScript and Maxwell

Posted: Sun Jul 28, 2013 7:24 am
by JDHill
kami wrote:Concerning the script, I have one problem.
With strPath = Maxwell.Output.scenePath() I can get the current path, but only if it is set via the Maxwell_Outputsettings.
If it is changed in the UI of the scene manager, I cannot get the value which is standing there. Do you know if this is possible?
Why isn't the Maxwell_Outputsetting changing if I change the value there?
I have looked into this, now. The problem is that ScenePath is returning a default-generated path, unless both scene name and folder have been set (Maxwell_OutputSettings sets both, if you give it a path with a filename, which is why it is working after you use that command). The reason is that I did not update the logic of the code in the script object when the dynamic output name-generation functions (append camera name, auto file-naming) were added -- I'll have to fix this so that you can read these when one or the other is not set.

Re: RhinoScript and Maxwell

Posted: Mon Jul 29, 2013 4:09 pm
by kami
It would be great, if that would work!

Re: RhinoScript and Maxwell

Posted: Fri Dec 06, 2013 9:55 am
by kami
Hi Jeremy
Looking forward to working with v3 soon, but I think I'll have to finish the old year with the older version to make sure every project finishes smoothly :)
In the meantime I was working on a script to automate certain procedures and didn't find any possibility to change some options in the plugins output page, as for example select/deselect the 'export instances' tick. would that be possible with the 3.0 version?
Or could you implement this in a future release?
Thanks,
Christoph

Re: RhinoScript and Maxwell

Posted: Fri Dec 06, 2013 3:17 pm
by JDHill
No, I haven't changed that part for V3, but yes, I can add more parameters in the future.

Re: RhinoScript and Maxwell

Posted: Sat Dec 07, 2013 9:53 am
by kami
thanks a lot. that would be great

Re: RhinoScript and Maxwell

Posted: Sat Dec 14, 2013 4:35 pm
by kami
We are currently working on a script that'll go through the whole 3d model library, unifiy it, clean it up and create new preview renderings of all objects (that was also the reason for the last request).
We stumbled across another commend we could not via the command line which would be: remove unused materials. Could you add a command line command for the as well?

We also talked about another issue concerning textures that have moved... I think this should work at the moment that when opening the file, he's browsing for any missing textures.
I remembered you once saying that this only works when opening a file via File -> Open and not if you would just double click on it in the explorer. I never understood why the way you open a file makes such a huge difference and think that a lot of users don't even know that. So wouldn't it make sense to have a command that'll look for missing textures when you want it too? And maybe not having it done automatically (which can result in a very long opening time for some files)?

Re: RhinoScript and Maxwell

Posted: Sat Dec 14, 2013 7:20 pm
by JDHill
Indeed, remove unused materials is done internally and not through a command; I'll put it on my list to change that. Regarding using File > Open, the reason why this makes a difference is that on Windows, the "open file" dialog sets the current directory for the process, to that of the chosen file. In my experience, using the most-recent list does not do that, in which case, any asset that is referenced relatively will not be able to be found.