Jump to content

Help with a script to set Render mode & Projection?!


Recommended Posts

I'm trying to write a script using DoMenuTextByName in order to switch to a normal perspective and OpenGL. This is because VW seems to ignore the default render mode and projection when I switch to a 3D view while in a group, and at some other times as well. However, no matter what syntax and menu names I try (I've checked the constants for this command), I get errors saying the menu cannot be found. Any pointers? Ideally the script would then also zoom to fit objects. Thanks!

 

Cheers,

Markus

Link to comment

Thanks JBenghiat, I gave this a try with no success (syntax copied below). Also, it seems like this function necessarily sets the view distance and crop dimensions, but I'd like to keep the ones that are already set prior to running the script...

 

PROCEDURE    ProjectionPerspectiveOpenGL;
BEGIN
Projection(1,11,5,-12,-12,12,12);
END;

RUN (ProjectionPerspectiveOpenGL);
 

And the syntax I was trying with DoMenuTextByName  was (I got these from Appendix H):

 

PROCEDURE    Perspective_OpenGL;
BEGIN
DoMenuTextByName('OpenGL Render Chunk',0);
DoMenuTextByName('Perspective Chunk',2);
END;

RUN (Perspective_OpenGL);

Link to comment
2 hours ago, Markus Barrera-Kolb said:

Thanks JBenghiat, I gave this a try with no success (syntax copied below). Also, it seems like this function necessarily sets the view distance and crop dimensions, but I'd like to keep the ones that are already set prior to running the script...

 

PROCEDURE    ProjectionPerspectiveOpenGL;
BEGIN
Projection(1,11,5,-12,-12,12,12);
END;

RUN (ProjectionPerspectiveOpenGL);
 

And the syntax I was trying with DoMenuTextByName  was (I got these from Appendix H):

 

PROCEDURE    Perspective_OpenGL;
BEGIN
DoMenuTextByName('OpenGL Render Chunk',0);
DoMenuTextByName('Perspective Chunk',2);
END;

RUN (Perspective_OpenGL);

 

There used to be a menu plugin that switched to perspective and OpenGL that I shared on the old forum. The links are all broken so I dug around in my archives to find it. It seems like some of the items numbers have changed in more recent versions. After some fiddling I could get this code to work -

 

DoMenuTextByName('Projection',5); {sets projection to normal perspective}
DoMenuTextByName('OpenGL Render Chunk',1); {sets rendering to OpenGL}

 

I've also attached the menu plugin as well. I used to put it into the right click contextual menu. It turns cropped perspective off, sets the projection to normal perspective and makes the Flyover Tool active.

Maybe someone else knows how to access the zoom settings to make it zoom to objects as well. I don't see any way to set the zoom in Vectorscript other than by percent.

 

Kevin

Perspective View.vsm

Link to comment

5a6a1b5985813_ScreenShot2018-01-25at09_41_19.thumb.png.d2898adf3ea2f681ac2b883e3c50048f.pngKevin, et al, 

 

I'm confused – I was working on my laptop at home yesterday when I got the script to work with DoMenuTextByName (see below). Today I installed the identical script on my machine at work, also running VW2018 SP2 with the same workspace, and it refuses to run, giving an error message saying that the menu cannot be found. I have no clue what's amiss... Any ideas? Thanks!

 

Cheers,

Markus

 

PROCEDURE PerspectiveOpenGL;
BEGIN
DoMenuTextByName('Projection',5);
DoMenuTextByName('OpenGL Render Chunk',1);
END;
RUN (PerspectiveOpenGL);

 

5a6a1b88ac576_ScreenShot2018-01-25at09_41_19.thumb.png.e3ea8dff2bed73c76684affac025a357.png

Edited by Markus Barrera-Kolb
Link to comment

Here is a script that uses the view functions, so it isn't workspace / menu dependent.  In addition to setting the projection, the script gets and restores the view and zoom and doesn't crop the perspective view.

 

This is in python to avoid the need to declare variables, but steps in VS would be exactly the same

 

import vs

varPerspectiveCropped = 127

xAngleR, yAngelR, zAngleR, offsetPt = vs.GetView()
zoom = vs.GetZoom()

vs.Projection(1, 11, 9.76, -1, -1, 1, 1)

vs.SetView(xAngleR, yAngelR, zAngleR, offsetPt[0], offsetPt[1], offsetPt[2])
vs.SetPref(varPerspectiveCropped, False)
vs.SetZoom(zoom)

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...