Get Curve Length

谁借莪1个温暖的怀抱¢ 2022-06-14 07:39 177阅读 0赞
  1. import rhinoscriptsyntax as rs
  2. def CurveLength():
  3. "Calculate the length of one or more curves"
  4. # Get the curve objects
  5. arrObjects = rs.GetObjects("Select Objects", rs.filter.curve, True, True)
  6. if( arrObjects==None ): return
  7. rs.UnselectObjects(arrObjects)
  8. length = 0.0
  9. count = 0
  10. for object in arrObjects:
  11. if rs.IsCurve(object):
  12. #Get the curve length
  13. length += rs.CurveLength(object)
  14. count += 1
  15. if (count>0):
  16. print "Curves selected:", count, " Total Length:", length
  17. # Check to see if this file is being executed as the "main" python
  18. # script instead of being used as a module by some other python script
  19. # This allows us to use the module which ever way we want.
  20. if( __name__ == "__main__" ):
  21. CurveLength()

发表评论

表情:
评论列表 (有 0 条评论,177人围观)

还没有评论,来说两句吧...

相关阅读

    相关 如何随机生成curve polygon

    可以使用编程语言实现随机生成多边形的方法。其中一种方法是在平面上随机生成一些点,然后使用这些点作为多边形的顶点。另外一种方法是在平面上随机生成控制点,然后使用这些控制点生成曲线