joshtreverton Posted April 19, 2013 Share Posted April 19, 2013 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 Quote Link to comment
maarten. Posted April 19, 2013 Share Posted April 19, 2013 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. Quote Link to comment
joshtreverton Posted April 19, 2013 Author Share Posted April 19, 2013 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 Quote Link to comment
Hippocode Posted April 19, 2013 Share Posted April 19, 2013 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 ? Quote Link to comment
maarten. Posted April 19, 2013 Share Posted April 19, 2013 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". Quote Link to comment
joshtreverton Posted April 19, 2013 Author Share Posted April 19, 2013 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! Quote Link to comment
Hippocode Posted April 19, 2013 Share Posted April 19, 2013 for future searches, for every SET function there is also a GET function in the same categorie on http://developer.vectorworks.net Quote Link to comment
joshtreverton Posted April 19, 2013 Author Share Posted April 19, 2013 (edited) 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 April 19, 2013 by joshtreverton Quote Link to comment
Miguel Barrera Posted April 19, 2013 Share Posted April 19, 2013 Make sure you use Move3DObj instead of HMove, which moves only along the 2D screen x,y coordinates. Quote Link to comment
JBenghiat Posted April 19, 2013 Share Posted April 19, 2013 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. Quote Link to comment
C. Andrew Dunning Posted April 20, 2013 Share Posted April 20, 2013 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... Quote Link to comment
joshtreverton Posted April 22, 2013 Author Share Posted April 22, 2013 (edited) 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 April 22, 2013 by joshtreverton Quote Link to comment
Recommended Posts
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.