1 // File: Draw_VariableCommands.cxx
2 // Created: Thu Feb 23 18:28:40 1995
3 // Author: Remi LEQUETTE
12 #include <Standard_Stream.hxx>
13 #include <Standard_SStream.hxx>
15 #if defined(HAVE_IOS) || defined(WNT)
17 #elif defined(HAVE_IOS_H)
21 #include <Draw_Display.hxx>
22 #include <Draw_Appli.hxx>
23 #include <Draw_Number.hxx>
24 #include <Draw_Axis3D.hxx>
25 #include <Draw_Axis2D.hxx>
26 #include <Draw_Grid.hxx>
27 #include <Draw_Drawable3D.hxx>
28 #include <Draw_SequenceOfDrawable3D.hxx>
29 #include <Draw_VMap.hxx>
30 #include <Draw_ProgressIndicator.hxx>
33 extern Draw_Viewer dout;
43 Standard_Boolean Draw_ParseFailed;
45 static Standard_Boolean autodisp = Standard_True;
46 static Standard_Boolean repaint2d,repaint3d;
48 extern Draw_Interpretor theCommands;
50 //===============================================
51 // dictionnary of variables
52 // Variables are stored in a map Integer, Transient
53 // The Integer Value is the content of the TCl variable
54 //===============================================
56 static Draw_VMap theVariables;
58 //=======================================================================
59 //function : FindVariable
61 //=======================================================================
63 static Standard_Integer p_id;
64 static Standard_Integer p_X;
65 static Standard_Integer p_Y;
66 static Standard_Integer p_b;
67 static const char* p_Name = "";
70 static Draw_SaveAndRestore* Draw_First = NULL;
72 //=======================================================================
73 //function : Draw_SaveAndRestore
75 //=======================================================================
77 Draw_SaveAndRestore::Draw_SaveAndRestore
79 Standard_Boolean (*test)(const Handle(Draw_Drawable3D)&),
80 void (*save)(const Handle(Draw_Drawable3D)&, ostream&),
81 Handle(Draw_Drawable3D) (*restore) (istream&),
82 Standard_Boolean display) :
93 Standard_Boolean Draw_SaveAndRestore::Test(const Handle(Draw_Drawable3D)&d)
94 {return (*myTest) (d);}
96 void Draw_SaveAndRestore::Save(const Handle(Draw_Drawable3D)& d,
100 Handle(Draw_Drawable3D) Draw_SaveAndRestore::Restore(istream& is) const
101 {return (*myRestore) (is);}
103 //=======================================================================
104 // numeric save and restore
105 //=======================================================================
107 static Standard_Boolean numtest(const Handle(Draw_Drawable3D)& d)
109 return d->IsInstance(STANDARD_TYPE(Draw_Number));
112 static void numsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
114 Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(d);
115 #if (defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX)) || ( defined(WNT) && !defined(USE_OLD_STREAMS))
116 ios::fmtflags F = OS.flags();
117 OS.setf(ios::scientific);
121 long form = OS.setf(ios::scientific);
122 int prec = OS.precision(15);
123 int w = OS.width(30);
125 OS << N->Value()<<"\n";
126 #if (defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX)) || (defined(WNT)&& !defined(USE_OLD_STREAMS))
135 static Handle(Draw_Drawable3D) numrestore (istream& is)
139 Handle(Draw_Number) N = new Draw_Number(val);
144 static Draw_SaveAndRestore numsr("Draw_Number",
145 numtest,numsave,numrestore,
148 //=======================================================================
150 //=======================================================================
152 static Standard_Integer save(Draw_Interpretor& di, Standard_Integer n, const char** a)
154 if (n <= 2) return 1;
157 const char* name = a[2];
161 if (!fic.open(name,ios::out)) {
162 di << "Cannot open file for writing "<<name;
166 Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
169 Draw_SaveAndRestore* tool = Draw_First;
170 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
171 progress->SetScale ( 0, 100, 1 );
172 progress->NewScope(100,"Writing");
176 if (tool->Test(D)) break;
180 os << tool->Name() << "\n";
181 Draw::SetProgressBar(progress);
186 di << "No method for saving " << a[1];
189 Draw::SetProgressBar( 0 );
190 progress->EndScope();
196 Standard_Boolean res = Standard_False;
201 res = os.good() && !errno;
204 di<<"File has not been written";
212 //=======================================================================
214 //=======================================================================
216 static Standard_Integer restore(Draw_Interpretor& di, Standard_Integer n, const char** a)
219 if (n <= 2) return 1;
221 const char* fname = a[1];
222 const char* name = a[2];
226 if (!fic.open(fname,ios::in)) {
227 di << "Cannot open file for reading : "<<fname;
235 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
236 progress->NewScope(100,"Reading");
239 Draw_SaveAndRestore* tool = Draw_First;
241 if (!strcmp(typ,tool->Name())) break;
242 Draw::SetProgressBar(progress);
246 Handle(Draw_Drawable3D) D = tool->Restore(in);
247 Draw::Set(name,D,tool->Disp() && autodisp);
250 di << "Cannot restore a " << typ;
253 Draw::SetProgressBar( 0 );
254 progress->EndScope();
262 //=======================================================================
264 //=======================================================================
266 static Standard_Integer display(Draw_Interpretor& di, Standard_Integer n, const char** a)
268 if (n <= 1) return 1;
270 for (Standard_Integer i = 1; i < n; i++) {
271 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
283 //=======================================================================
284 // erase, clear, donly
285 //=======================================================================
287 static Standard_Integer erase(Draw_Interpretor& di, Standard_Integer n, const char** a)
289 static Standard_Boolean draw_erase_mute = Standard_False;
291 if (!strcasecmp(a[1],"-mute")) {
292 draw_erase_mute = Standard_True;
297 Standard_Boolean donly = !strcasecmp(a[0],"donly");
299 if (n <= 1 || donly) {
300 // clear, 2dclear, donly, erase (without arguments)
303 // solve the names for "." before erasing
305 for (i = 1; i < n; i++) {
306 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
308 if ((a[i][0] == '.') && (a[i][1] == '\0'))
309 cout << "Missed !!!" << endl;
315 // sauvegarde des proteges visibles
316 Draw_SequenceOfDrawable3D prot;
317 for (i = 1; i <= theVariables.Extent(); i++) {
318 const Handle(Draw_Drawable3D)& D = *((Handle(Draw_Drawable3D)*)&theVariables(i));
320 if (D->Protected() && D->Visible())
325 // effacement de toutes les variables
326 Standard_Integer erasemode = 1;
327 if (a[0][0] == '2') erasemode = 2;
328 if (a[0][0] == 'c') erasemode = 3;
330 // effacement des graphiques non variables
333 else if (erasemode == 3)
338 // affichage pour donly
340 for (i = 1; i < n; i++) {
341 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
345 if (!draw_erase_mute) di << a[i] << " ";
351 // afficahge des proteges
352 for (i = 1; i <= prot.Length(); i++)
358 for (Standard_Integer i = 1; i < n; i++) {
359 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
362 dout.RemoveDrawable(D);
363 if (!draw_erase_mute) di << D->Name() << " ";
370 draw_erase_mute = Standard_False;
371 repaint2d = Standard_False;
372 repaint3d = Standard_False;
379 //=======================================================================
381 //=======================================================================
383 static Standard_Integer draw(Draw_Interpretor& , Standard_Integer n, const char** a)
386 Standard_Integer id = atoi(a[1]);
387 if (!dout.HasView(id)) {
388 cout << "bad view number in draw"<<endl;
391 Standard_Integer mo = atoi(a[2]);
392 Draw_Display d = dout.MakeDisplay(id);
395 for (i = 3; i < n; i++) {
396 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
397 if (!D.IsNull()) D->DrawOn(d);
403 //=======================================================================
404 // protect, unprotect
405 //=======================================================================
407 static Standard_Integer protect(Draw_Interpretor& di, Standard_Integer n, const char** a)
409 if (n <= 1) return 1;
410 Standard_Boolean prot = *a[0] != 'u';
411 for (Standard_Integer i = 1; i < n; i++) {
412 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
421 //=======================================================================
423 //=======================================================================
425 static Standard_Integer autodisplay(Draw_Interpretor& di, Standard_Integer n, const char** a)
428 autodisp = !autodisp;
430 autodisp = !(!strcasecmp(a[1],"0"));
441 //=======================================================================
443 //=======================================================================
445 static Standard_Integer whatis(Draw_Interpretor& di, Standard_Integer n, const char** a)
447 if (n <= 1) return 1;
448 for (Standard_Integer i = 1; i < n; i++) {
449 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
458 //=======================================================================
460 //=======================================================================
462 static Standard_Integer value(Draw_Interpretor& di, Standard_Integer n, const char** a)
464 if (n != 2) return 1;
470 //=======================================================================
473 //=======================================================================
474 static Standard_Integer dname(Draw_Interpretor& di, Standard_Integer n, const char** a)
480 Standard_PCharacter pC;
482 Handle(Draw_Drawable3D) aD;
484 for (i = 1; i < n; ++i) {
485 aD = Draw::Get(a[i]);
487 //modified by NIZNHY-PKV Tue Jun 10 10:18:13 2008f
489 pC=(Standard_PCharacter)aD->Name();
491 //modified by NIZNHY-PKV Tue Jun 10 10:18:18 2008t
497 //=======================================================================
499 //=======================================================================
502 static Standard_Integer dump(Draw_Interpretor& DI, Standard_Integer n, const char** a)
506 for (i = 1; i < n; i++) {
507 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
509 Standard_SStream sss;
511 sss << "\n\n*********** Dump of " << a[i] << " *************\n";
519 //=======================================================================
521 //=======================================================================
523 static Standard_Integer copy(Draw_Interpretor& , Standard_Integer n, const char** a)
526 Standard_Boolean cop = !strcasecmp(a[0],"copy");
528 Handle(Draw_Drawable3D) D;
529 for (Standard_Integer i = 1; i < n; i += 2) {
530 if (i+1 >= n) return 0;
537 Draw::Set(a[i],Handle(Draw_Drawable3D()));
545 //=======================================================================
548 //=======================================================================
550 static Standard_Integer repaintall(Draw_Interpretor& , Standard_Integer , const char** )
552 if (repaint2d) dout.Repaint2D();
553 repaint2d = Standard_False;
554 if (repaint3d) dout.Repaint3D();
555 repaint3d = Standard_False;
560 //=======================================================================
563 //=======================================================================
565 static Standard_Integer set(Draw_Interpretor& di, Standard_Integer n, const char** a)
568 Standard_Integer i = 1;
570 for (i = 1; i < n; i += 2) {
572 if (i+1 < n) val = atof(a[i+1]);
579 //=======================================================================
582 //=======================================================================
584 static Standard_Integer isdraw(Draw_Interpretor& di, Standard_Integer n, const char** a)
586 if (n != 2) return 1;
587 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
595 //=======================================================================
598 //=======================================================================
600 Standard_Integer isprot(Draw_Interpretor& di, Standard_Integer n, const char** a)
602 if (n != 2) return 1;
603 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
616 //=======================================================================
619 //=======================================================================
621 static Standard_Integer pick(Draw_Interpretor& , Standard_Integer n, const char** a)
625 Standard_Integer X,Y,b;
626 Standard_Boolean wait = (n == 6);
627 if (!wait) id = atoi(a[1]);
628 dout.Select(id,X,Y,b,wait);
629 Standard_Real z = dout.Zoom(id);
630 gp_Pnt P((Standard_Real)X /z,(Standard_Real)Y /z,0);
636 Draw::Set(a[2],P.X());
637 Draw::Set(a[3],P.Y());
638 Draw::Set(a[4],P.Z());
644 //=======================================================================
647 //=======================================================================
649 static Standard_Integer lastrep(Draw_Interpretor& di, Standard_Integer n, const char** a)
653 Draw::Set(a[1],p_id);
659 Standard_Real z = dout.Zoom(p_id);
660 gp_Pnt P((Standard_Real)p_X /z,(Standard_Real)p_Y /z,0);
662 dout.GetTrsf(p_id,T);
665 Draw::Set(a[2],P.X());
666 Draw::Set(a[3],P.Y());
667 Draw::Set(a[4],P.Z());
670 di << "Too many args";
673 Draw::Set(a[n-1],p_b);
679 //=======================================================================
682 //=======================================================================
683 void Draw::Set(const Standard_CString name,
684 const Handle(Draw_Drawable3D)& D)
686 Draw::Set(name,D,autodisp);
690 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
691 static char* tracevar(ClientData CD, Tcl_Interp*,const char*,const char*, Standard_Integer)
693 static char* tracevar(ClientData CD, Tcl_Interp*, char*, char*, Standard_Integer)
696 // protect if the map was destroyed before the interpretor
697 if (theVariables.IsEmpty()) return NULL;
700 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
701 Handle(Draw_Drawable3D)& D = *((Handle(Draw_Drawable3D)*)&theVariables((long)CD));
703 Standard_Integer index = (Standard_Integer) CD;
704 Handle(Draw_Drawable3D)& D = *((Handle(Draw_Drawable3D)*)&theVariables(index));
709 return (char*) "variable is protected";
712 dout.RemoveDrawable(D);
714 repaint3d = Standard_True;
716 repaint2d = Standard_True;
723 //=======================================================================
726 //=======================================================================
727 void Draw::Set(const Standard_CString name,
728 const Handle(Draw_Drawable3D)& D,
729 const Standard_Boolean displ)
731 Standard_PCharacter pName;
733 pName=(Standard_PCharacter)name;
735 if ((name[0] == '.') && (name[1] == '\0')) {
737 dout.RemoveDrawable(D);
738 if (displ) dout << D;
743 Tcl_UnsetVar(theCommands.Interp(),pName,0);
745 Standard_Integer ival = theVariables.Extent() + 1;
746 theVariables.Bind(ival,D);
748 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
749 D->Name((const Standard_CString)Tcl_SetVar(theCommands.Interp(),name,name,0));
751 D->Name(Tcl_SetVar(theCommands.Interp(),pName,pName,0));
754 // set the trace function
755 Tcl_TraceVar(theCommands.Interp(),pName,TCL_TRACE_UNSETS,
756 tracevar,(ClientData)ival);
762 else if (D->Visible())
763 dout.RemoveDrawable(D);
767 //=======================================================================
770 //=======================================================================
771 void Draw::Set(const Standard_CString Name, const Standard_Real val)
773 if ((Name[0] == '.') && (Name[1] == '\0')) return;
774 Standard_CString aName = Name;
775 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
776 Handle(Draw_Number) N;
778 N = Handle(Draw_Number)::DownCast(D);
781 N = new Draw_Number(val);
782 Draw::Set(aName,N,Standard_False);
787 //=======================================================================
790 //=======================================================================
791 Handle(Draw_Drawable3D) Draw::Get(Standard_CString& name,
792 const Standard_Boolean )
794 Standard_PCharacter pName;
796 pName=(Standard_PCharacter)name;
798 Standard_Boolean pick = ((name[0] == '.') && (name[1] == '\0'));
799 Handle(Draw_Drawable3D) D;
801 cout << "Pick an object" << endl;
802 dout.Select(p_id,p_X,p_Y,p_b);
803 dout.Pick(p_id,p_X,p_Y,5,D,0);
806 name = p_Name = D->Name();
807 //p_Name = (char *)D->Name();
813 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
814 Standard_Address index =
815 Tcl_VarTraceInfo(theCommands.Interp(),name,TCL_TRACE_UNSETS,
818 D = Handle(Draw_Drawable3D)::DownCast(theVariables((long)index));
820 Standard_Integer index = (Standard_Integer)
821 Tcl_VarTraceInfo(theCommands.Interp(),
826 D = Handle(Draw_Drawable3D)::DownCast(theVariables(index));
829 if (D.IsNull() && complain)
830 cout <<name<<" does not exist"<<endl;
836 //=======================================================================
839 //=======================================================================
840 Standard_Boolean Draw::Get(const Standard_CString name,
843 if ((name[0] == '.') && (name[1] == '\0')) {
844 return Standard_False;
846 Standard_CString aName = name;
847 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
849 Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(D);
852 return Standard_True;
855 return Standard_False;
858 //=======================================================================
859 //function : LastPick
861 //=======================================================================
862 void Draw::LastPick(Standard_Integer& view,
865 Standard_Integer& button)
872 //=======================================================================
875 //=======================================================================
878 repaint2d = Standard_True;
879 repaint3d = Standard_True;
882 //=======================================================================
883 //function : trigonometric functions
885 //=======================================================================
887 //static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer n, const char** a)
888 static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer , const char** a)
891 Standard_Real x = atof(a[1]);
893 if (!strcasecmp(a[0],"cos"))
895 else if (!strcasecmp(a[0],"sin"))
897 else if (!strcasecmp(a[0],"tan"))
899 else if (!strcasecmp(a[0],"sqrt"))
901 else if (!strcasecmp(a[0],"acos"))
903 else if (!strcasecmp(a[0],"asin"))
905 else if (!strcasecmp(a[0],"atan2"))
906 di << ATan2(x,atof(a[2]));
912 //=======================================================================
914 //=======================================================================
919 static Standard_Boolean Numeric(char c)
921 return (c == '.' || (c >= '0' && c <= '9'));
924 static Standard_Boolean Alphabetic(char c)
926 return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_'));
929 static Standard_Real Parse(char*&);
931 static Standard_Real ParseValue(char*& name)
933 while (*name == ' ' || *name == '\t') name++;
944 cout << "Mismatched parenthesis" << endl;
950 x = ParseValue(name);
955 x = - ParseValue(name);
963 while (Numeric(*p)) p++;
964 // process scientific notation
965 if ((*p == 'e') || (*p == 'E')) {
966 if (Numeric(*(p+1)) || *(p+1) == '+' || *(p+1) == '-')
969 while (Numeric(*p) || Alphabetic(*p)) p++;
973 if (Numeric(*name)) // numeric litteral
975 else if (!Draw::Get((Standard_CString) name,x)) { // variable
977 // search for a function ...
980 Standard_Integer argc = 1;
982 while ((*q == ' ') && (*q == '\t')) q++;
984 Standard_Integer pc = 1;
987 while ((pc > 0) && *q) {
990 if ((pc == 1) && (*q == ',')) argc++;
994 cout << "Unclosed parenthesis"<< endl;
998 // build function call
999 // replace , and first and last () by space
1001 Standard_Integer i = 2;
1002 while (*p != '(') p++;
1007 if (*p == '(') pc++;
1008 if (*p == ')') pc--;
1009 if ((pc == 1) && (*p == ',')) {
1020 // call the function, save the current result
1022 if (*theCommands.Result()) {
1023 sv = new char [strlen(theCommands.Result())];
1024 strcpy(sv,theCommands.Result());
1025 theCommands.Reset();
1027 if (theCommands.Eval(name) != 0) {
1028 cout << "Call of function " << name << " failed" << endl;
1032 x = atof(theCommands.Result());
1033 theCommands.Reset();
1042 Draw_ParseFailed = Standard_True;
1050 while (*name == ' ' || *name == '\t') name++;
1055 static Standard_Real ParseFactor(char*& name)
1057 Standard_Real x = ParseValue(name);
1061 if (c == '\0') return x;
1066 x *= ParseValue(name);
1070 x /= ParseValue(name);
1081 static Standard_Real Parse(char*& name)
1083 Standard_Real x = ParseFactor(name);
1087 if (c == '\0') return x;
1092 x += ParseFactor(name);
1096 x -= ParseFactor(name);
1106 //=======================================================================
1109 //=======================================================================
1110 Standard_Real Draw::Atof(const Standard_CString name)
1113 char* n = new char[1+strlen(name)];
1116 Standard_Real x = Parse(n);
1117 while ((*n == ' ') || (*n == '\t')) n++;
1118 if (*n) Draw_ParseFailed = Standard_True;
1123 Standard_Integer Draw::Atoi(const Standard_CString name)
1125 return (Standard_Integer ) Draw::Atof(name);
1127 //=======================================================================
1129 //purpose : set a TCL var
1130 //=======================================================================
1131 void Draw::Set(const Standard_CString Name, const Standard_CString val)
1133 Standard_PCharacter pName, pVal;
1135 pName=(Standard_PCharacter)Name;
1136 pVal=(Standard_PCharacter)val;
1138 Tcl_SetVar(theCommands.Interp(), pName, pVal, 0);
1140 //=======================================================================
1141 // Command management
1142 // refresh the screen
1143 //=======================================================================
1145 static void before()
1147 repaint2d = Standard_False;
1148 repaint3d = Standard_False;
1151 void Draw_RepaintNowIfNecessary()
1153 if (repaint2d) dout.Repaint2D();
1154 if (repaint3d) dout.Repaint3D();
1155 repaint2d = Standard_False;
1156 repaint3d = Standard_False;
1159 static void after(Standard_Integer)
1161 Draw_RepaintNowIfNecessary();
1164 extern void (*Draw_BeforeCommand)();
1165 extern void (*Draw_AfterCommand)(Standard_Integer);
1168 //=======================================================================
1169 //function : Commands
1171 //=======================================================================
1172 void Draw::VariableCommands(Draw_Interpretor& theCommands)
1174 static Standard_Boolean Done = Standard_False;
1176 Done = Standard_True;
1178 // set up start and stop command
1179 Draw_BeforeCommand = &before;
1180 Draw_AfterCommand = &after;
1182 // set up some variables
1185 Handle(Draw_Axis3D) theAxes3d = new Draw_Axis3D(gp_Pnt(0,0,0),Draw_bleu,20);
1187 Draw::Set(n,theAxes3d);
1188 theAxes3d->Protected(Standard_True);
1190 Handle(Draw_Axis2D) theAxes2d = new Draw_Axis2D(gp_Pnt2d(0,0),Draw_bleu,20);
1192 Draw::Set(n,theAxes2d);
1193 theAxes2d->Protected(Standard_True);
1197 Draw::Get(n)->Protected(Standard_True);
1200 Draw::Set(n,RealLast());
1201 Draw::Get(n)->Protected(Standard_True);
1204 Draw::Set(n,RealFirst());
1205 Draw::Get(n)->Protected(Standard_True);
1208 Handle(Draw_Grid) theGrid = new Draw_Grid();
1209 Draw::Set(n, theGrid);
1210 theGrid->Protected(Standard_True);
1215 g = "DRAW Numeric functions";
1217 theCommands.Add("cos" ,"cos(x)" ,__FILE__,trigo,g);
1218 theCommands.Add("sin" ,"sin(x)" ,__FILE__,trigo,g);
1219 theCommands.Add("tan" ,"tan(x)" ,__FILE__,trigo,g);
1220 theCommands.Add("acos" ,"acos(x)" ,__FILE__,trigo,g);
1221 theCommands.Add("asin" ,"asin(x)" ,__FILE__,trigo,g);
1222 theCommands.Add("atan2" ,"atan2(x,y)" ,__FILE__,trigo,g);
1223 theCommands.Add("sqrt","sqrt(x)",__FILE__,trigo,g);
1225 g = "DRAW Variables management";
1227 theCommands.Add("protect","protect name ...",__FILE__,protect,g);
1228 theCommands.Add("unprotect","unprotect name ...",__FILE__,protect,g);
1230 theCommands.Add("bsave","bsave name filename",__FILE__,save,g);
1231 theCommands.Add("brestore","brestore filename name",__FILE__,restore,g);
1233 theCommands.Add("isdraw","isdraw var, return 1 if Draw value",__FILE__,isdraw,g);
1234 theCommands.Add("isprot","isprot var, return 1 if Draw var is protected",__FILE__,isprot,g);
1236 theCommands.Add("autodisplay","toggle autodisplay [0/1]",__FILE__,autodisplay,g);
1237 theCommands.Add("display","display [name1 name2 ...], no names display all",__FILE__,display,g);
1238 theCommands.Add("donly","donly [name1 name2 ...], erase and display",__FILE__,erase,g);
1239 theCommands.Add("erase","erase [name1 name2 ...], no names erase all",__FILE__,erase,g);
1240 theCommands.Add("draw","draw view mode [name1 name2 ...], draw on view with mode",__FILE__,draw,g);
1241 theCommands.Add("clear","clear display",__FILE__,erase,g);
1242 theCommands.Add("2dclear","clear display (2d objects)",__FILE__,erase,g);
1243 theCommands.Add("repaint","repaint, force redraw",__FILE__,repaintall,g);
1245 theCommands.Add("dtyp", "dtyp name1 name2",__FILE__,whatis,g);
1246 theCommands.Add("dval", "dval name, return value",__FILE__,value,g);
1247 theCommands.Add("dname", "dname name, print name",__FILE__,dname,g);
1248 theCommands.Add("dump", "dump name1 name2 ...",__FILE__,dump,g);
1249 theCommands.Add("copy", "copy name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1250 // san - 02/08/2002 - `rename` command changed to `renamevar` since it conflicts with
1251 // the built-in Tcl command `rename`
1252 //theCommands.Add("rename","rename name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1253 theCommands.Add("renamevar","renamevar name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1254 theCommands.Add("dset","var1 value1 vr2 value2 ...",__FILE__,set,g);
1256 theCommands.Add("pick","pick id X Y Z b [nowait]",__FILE__,pick,g);
1257 theCommands.Add("lastrep","lastrep id X Y [Z] b, return name",__FILE__,lastrep,g);