@@ -114,15 +114,20 @@ def stop_server():
114114
115115 # Load buffered points into Rhino PointCloud
116116 if i_load and not sc .sticky [f'{ prefix } _prev_load' ]:
117- raw = sc .sticky .get (f'{ prefix } _cloud_buffer_raw' , [])
118- if raw :
119- pc = rg .PointCloud ()
120- for x , y , z , r , g , b in raw :
121- pc .Add (rg .Point3d (x , y , z ), sd .Color .FromArgb (int (r ), int (g ), int (b )))
122- sc .sticky [f'{ prefix } _latest_cloud' ] = pc
123- sc .sticky [f'{ prefix } _status_message' ] = f'Loaded pcd with { pc .Count } pts'
117+ if not sc .sticky .get (f'{ prefix } _server_started' , False ):
118+ self .AddRuntimeMessage (self .RuntimeMessageLevel .Warning ,
119+ "Please start server here before trying to send data from remote device." )
120+ sc .sticky [f'{ prefix } _status_message' ] = "Server not started"
124121 else :
125- sc .sticky [f'{ prefix } _status_message' ] = 'No data buffered'
122+ raw = sc .sticky .get (f'{ prefix } _cloud_buffer_raw' , [])
123+ if raw :
124+ pc = rg .PointCloud ()
125+ for x , y , z , r , g , b in raw :
126+ pc .Add (rg .Point3d (x , y , z ), sd .Color .FromArgb (int (r ), int (g ), int (b )))
127+ sc .sticky [f'{ prefix } _latest_cloud' ] = pc
128+ sc .sticky [f'{ prefix } _status_message' ] = f'Loaded pcd with { pc .Count } pts'
129+ else :
130+ sc .sticky [f'{ prefix } _status_message' ] = 'No data buffered'
126131
127132 # Update previous states
128133 sc .sticky [f'{ prefix } _prev_start' ] = i_start
0 commit comments