'On error resume next Dim obj,sel,dim_u,dim_v,con_u,con_v,rat,sig,per Dim arrPlane,trm,pln,cls,pts,pte,msg Dim arrKnots, arrVector,kno sel=Rhino.SelectedObjects main1 if IsArray(sel) then Rhino.SelectObjects sel end if Function main1 arrPlane = Rhino.ViewCplane Do obj=Rhino.GetObject("線面情報 線か面を選択 ",_ 4+8,True,True) If IsNull(obj) Then Exit Function ElseIf Rhino.IsCurve (obj) Then dim_u=Rhino.CurveDegree(obj) con_u=Rhino.CurvePointCount(obj) pts=Rhino.XformWorldToCPlane _ (Rhino.CurveStartPoint(obj), arrPlane) pte=Rhino.XformWorldToCPlane _ (Rhino.CurveEndPoint(obj), arrPlane) arrKnots = Rhino.CurveKnots(obj) kno="ノット値: [" For i=0 To UBound(arrKnots) kno=kno & " " & round(arrKnots(i),3) If i< UBound(arrKnots) Then kno=kno & "," End If Next kno=kno & "]" & vbcrlf msg="" &_ "次 数 :" & dim_u & vbcrlf &_ "制御点数 :" & con_u & vbcrlf &_ "始 点 :" & Rhino.Pt2Str(pts,3) & vbcrlf &_ "終 点 :" & Rhino.Pt2Str(pte,3) & vbcrlf If Rhino.IsCurveRational(obj) Then msg=msg & "有理で" Else msg=msg & "非有理で" End If If Rhino.IsCurvePeriodic(obj) Then msg=msg & "周期な" Else msg=msg & "非周期な" End If If Rhino.IsCurveClosed(obj) Then msg=msg & "閉じた" Else msg=msg & "開いた" End If If Rhino.IsCircle(obj) Then msg=msg & "円" ElseIf Rhino.IsArc(obj) Then msg=msg & "円弧" ElseIf Rhino.Isline(obj) Then msg=msg & "直線" ElseIf Rhino.IsEllipse(obj) Then msg=msg & "楕円" ElseIf Rhino.IsPolyline(obj) Then msg=msg & "ポリライン" ElseIf Rhino.IsPolyCurve(obj) Then msg=msg & "ポリカーブ" Else msg=msg & "カーブ" End If msg=msg & vbcrlf & kno 'Rhino.MessageBox msg,0,"線情報" Rhino.TextOut msg,"線情報" ElseIf Rhino.IsSurface (obj) Then dim_u=CStr(Rhino.SurfaceDegree(obj, 0)) dim_v=CStr(Rhino.SurfaceDegree(obj, 1)) con_u=Rhino.SurfacePointCount(obj)(0) con_v=Rhino.SurfacePointCount(obj)(1) If Rhino.IsSurfaceRational(obj) Then rat="有理な面" Else rat="非有理な面" End If sig="" If Rhino.IsSurfaceSingular(obj,1) Then sig="東" End If If Rhino.IsSurfaceSingular(obj,3) Then sig="西" End If If Rhino.IsSurfaceSingular(obj,0) Then sig="南" End If If Rhino.IsSurfaceSingular(obj,2) Then sig="北" End If If sig="" Then sig="特異点無し" Else sig=sig & "に特異点" End If If Rhino.IsSurfacePeriodic(obj,0) And _ Rhino.IsSurfacePeriodic(obj,1) Then per="U方向V方向に周期な面" ElseIf Rhino.IsSurfacePeriodic(obj,0) Then per="U方向に周期な面" ElseIf Rhino.IsSurfacePeriodic(obj,1) Then per="V方向に周期な面" Else per="非周期な面" End If If Rhino.IsSurfaceClosed(obj,0) And _ Rhino.IsSurfaceClosed(obj,1) Then cls="U方向V方向に閉じた面" ElseIf Rhino.IsSurfaceClosed(obj,0) Then cls="U方向に閉じた面" ElseIf Rhino.IsSurfaceClosed(obj,1) Then cls="V方向に閉じた面" Else cls="開いた面" End If If Rhino.IsSurfacePlanar(obj) Then pln="平面" Else pln="非平面" End If If Rhino.IsSurfaceTrimmed(obj) Then trm="トリム面" Else trm="非トリム面" End If arrKnots = Rhino.SurfaceKnots(obj) If IsArray(arrKnots) Then arrVector = arrKnots(0) kno="U方向ノット値" & vbcrlf &_ "U: [" For i = 0 To UBound(arrVector) kno=kno & " " & round(arrVector(i),3) If i< UBound(arrVector) Then kno=kno & "," End If Next kno=kno & "]" & vbcrlf arrVector = arrKnots(1) kno= kno & "V方向ノット値" & vbcrlf &_ "V: [" For i = 0 To UBound(arrVector) kno= kno & " " & round(arrVector(i),3) If i< UBound(arrVector) Then kno=kno & "," End If Next kno=kno & "]" & vbcrlf End If msg="" &_ "次 数 U: " & dim_u &_ " V: " & dim_v & vbcrlf &_ "制御点数 U: " & con_u &_ " V: " & con_v & vbcrlf &_ rat & vbcrlf &_ sig & vbcrlf &_ per & vbcrlf &_ cls & vbcrlf &_ pln & vbcrlf &_ trm & vbcrlf &_ kno & vbcrlf Rhino.TextOut msg,"面情報" 'Rhino.MessageBox msg,0,"面情報" End If Rhino.UnselectAllObjects Loop End Function