Grasshopper

algorithmic modeling for Rhino

import rhinoscriptsyntax as rs
import math

c1=rs.AddCircle((0,0,0),1)
p=rs.CurveAreaCentroid(c1)
while L>=100:
    c1=rs.ScaleObject(c1,p[0],1.2,True)
    L=rs.CurveLength(c1)
    print('the circle is too big')

 

 

i wanna sacle circle again and again ,entil the circlelength is too big.

thank you .

Views: 261

Replies to This Discussion

this can Help.
U = \pi \, d = 2 \pi \, r.
or recrusive way....
public Circle CircleCircumference(double startRadius, double Circumference, Point3d Center, double Thershold)
  {
    Circle CalcCircle = new Circle(Center, startRadius);
    double calcnew = CalcCircle.ToNurbsCurve().GetLength();
    double newradius = 0;
    if(calcnew < Circumference)
    {
      newradius = startRadius * (Circumference / calcnew);
    }
    else
    {
      newradius = startRadius * (calcnew / Circumference);
    }

    CalcCircle = new Circle(Center, newradius);
    if(Math.Abs(CalcCircle.ToNurbsCurve().GetLength() - Circumference) > Thershold)
    {
      CalcCircle = CircleCircumference(newradius, Circumference, Center, Thershold);
    }

    return CalcCircle;
  }

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service