Grasshopper

algorithmic modeling for Rhino

Hello people,

I have almost finished a definition for presentations as prezi, with which presentations of 2D images with a camera that can zoom in and out of them. With grasshopper can be done in 3d and generative backgrounds, much more interesting than prezi. This is something I tried when I had to deliver class projects, but I could not finish because of time, but now I'm on vacation and want to finish it and share it.

The problem is a camera in vb. With all the fonts: rhinocommonSDK. rhinoDotNet old examples, development microsoft ... I am not capable of two things:


- Set up vector of the camera.


- And the minimum distance from the target to the location of the camera to display the entire image (or all BoundingBox for 3D objects). Methods related to this are DollyExtends, ZoomToScreenRect or ZoomExtends, but I can not build it from this code:

doc.Views.ActiveView.ActiveViewport.SetCameraLocations (tar, cam)


There are no examples for this, so I hope someone can help me, the problem is the code that I have and my ignorance in scripting.

Attachment the reduced file for this case.

Views: 921

Attachments:

Replies to This Discussion

I think doc is legacy and we should use RhinoDocument to get the Rhino document in a scripting component.

You have RhinoDocument.Views.ActiveView.ActiveViewport.ZoomExtents(). Just add the line after the setcameralocations line. This will zoom extent all visible objects including Grasshopper ones. I'm not sure why using zoom extent with Grasshopper zooms out too much.

You probably want RhinoDocument.Views.ActiveView.ActiveViewport.ZoomBoundingBox(box As BoundingBox). This will zoom extents to a given bounding box which you can create easily with Grasshopper of inside a VB component.

Hi Dani, Hi Vicente,
I think you want CameraUp as in doc.Views.ActiveView.ActiveViewport.CameraUp 
though it's still working for me, I just learned that it should be
RhinoDocument.Views.ActiveView.ActiveViewport.CameraUp
Thanks Vicente:)

Ah, forgot to answer the first question. But I think he wants CameraDirection rather than CameraUp (to get the direction the camera is looking).

To set the camera direction you can use .SetCameraDirection(Vector3d.XAxis, true)

Thanks Vincent and Pieter :)

thing I needed was the camera up, but the line RhinoDocument.Views.ActiveView.ActiveViewport.CameraUp

gives me error: access should asisgnarse property to property or use its value.

What does this error mean and how to solve it?

Hi Dani, I guess it means you wrote
RhinoDocument.Views.ActiveView.ActiveViewport.CameraUp(up) when you should have written RhinoDocument.Views.ActiveView.ActiveViewport.CameraUp = up

Thanks :)

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service