Grasshopper

algorithmic modeling for Rhino

Hi,

I am trying to display polyline geometry via C#.

just want to change the line thickness. Everything is good, when I look from "top view". But when I rotate the camera manually in Rhino Viewport, the displayed geometry is being cut from top and bottom.

How can I solve this issue? I attached image for explanation and grasshopper file.

For display I use following code:

  private void RunScript(Point3d point, ref object A)
  {

    //Calling trail function to limit "pts" list.
    trail();

    //Incrementing point list
    pts.Add(point);

    //Adding points to polyline variable
    pline.Clear();
    pline.AddRange(pts.ToArray());

  }

  // <Custom additional code> 

  //Variables
  List<Point3d> pts = new List<Point3d>();
  Polyline pline = new Polyline();
  int limit = 2550;

  //Function to limit the size of points
  public void trail(){

    if(pts.Count > limit){
      pts.RemoveAt(0);
    }
  }

  //Display
  public override void DrawViewportMeshes(IGH_PreviewArgs args) {
    args.Display.DrawPolyline(pline, Color.Black, 8);
  }

Views: 973

Attachments:

Replies to This Discussion

You need to override the clipping box property and return a bounding box which contains all of your polyline geometry.

Thanks:) This seems to work

// <Custom additional code> 

//Variable

BoundingBox _clippingBox;

//Override bounding box
public override void BeforeRunScript()
{
_clippingBox = BoundingBox.Empty;
}

public override BoundingBox ClippingBox
{
get { return _clippingBox; }
}

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