@onlyforpeace wrote:
i would like to return by a script the angle between two planes, since this morning, i tried 5 or 6 kind of script, with rs.angle(), and rs.angle2, but it doesn’t match as i want.
my last script:def AnglePlanPlan(planT,planM): #uplanMDomain=rs.SurfaceDomain(planM,0) #vplanMDomain=rs.SurfaceDomain(planM,1) ptplanT=rs.EvaluatePlane(planT,[0,0]) ptplanM=rs.EvaluatePlane(planM,[0,0]) inter=rs.PlanePlaneIntersection(planT,planM) ptmid=(inter[0]+inter[1])/2 lineinter=rs.AddLine(inter[0],inter[1]) inter90=rs.RotateObject(lineinter,ptmid,90,planM.ZAxis) normal=rs.VectorCreate(inter[0],inter[1]) rotateplane=rs.RotatePlane(planM,90,rs.CurveEndPoint(inter90)-rs.CurveStartPoint(inter90)) #rs.AddRectangle(rotateplane,500,500) inter1A=rs.PlanePlaneIntersection(planT,rotateplane) inter2A=rs.PlanePlaneIntersection(planM,rotateplane) angle=rs.Angle(ptmid,inter1A[1],rotateplane) print angle return angle[0] def Plan(surf): Usurfdomain=rs.SurfaceDomain(surf,0) Vsurfdomain=rs.SurfaceDomain(surf,1) u=(Usurfdomain[0]+Usurfdomain[1])/2 v=(Vsurfdomain[0]+Vsurfdomain[1])/2 eval=rs.EvaluateSurface(surf,u,v) vect=rs.SurfaceNormal(surf,[u,v]) plan=rs.PlaneFromNormal(eval,vect) return plan def TAutomatique(): edge=rs.GetEdgeCurves('sélectionne le bord de surface à tenoner!',min_count=1,max_count=1) if edge== None:return surf=rs.GetSurfaceObject('selectionne la surface à mortaiser!') if surf==None:return planT=Plan(edge[0][1]) planM=Plan(surf[0]) angle=AnglePlanPlan(planT,planM) print angle rs.DeleteObject(edge[0][0]) pass if __name__ == "__main__": TAutomatique()
in fact i have 2 planar surfaces, and i want to return the angle between this 2 surfaces.
rs.angle2() always return the smallest angle, and rs.angle() return the angle on a plane, and it’s here where i stopped, i don’t find the good way for the construction of this plane, to return every time and every configuration the good angle
Posts: 1
Participants: 1