ok i made 2 python scripts yesterday, and i put them in button…
when i launch the first one it’s ok, the second, it’s ok too…
but if i launch again the first one, my display turns off and on again with a change, like when my pc dis the display driver …
can you try my script on your rhino, put them in a new button…
! _-RunPythonScript (
# coding: utf-8
import Rhino as rc
import rhinoscriptsyntax as rs
def GeneratePt(Diam,Delta):
#definition du centre du polygone
Center=rc.Geometry.Point3d(Delta/2+Diam/2,Delta/2+Diam/2,0)
Pts=[]
Pts.append(rc.Geometry.Point3d(0,Delta+Diam,0))
Pts.append(rc.Geometry.Point3d(Delta/2+Diam/2,Delta+Diam,0))
Pts.append(rc.Geometry.Point3d(Delta/2+Diam/2,Delta/2+Diam,0))
for i in range(1,13):
#create the transform
xform=rs.XformRotation2(i*(360/12),rs.ViewCPlane().Normal,Center)
#transform le dernier point realise
Pts.append(rs.PointTransform(Pts[2],xform))
Pts.append(rc.Geometry.Point3d(Delta/2+Diam/2,Delta+Diam,0))
Pts.append(rc.Geometry.Point3d(Delta+Diam,Delta+Diam,0))
return Pts
Diam=rs.GetInteger('Diamètre à découper',15)
Delta=rs.GetInteger('Décalage de la forme',6)
PtTraj=GeneratePt(Diam,Delta)
rs.AddPolyline(PtTraj)
)
! _-RunPythonScript (
# coding: utf-8
import Rhino as rc
import rhinoscriptsyntax as rs
import math
DimX=rs.GetInteger('dimension du bloc en X',200)
if DimX:DimY=rs.GetInteger('dimension du bloc en Y',200)
if DimY:Traj=rs.GetObject('Selectionne la trajectoire a repeter',rs.filter.curve)
if Traj:DeltaX=rs.GetInteger('decalage en X',0)
DeltaY=rs.GetInteger('decalage en Y',5)
#boite englobante Traj
if Traj:
box = rs.BoundingBox(Traj)
if box:
Trajx=box[2][0]-box[0][0]+DeltaX
Trajy=box[2][1]-box[0][1]+DeltaY
#Trace le Bloc
Bloc=rs.AddRectangle(rs.MovePlane(rs.WorldXYPlane(),box[3]), DimX, -DimY)
rs.ObjectColor( Bloc,(255,0,0))
#Nbre d'élement en X
Nbx=math.floor(DimX/Trajx)
#Nbre d'élement en y
Nby=math.floor(DimY/Trajy)
Nb=int(Nbx*Nby)
#récupère les points de la Traj
ListPts = rs.CurvePoints(Traj)
#création de la liste de point ptTraj
PtTraj=[]
#création de la ligne X
ListX=[]
for j in range(0,int(Nbx)):
ListTemp=[]
ajout_en_x=j*Trajx
for Pt in ListPts:
PtTemp=rc.Geometry.Point3d(Pt)
PtTemp[0]+=ajout_en_x
ListTemp.append(PtTemp)
ListX+=ListTemp