View Full Version : are grid views available through maxscript?
antonv 05-01-2006, 06:06 PM Hi all,
I was trying to set the views for grids but the only one I found is top view. Am I missing something in the reference or is it not possible?
If you right click on the viewport's name and go to grid you have access to all but nothing is displayed in the listener when changing...
Any ideas?
Thanks!
Anton
|
|
_stev_
05-01-2006, 06:44 PM
viewport.setGridVisibility <viewport> <state>
<viewport> is the viewport number, and <state> is true or false.
Just type viewport into the listner and you'll see the structure functions available.
Stev
antonv
05-01-2006, 07:12 PM
Thanks _stev_ but I wasn't looking for that. I wasn't clear in my previuous post!
What I am looking for is to set the view in a viewport to say to "front", "back", "left", "right" etc. but for the active grid not for the home grid. The only one that i found is the top view by doing this:
viewport.setType #view_grid
And I was wondering if it is possible to set the others as well!
Thanks,
Anton
Deadalus
05-01-2006, 07:14 PM
$viewport.setgridvisibility = bool (true or false )
this will make the grid visible for the selected viewport.
_stev_
05-01-2006, 07:54 PM
Thanks _stev_ but I wasn't looking for that. I wasn't clear in my previuous post!
What I am looking for is to set the view in a viewport to say to "front", "back", "left", "right" etc. but for the active grid not for the home grid. The only one that i found is the top view by doing this:
What about these?
viewport.setType #view_Front
viewport.setType #view_Back
viewport.setType #view_Left
viewport.setType #view_Right
viewport.setType #view_Bottom
viewport.setType #view_Top
antonv
05-01-2006, 08:09 PM
_stev_, those are for the home grid. But if you have a custom grid then you cannot do it like that!
Try creating a custom grid and make it active. Then try those commands and the'll give you the views for the home grid!
_stev_
05-01-2006, 09:13 PM
Ah, now I know exactly what you mean. I'm not sure if you can do that. Sorry.
Stev
magicm
05-01-2006, 11:27 PM
viewport.setType operates on the current active viewport. To set all viewports to grid, you could try:
for v = 1 to viewport.numViews do
(
viewport.activeViewport = v
viewport.setType #view_grid
)
Martijn
magicm
05-02-2006, 06:01 PM
Argh! forget the above.. Sorry I didn't read your question properly either..
I think that these grid types are indeed not accessible through maxscript.. I guess it should be relatively easy for a C programmer to write a maxscript extension for this though. Try posting your question on the Autodesk forums, maybe an SDK expert chimes in.
Cheers,
Martijn
antonv
05-02-2006, 08:00 PM
Thanks for the tip Martjin. I figured a workaround and probably tonight I'll have the time to finalize it.
There is a set of commands for viewport that allow you to set the transform matrix for the view and if you assign it the inverse of the transform matrix of the agtive grid it will give you the top view for that grid. The rest is pretty easy if you have some knowledge of how to rotate the TM of the grid to give you all the other views.
Here is the line to get the topview of the active grid:
viewport.setTM (inverse(activegrid.transform))
magicm
05-02-2006, 08:44 PM
Here is the line to get the topview of the active grid:
viewport.setTM (inverse(activegrid.transform))
Yeah that's what I came up with as well. Although it's not exactly the same thing as using the viewport menu it does align the view to the grid.
I had some spare time so I wrote a simple macroscript. Right now it shows a popupmenu with the view types, but feel free to rip out the function that does the actual work, and adjust it to your needs.
Cheers,
Martijn
antonv
05-03-2006, 05:39 PM
Thanks Martjin, that helped!
The issue I have right now is that in all those views you cannot draw... So I guess your previus idea about the C++ extension is my last resort.
Thanks for the help guys!
Anton
CGTalk Moderation
05-03-2006, 05:39 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.