align 3d view to surface
All  1-3  4-9

Previous
Next
 From:  Michael Gibson
9607.4 In reply to 9607.3 
Hi Quaritexa, it's pretty close. One thing is put the script: label at the very start, then you can put the /* */ comment after that.

For rotation maybe the only way currently is by the tiltAngle property.

I'll see about adding in a new method that takes a camera, target, and also an "up" direction vector. I think you can get a viewport's "up" direction from cameraFrame.yaxis but there isn't a way to set it directly. I think the tiltAngle should be an angle value that is how much the current up direction is rotated away from the world z axis.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9607.5 In reply to 9607.3 
Try this one, it seems to be very slightly off I'm not sure why at the moment:

script: /* Align 3D view to surface */ var vp = moi.ui.mainWindow.ViewPanel.getViewport('3D'), cp = moi.view.getCPlane(); moi.view.setCPlaneInteractive(); var vt = moi.ui.mainWindow.viewPanel.getViewport('top'); vp.targetPt = vt.targetPt; vp.setAngles(vt.upDownAngle, vt.leftRightAngle, vt.tiltAngle); vp.Projection = 'Parallel'; moi.view.setCplane(cp, true, true);

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  vector illustrator (QUARITEXA)
9607.6 In reply to 9607.5 
With this script the 3D view differs from the top view:

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9607.7 In reply to 9607.6 
Hi Quaritexa, I think the problem is the target point on the 2D views is not used for anything and so is not getting set. So get the target point through some other way instead of from the top view.

For the angle getting the tilt angle from the Top view and setting it as the 3D view's tilt angle seems to work, try this one:

script: /* Align 3D view to surface */ var vp = moi.ui.mainWindow.ViewPanel.getViewport('3D'), cp = moi.view.getCPlane(); moi.view.setCPlaneInteractive(); var vt = moi.ui.mainWindow.viewPanel.getViewport('top'); vp.setCameraAndTarget(vt.cameraPt, moi.view.getCPlane().origin); vp.tiltAngle = vt.tiltAngle; vp.Projection = 'Parallel'; moi.view.setCplane(cp, true, true);

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9607.8 In reply to 9607.6 
Hi Quaritexa, ok so yes the problem is that when setting the cplane the ortho view's target point did not get updated. MoI does not use the target point on the Top/Front/Right views for anything so that's why it went previously unnoticed.

I've fixed that now for the next v4 beta and also I've added in an optional additional parameter to vp.setCameraAndTarget() so it can take an "up" direction vector to set the view rotation around the camera->target line. So that will be an additional way to control it.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  vector illustrator (QUARITEXA)
9607.9 In reply to 9607.7 
Thank you very much, Michael. That's exactly what I need.

That's how it works:

EDITED: 8 Dec 2019 by QUARITEXA

Image Attachments:
Size: 1.9 MB, Downloaded: 131 times, Dimensions: 974x696px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-3  4-9