monomialList[vars_List,m_Integer?NonNegative]:=Flatten[Map[Apply[Times,vars^#]&,Table[FrobeniusSolve[ConstantArray[1,Length[vars]],k],{k,0,m}],{2}]]
randPoly2[deg_]:= 
( l=monomialList[ {x,y}, deg];
Total[RandomInteger[{-10,10}]*# &/@ l]
)
randPoly3[deg_]:= 
( l=monomialList[ {X,Y,Z}, deg];
Total[RandomInteger[{-10,10}]*# &/@ l]
)
randPoly[deg_, gens_]:=
(
 l=monomialList[ gens, deg];
Total[RandomInteger[{-10,10}]*# &/@ l]
)

Panel[
DynamicModule[ {F=1, showLines=False, lines1, lines2, lines3}, 
Column[{
Row[ {"Show lines? ", Checkbox[Dynamic[showLines]],"  ",Dynamic[Button["New surface", 
F=randPoly[3, {X,Y,Z} ];
eqns1=Table[ (F == 0)/. {X -> a+c s, Y -> b+c t, Z->c}, {c, -1, 2}]; (* Delta Z ≠ 0 *)
eqns2=Table[(F==0) /. {X -> a + c s, Y-> c, Z-> d} , {c, -1, 2}]; (* Delta Z = 0, Delta Y≠0 *)
eqns3=Table[(F==0) /. {X ->  c,Y->b , Z->d} , {c, -1, 2}];(* Delta Z =  Delta Y≠0 *)
sols1=NSolve[eqns1, {a,b,s,t}, Reals];
sols2=NSolve[eqns2, {a,s, d}, Reals];
sols3=NSolve[eqns3, {b,d}, Reals];
If  [sols1≠ {}, lines1=InfiniteLine[{a,b,0}, {s, t, 1}] /. sols1 , lines1={}];
If [sols2≠{}, lines2=InfiniteLine[{a, 0, d}, {s, 1, 0}] /. sols2, lines2={}];
If [sols3≠{}, lines3=InfiniteLine[{0, b, d}, {1, 0, 0}] /. sols3 , lines3={}];
]]}],
Dynamic[

	If [showLines==True, G=
	Join[{ ContourPlot3D[ F==0, {X,-5,5}, {Y,-5,5}, {Z,-5,5}, ImageSize->Large, Mesh->None, Axes->None, Boxed->False,  ContourStyle->{LightBlue}],
	Graphics3D[Catenate[{{Thickness[.01]},lines1 , lines2 , lines3 }] ]
   }] ];
	If [showLines==False, G=ContourPlot3D[ F==0, {X,-5,5}, {Y,-5,5}, {Z,-5,5}, ImageSize->600, Axes->None, Boxed->False, Mesh->None, ContourStyle->{LightBlue}]];
	Show[G]
	
   ],
Dynamic[F]
},  Center, ItemSize->{100,Automatic}]
]
]