Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
joshtreverton

Set Views in Vectorscript

Recommended Posts

Hi All,

Just a quick vectorscript question, I am creating a plug-in which uses various sweeps and Move3D commands, to make the geometry perform correctly at the start of the script I have to reset the view and orientation using:

SetView(#0d,#0d,#0d,0,0,0);

however this is irritating for the end user, it there a way to copy the current view then set the view as (#0d,#0d,#0d,0,0,0) then at the end of the script return the back to the original view...

Cheers,

Josh

Share this post


Link to post

Are you really sure you need to switch the view to create the geometry? I believe that extrudes along (nurbs) path could do what you want without having to change the view.

I'm just asking because changing the view by a PIO is not such a good idea qua performance.

Share this post


Link to post

Maarten

Yeah I looked in to extruding along a nurbs path but found that the geometry doesn't load untill the end which meant that I couldn't add or subtract other objects with the extrude...

I just want to revert the view back to the start such that the end user doesn't need go back to their previous view once they change the plug-in...

cheerrs Josh

Share this post


Link to post

I've got no experience with 3D but,

If you really want your PIO to change the view you might consider making that optional, with a button or smth in your PIO. Otherwise it will do that on any change.

With GetView you should be able to load the current view, change it and revert it back afterwards ?

Share this post


Link to post

I believe the problem with GetView/SetView is that when you're in "2D/Plan" view, after the execution of your PIO, the view will be "Top".

Share this post


Link to post

Thanks Hip-Hop-othamus

The GetView function did exactly what I wanted without it affecting the sweeps ect... Cheers

p.s. Maarten you are right about the 2D/Plan view switching to Top, but it's a small price to pay really...

Problem solved!

Share this post


Link to post

It turns out that switching to SetView(0,0,0,0,0,0) then reverting back to the original view point works however it then messed up some of the geometry in the plug-in, especially geometry which is Duplicated and moved...

Has anyone had experience with this and how to fix it?

Edited by joshtreverton

Share this post


Link to post

Setting the view to top is generally still needed for path-related functions.

There are a few things you can do to speed things up.

Get the view: GetView(xAngleR,yAngleR,zAngleR, offsetX,offsetY,offsetZ);

Check the view first: If xAngleR,yAngleR,zAngleR are all 0 then don't change the view. You should also check the the projection GetProjection()

IF (Projection <> 6) & ((xAngleR<> 0) | (yAngleR<> 0) | (zAngleR<> 0)) THEN SetView()

You can also use SetPref(9873,TRUE) to prevent a screen redraw when the view is changed but then you MUST call SetPref(9873,FALSE) after you set the view back. You will see the largest speed increase in a 3D view from this.

Share this post


Link to post

Just adding a few thoughts:

1) Once I understood the orientation in which Sweeps are created within the PIO environment, I've never had view issues with them. I create the given Sweep and then use Set3DRot and Move3DObj to orient it and move it to where I want it.

2) Currently, the only two places in any of my PIOs in which I'm having to change the view are when I'm dealing with 3D arcs for ExtrudeAlongPath operations or when I'm dealing with Texture mapping on Meshes. Then, like Josh, I use GetView, GetRenderMode, and GetProjection to make the process invisible to the user.

3) I've found ExtrudeAlongPath to be very useful but I found 2 things to be a little confusing:

a) Creating EAP objects based on non-level NURBS paths can result in some odd "twisting" of the profile.

b) The EAP object is actually 3 objects - the extrude face and the 2 endcaps. So, if you create an EAP object and apply a texture to the LNewObj you'll only be grabbing the last endcap.

4) I can't recall having any 3D adding/subtracting issues and I know I've got both going on.

5) Miguel is right about making sure you're using Move3DObj instead of HMove. I do have 1 PIO in which using 1 or the other is view-dependant, but that is easy enough to trap.

I hope something in there is helpful to you...

Share this post


Link to post

Thanks for your responses guys,

I have used the SetProjection as you guys recommended, and have used Move3DObj instead of HMove, which made a small improovement...

However I have realised what was causing my problems:

Firstly, the hDuplicate function works in 2D not 3D so that is probably causing problems...

Secondly, The geometry is distorted when I have been duplicating an object then flipping it around a Locus, i.e.

Move3DObj(RHSarchitrave3D, ((PW/2)+SideJambThk), 0, 0);

LHSarchitrave3D := HDuplicate(RHSarchitrave3D,0,0);

DSelectAll;

SetSelect (LHSarchitrave3D);

Locus (0,0);

locHdl:= LNewObj;

FlipHor;

DelObject(locHdl);

does anyone know of a way around this? I am creating a PIO with curved geometry so it flipping around a Locus really is the only way that I can do some of the things that I want to do...

Edited by joshtreverton

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×