Grasshopper

algorithmic modeling for Rhino

Hello all,

I'm working on legend display with the add-on "Human".

With that add-on, I can float text and colored mesh on the viewport. You can see my process on the attached image file.

What I want to do is, to explore viewport with MD slider. In fact, I did partially, but I have to input resolution x-y pixels of current viewport.

If I can get the resolution of current active viewport dynimically, it'll be really helpful for me. Unfortunately, I have no experience on VB or C# components. I need somebody to make those custom componets to get resolution.

Thanks for reading my question. I'll wait for your reply.

Views: 987

Replies to This Discussion

You could use something like this:

  private void RunScript(string vp, ref object Height, ref object Width, ref object Viewport)
  {
    var view = RhinoDoc.ActiveDoc.Views.Find(vp, false);
    if (view == null)
    {
      view = RhinoDoc.ActiveDoc.Views.ActiveView;
    }
    Height = view.ActiveViewport.Bounds.Height;
    Width = view.ActiveViewport.Bounds.Width;
    Viewport = view.ActiveViewport.Name;
  }

Attachments:

Thanks Arend! it's really helpful.

I input "Button" component instead of viewport's name. :)

Hey, it should work as long as you don't have a viewport called "True" or "False".

XD

Hey Arend,

Thanks for sharing, I haven't got to C# yet, but I could tweak it a bit, hope that's okay with you. Now it is beautiful. XD

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service