PointStyle in Python Common


#1

Hi Steve
I want to draw a dinamic point with style an radius
DrawPoint(self: DisplayPipeline, point: Point3d, style: PointStyle, radius: int, color: Color).
args.Display.DrawPoint(point,arc_color) is Ok , but I can not set PointStyle and radius
Ciao Vittorio


(Dale Fugier) #2

Hi Vittorio,

Can you provide some code that is not working for you?

Thanks,

– Dale


#3

Hi Dale
I attached the code.
Ciao Vittorio
DisegnaLineaDinamica_2.py(1.9 KB)


(Steve Baer) #4

Hi Vittorio,
Sorry for taking so long to reply to this post. Here’s a short version of your sample that uses PointStyle to draw the points

#-*- encoding: utf-8 -*-
# A Rhino GetPoint that performs some custom dynamic drawing
#  Versione ridotta all'osso 
import Rhino
import System.Drawing.Color
import scriptcontext
import rhinoscriptsyntax as rs

def lineeDinamiche():
    # Assegna attributi alle linee come colore e spessore ecc.
    line_color = System.Drawing.Color.FromArgb(255,255,0) 
    point_color=System.Drawing.Color.White
    pt_start=rs.GetPoint("p start linea")  # con metodo script     

    #************** funzione che disegna dinamicamente *********************
    def GetPointDynamicDrawFunc( sender, args ): 
        line=Rhino.Geometry.Line(pt_start,args.CurrentPoint)
        args.Display.DrawLine(line,line_color,1)        
        pm= (pt_start+args.CurrentPoint)/2
        #here's the four different point styles you can use
        #uncomment each one to see how they are different
        #args.Display.DrawPoint(pm,Rhino.Display.PointStyle.ActivePoint,5,point_color)
        #args.Display.DrawPoint(pm,Rhino.Display.PointStyle.ControlPoint,5,point_color)
        #args.Display.DrawPoint(pm,Rhino.Display.PointStyle.Simple,5,point_color)
        args.Display.DrawPoint(pm,Rhino.Display.PointStyle.X,5,point_color)

    gp = Rhino.Input.Custom.GetPoint()#creo oggetto gp    
    gp.DynamicDraw += GetPointDynamicDrawFunc  # chiamo in continuazione la funzione che mi mostra la linea dinamica
    gp.Get()   # qui ottengo i dati quando clicco     

lineeDinamiche()

#5

Hi Steve
Many thanks, but where is located pointstyle property ?
iao Vittorio


(Steve Baer) #6

PointStyle is an enumeration of four possible “styles” that a point can be drawn with in RhinoCommon
Documentation on this enumeration is at
http://4.rhino3d.com/5/rhinocommon/html/T_Rhino_Display_PointStyle.htm