Jump to content
Developer Wiki and Function Reference Links ×

2DPlan View


Recommended Posts

Link

Prevailing wisdom is to avoid global view changes from within a VSO, which is probably why the functions you're looking for aren't there. Object creation shouldn't be view dependant. Objects should be created based on the internal co-ordinates of the PIO. Assuming that this is related to your post below, you need to rotate the object instead of the view, do your work and rotate everything back. Or find other ways to draw the mirrored object directly.

VSMenu is different. Here you may be able to use VSave('a name') and VRestore('a name'). Other strategies invlolve GetView() and SetView(). It may be possible to use these within a VSO, but can be unpredictable depending on the user view when editing params. You're also programing all kinds of view changes every time an object is regenerated/edited.

It may seem like a lot of extra work up front, but it's best in the end.

Later

Charles

Link to comment

I now uses getview and setview and it works fine, the only thing is that when the document was in plan view, i get a top view after the script. The reason why i want to use this is the following:

i need to mirror different 3D objects at the same time. there is no command that does this so i use fliphorizontal or flipvertical and these are viewdependant. so i must set the view to top view or plan view.

maybe this is something for the wish list? mirror selected objects in 3D?

Link to comment
I now uses getview and setview and it works fine, the only thing is that when the document was in plan view, i get a top view after the script.

There's the rub. You might solve that with

GetView(xAngleR, yAngelR, zAngleR, offsetX, offsetY, offsetZ);

SetView(0, 0, 0, 0, 0, 0)

SetView(xAngleR, yAngelR, zAngleR, offsetX, offsetY, offsetZ);

Or maybe not...

Link to comment

That's just it. I don't think you can tell the difference. GetView() returns all zeros for either 2d plan or 3d top.

And because of this, the only way to set 2d Plan view is to use DoMenu.

So you can have a script that restores to 2d Plan if you're in either 3dTop or 2dPlan. Or you can have one that restores to 3dTop if you're in either of those views. But I don't think you can have both.

To always get 2dPlan from an overhead view, Link could use something like:

GetView(xAngleR, yAngleR, zAngleR, offsetX, offsetY, offsetZ);

IF (xAngleR<>0) OR (yAngleR<>0) OR (zAngleR<>0) OR (offsetX<>0) OR

(offsetY<>0) OR (offsetZ<>0)

THEN

SetView(xAngleR, yAngleR, zAngleR, offsetX, offsetY, offsetZ)

ELSE DoMenuTextByName('Standard Views',1);

Or he can do what he's doing to always return to 3dTop from an overhead view.

Or he can find another way to do his object creation/mirror that doesn't require a view change. If possible it's best to avoid both view changes and menu commands in vScript objects.

Link to comment
I now uses getview and setview and it works fine, the only thing is that when the document was in plan view, i get a top view after the script.

There's the rub. You might solve that with

GetView(xAngleR, yAngelR, zAngleR, offsetX, offsetY, offsetZ);

SetView(0, 0, 0, 0, 0, 0)

SetView(xAngleR, yAngelR, zAngleR, offsetX, offsetY, offsetZ);

Or maybe not...

That's what i do now

I guesse that i need to follow ccroft's advice and write my plugin without changing the view, and that means 100 lines instead of 10. I just want to keep code clean and short

Link to comment

Back in version 8 they used to ship a book called Custom Solutions, and in the section on PIO's they gave a list of object creation rules and recommendations. Here they say never change views, and never use menu commands, among other things. So PIO's aren't really designed to use view changes.

We all like our code to be trim and efficient, but 100 lines isn't long and in the end you will presumably have a better plug-in.

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...