1 // Created on: 1995-02-23
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
19 #include <Draw_Appli.hxx>
20 #include <Draw_Axis2D.hxx>
21 #include <Draw_Axis3D.hxx>
22 #include <Draw_Display.hxx>
23 #include <Draw_Drawable3D.hxx>
24 #include <Draw_Grid.hxx>
25 #include <Draw_Number.hxx>
26 #include <Draw_ProgressIndicator.hxx>
27 #include <Draw_SequenceOfDrawable3D.hxx>
28 #include <NCollection_Map.hxx>
29 #include <Standard_SStream.hxx>
30 #include <Standard_Stream.hxx>
31 #include <TCollection_AsciiString.hxx>
35 extern Draw_Viewer dout;
41 #include <OSD_Environment.hxx>
42 #include <OSD_OpenFile.hxx>
44 Standard_Boolean Draw_ParseFailed;
46 static Standard_Boolean autodisp = Standard_True;
47 static Standard_Boolean repaint2d,repaint3d;
49 extern Draw_Interpretor theCommands;
51 //===============================================
52 // dictionnary of variables
53 // Variables are stored in a map Integer, Transient
54 // The Integer Value is the content of the TCl variable
55 //===============================================
57 static NCollection_Map<Handle(Draw_Drawable3D)> theVariables;
59 //=======================================================================
60 //function : FindVariable
62 //=======================================================================
64 static Standard_Integer p_id;
65 static Standard_Integer p_X;
66 static Standard_Integer p_Y;
67 static Standard_Integer p_b;
68 static const char* p_Name = "";
71 static Draw_SaveAndRestore* Draw_First = NULL;
73 //=======================================================================
74 //function : Draw_SaveAndRestore
76 //=======================================================================
78 Draw_SaveAndRestore::Draw_SaveAndRestore
80 Standard_Boolean (*test)(const Handle(Draw_Drawable3D)&),
81 void (*save)(const Handle(Draw_Drawable3D)&, ostream&),
82 Handle(Draw_Drawable3D) (*restore) (istream&),
83 Standard_Boolean display) :
94 Standard_Boolean Draw_SaveAndRestore::Test(const Handle(Draw_Drawable3D)&d)
95 {return (*myTest) (d);}
97 void Draw_SaveAndRestore::Save(const Handle(Draw_Drawable3D)& d,
101 Handle(Draw_Drawable3D) Draw_SaveAndRestore::Restore(istream& is) const
102 {return (*myRestore) (is);}
104 //=======================================================================
105 // numeric save and restore
106 //=======================================================================
108 static Standard_Boolean numtest(const Handle(Draw_Drawable3D)& d)
110 return d->IsInstance(STANDARD_TYPE(Draw_Number));
113 static void numsave (const Handle(Draw_Drawable3D)& theDrawable,
116 Handle(Draw_Number) aNum = Handle(Draw_Number)::DownCast (theDrawable);
117 ios::fmtflags aFlags = theStream.flags();
118 theStream.setf (ios::scientific);
119 theStream.precision (15);
120 theStream.width (30);
121 theStream << aNum->Value() << "\n";
122 theStream.setf (aFlags);
125 static Handle(Draw_Drawable3D) numrestore (istream& is)
129 Handle(Draw_Number) N = new Draw_Number(val);
134 static Draw_SaveAndRestore numsr("Draw_Number",
135 numtest,numsave,numrestore,
138 //=======================================================================
140 //=======================================================================
142 static Standard_Integer save(Draw_Interpretor& di, Standard_Integer n, const char** a)
144 if (n <= 2) return 1;
147 const char* name = a[2];
150 OSD_OpenStream(os, name, ios::out);
151 if (!os.rdbuf()->is_open()) {
152 di << "Cannot open file for writing "<<name;
156 Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
159 Draw_SaveAndRestore* tool = Draw_First;
160 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
161 progress->SetScale ( 0, 100, 1 );
162 progress->NewScope(100,"Writing");
166 if (tool->Test(D)) break;
170 os << tool->Name() << "\n";
171 Draw::SetProgressBar(progress);
176 di << "No method for saving " << a[1];
179 Draw::SetProgressBar( 0 );
180 progress->EndScope();
186 Standard_Boolean res = Standard_False;
190 res = os.good() && !errno;
193 di<<"File has not been written";
201 //=======================================================================
203 //=======================================================================
205 static Standard_Integer restore(Draw_Interpretor& di, Standard_Integer n, const char** a)
208 if (n <= 2) return 1;
210 const char* fname = a[1];
211 const char* name = a[2];
215 OSD_OpenStream (fic, fname, ios::in);
216 if (!fic.is_open()) {
217 di << "Cannot open file for reading : "<<fname;
225 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
226 progress->NewScope(100,"Reading");
229 Draw_SaveAndRestore* tool = Draw_First;
230 Draw_SaveAndRestore* aDBRepTool = NULL;
232 const char* toolName = tool->Name();
233 if (!strcmp(typ,toolName)) break;
234 if (!strcmp("DBRep_DrawableShape",toolName))
236 Draw::SetProgressBar(progress);
242 //assume that this file stores a DBRep_DrawableShape variable
244 in.seekg(0, ios::beg);
249 Handle(Draw_Drawable3D) D = tool->Restore(in);
250 Draw::Set(name,D,tool->Disp() && autodisp);
254 di << "Cannot restore a " << typ;
257 Draw::SetProgressBar( 0 );
258 progress->EndScope();
266 //=======================================================================
268 //=======================================================================
270 static Standard_Integer display(Draw_Interpretor& di, Standard_Integer n, const char** a)
272 if (n <= 1) return 1;
274 for (Standard_Integer i = 1; i < n; i++) {
275 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
287 //=======================================================================
288 // erase, clear, donly
289 //=======================================================================
291 static Standard_Integer erase(Draw_Interpretor& di, Standard_Integer n, const char** a)
293 static Standard_Boolean draw_erase_mute = Standard_False;
295 if (!strcasecmp(a[1],"-mute")) {
296 draw_erase_mute = Standard_True;
301 Standard_Boolean donly = !strcasecmp(a[0],"donly");
303 if (n <= 1 || donly) {
304 // clear, 2dclear, donly, erase (without arguments)
307 // solve the names for "." before erasing
309 for (i = 1; i < n; i++) {
310 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
312 if ((a[i][0] == '.') && (a[i][1] == '\0'))
313 cout << "Missed !!!" << endl;
319 // sauvegarde des proteges visibles
320 Draw_SequenceOfDrawable3D prot;
321 NCollection_Map<Handle(Draw_Drawable3D)>::Iterator aMapIt (theVariables);
322 for (; aMapIt.More(); aMapIt.Next()) {
323 const Handle(Draw_Drawable3D)& D = aMapIt.Key();
325 if (D->Protected() && D->Visible())
330 // effacement de toutes les variables
331 Standard_Integer erasemode = 1;
332 if (a[0][0] == '2') erasemode = 2;
333 if (a[0][0] == 'c') erasemode = 3;
335 // effacement des graphiques non variables
338 else if (erasemode == 3)
343 // affichage pour donly
345 for (i = 1; i < n; i++) {
346 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
350 if (!draw_erase_mute) di << a[i] << " ";
356 // afficahge des proteges
357 for (i = 1; i <= prot.Length(); i++)
363 for (Standard_Integer i = 1; i < n; i++) {
364 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
367 dout.RemoveDrawable(D);
368 if (!draw_erase_mute) di << D->Name() << " ";
375 draw_erase_mute = Standard_False;
376 repaint2d = Standard_False;
377 repaint3d = Standard_False;
384 //=======================================================================
386 //=======================================================================
388 static Standard_Integer draw(Draw_Interpretor& , Standard_Integer n, const char** a)
391 Standard_Integer id = Draw::Atoi(a[1]);
392 if (!dout.HasView(id)) {
393 cout << "bad view number in draw"<<endl;
396 Standard_Integer mo = Draw::Atoi(a[2]);
397 Draw_Display d = dout.MakeDisplay(id);
400 for (i = 3; i < n; i++) {
401 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
402 if (!D.IsNull()) D->DrawOn(d);
408 //=======================================================================
409 // protect, unprotect
410 //=======================================================================
412 static Standard_Integer protect(Draw_Interpretor& di, Standard_Integer n, const char** a)
414 if (n <= 1) return 1;
415 Standard_Boolean prot = *a[0] != 'u';
416 for (Standard_Integer i = 1; i < n; i++) {
417 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
426 //=======================================================================
428 //=======================================================================
430 static Standard_Integer autodisplay(Draw_Interpretor& di, Standard_Integer n, const char** a)
433 autodisp = !autodisp;
435 autodisp = !(!strcasecmp(a[1],"0"));
446 //=======================================================================
448 //=======================================================================
450 static Standard_Integer whatis(Draw_Interpretor& di, Standard_Integer n, const char** a)
452 if (n <= 1) return 1;
453 for (Standard_Integer i = 1; i < n; i++) {
454 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
463 //=======================================================================
465 //=======================================================================
467 static Standard_Integer value(Draw_Interpretor& di, Standard_Integer n, const char** a)
469 if (n != 2) return 1;
470 di << Draw::Atof(a[1]);
475 //=======================================================================
478 //=======================================================================
479 static Standard_Integer dname(Draw_Interpretor& di, Standard_Integer n, const char** a)
485 Standard_PCharacter pC;
487 Handle(Draw_Drawable3D) aD;
489 for (i = 1; i < n; ++i) {
490 aD = Draw::Get(a[i]);
492 //modified by NIZNHY-PKV Tue Jun 10 10:18:13 2008f
494 pC=(Standard_PCharacter)aD->Name();
496 //modified by NIZNHY-PKV Tue Jun 10 10:18:18 2008t
502 //=======================================================================
504 //=======================================================================
507 static Standard_Integer dump(Draw_Interpretor& DI, Standard_Integer n, const char** a)
511 for (i = 1; i < n; i++) {
512 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
514 Standard_SStream sss;
516 sss << "\n\n*********** Dump of " << a[i] << " *************\n";
524 //=======================================================================
526 //=======================================================================
528 static Standard_Integer copy(Draw_Interpretor& , Standard_Integer n, const char** a)
531 Standard_Boolean cop = !strcasecmp(a[0],"copy");
533 Handle(Draw_Drawable3D) D;
534 for (Standard_Integer i = 1; i < n; i += 2) {
535 if (i+1 >= n) return 0;
542 Draw::Set(a[i],Handle(Draw_Drawable3D)());
550 //=======================================================================
553 //=======================================================================
555 static Standard_Integer repaintall(Draw_Interpretor& , Standard_Integer , const char** )
557 if (repaint2d) dout.Repaint2D();
558 repaint2d = Standard_False;
559 if (repaint3d) dout.Repaint3D();
560 repaint3d = Standard_False;
565 //=======================================================================
568 //=======================================================================
570 static Standard_Integer set(Draw_Interpretor& di, Standard_Integer n, const char** a)
573 Standard_Integer i = 1;
575 for (i = 1; i < n; i += 2) {
577 if (i+1 < n) val = Draw::Atof(a[i+1]);
584 //=======================================================================
587 //=======================================================================
589 static Standard_Integer dsetenv(Draw_Interpretor& /*di*/, Standard_Integer argc, const char** argv)
592 cout << "Use: " << argv[0] << " {varname} [value]" << endl;
596 OSD_Environment env (argv[1]);
597 if (argc > 2 && argv[2][0] != '\0')
599 env.SetValue (argv[2]);
607 //=======================================================================
610 //=======================================================================
612 static Standard_Integer dgetenv(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
615 cout << "Use: " << argv[0] << " {varname}" << endl;
619 const char* val = getenv (argv[1]);
620 di << ( val ? val : "" );
624 //=======================================================================
627 //=======================================================================
629 static Standard_Integer isdraw(Draw_Interpretor& di, Standard_Integer n, const char** a)
631 if (n != 2) return 1;
632 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
640 //=======================================================================
643 //=======================================================================
645 Standard_Integer isprot(Draw_Interpretor& di, Standard_Integer n, const char** a)
647 if (n != 2) return 1;
648 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
661 //=======================================================================
664 //=======================================================================
666 static Standard_Integer pick(Draw_Interpretor& , Standard_Integer n, const char** a)
670 Standard_Integer X,Y,b;
671 Standard_Boolean wait = (n == 6);
672 if (!wait) id = Draw::Atoi(a[1]);
673 dout.Select(id,X,Y,b,wait);
674 Standard_Real z = dout.Zoom(id);
675 gp_Pnt P((Standard_Real)X /z,(Standard_Real)Y /z,0);
681 Draw::Set(a[2],P.X());
682 Draw::Set(a[3],P.Y());
683 Draw::Set(a[4],P.Z());
689 //=======================================================================
692 //=======================================================================
694 static Standard_Integer lastrep(Draw_Interpretor& di, Standard_Integer n, const char** a)
698 Draw::Set(a[1],p_id);
704 Standard_Real z = dout.Zoom(p_id);
705 gp_Pnt P((Standard_Real)p_X /z,(Standard_Real)p_Y /z,0);
707 dout.GetTrsf(p_id,T);
710 Draw::Set(a[2],P.X());
711 Draw::Set(a[3],P.Y());
712 Draw::Set(a[4],P.Z());
715 di << "Too many args";
718 Draw::Set(a[n-1],p_b);
724 //=======================================================================
727 //=======================================================================
728 void Draw::Set(const Standard_CString name,
729 const Handle(Draw_Drawable3D)& D)
731 Draw::Set(name,D,autodisp);
735 static char* tracevar(ClientData CD, Tcl_Interp*,const char* name,const char*, int)
737 // protect if the map was destroyed before the interpretor
738 if (theVariables.IsEmpty()) return NULL;
740 // MSV 9.10.14 CR25344
741 Handle(Draw_Drawable3D) D(reinterpret_cast<Draw_Drawable3D*>(CD));
743 Tcl_UntraceVar(theCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
747 if (D->Protected()) {
748 D->Name(Tcl_SetVar(theCommands.Interp(),name,name,0));
749 return (char*) "variable is protected";
752 dout.RemoveDrawable(D);
754 repaint3d = Standard_True;
756 repaint2d = Standard_True;
758 Tcl_UntraceVar(theCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
760 theVariables.Remove(D);
765 //=======================================================================
768 //=======================================================================
769 void Draw::Set(const Standard_CString name,
770 const Handle(Draw_Drawable3D)& D,
771 const Standard_Boolean displ)
773 if ((name[0] == '.') && (name[1] == '\0')) {
775 dout.RemoveDrawable(D);
776 if (displ) dout << D;
780 // Check if the variable with the same name exists
782 Tcl_VarTraceInfo(theCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
784 Handle(Draw_Drawable3D) anOldD(reinterpret_cast<Draw_Drawable3D*>(aCD));
785 if (!anOldD.IsNull()) {
786 if (theVariables.Contains(anOldD) && anOldD->Protected()) {
787 cout << "variable is protected" << endl;
793 Tcl_UnsetVar(theCommands.Interp(),name,0);
797 D->Name(Tcl_SetVar(theCommands.Interp(),name,name,0));
799 // set the trace function
800 Tcl_TraceVar(theCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
801 tracevar,reinterpret_cast<ClientData>(D.operator->()));
806 else if (D->Visible())
807 dout.RemoveDrawable(D);
811 //=======================================================================
814 //=======================================================================
815 void Draw::Set(const Standard_CString Name, const Standard_Real val)
817 if ((Name[0] == '.') && (Name[1] == '\0')) return;
818 Standard_CString aName = Name;
819 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
820 Handle(Draw_Number) N;
822 N = Handle(Draw_Number)::DownCast(D);
825 N = new Draw_Number(val);
826 Draw::Set(aName,N,Standard_False);
831 //=======================================================================
834 //=======================================================================
835 Handle(Draw_Drawable3D) Draw::Get(Standard_CString& name,
836 const Standard_Boolean )
838 Standard_Boolean pick = ((name[0] == '.') && (name[1] == '\0'));
839 Handle(Draw_Drawable3D) D;
841 cout << "Pick an object" << endl;
842 dout.Select(p_id,p_X,p_Y,p_b);
843 dout.Pick(p_id,p_X,p_Y,5,D,0);
846 name = p_Name = D->Name();
847 //p_Name = (char *)D->Name();
853 Tcl_VarTraceInfo(theCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
855 D = reinterpret_cast<Draw_Drawable3D*>(aCD);
856 if (!theVariables.Contains(D))
859 if (D.IsNull() && complain)
860 cout <<name<<" does not exist"<<endl;
866 //=======================================================================
869 //=======================================================================
870 Standard_Boolean Draw::Get(const Standard_CString name,
873 if ((name[0] == '.') && (name[1] == '\0')) {
874 return Standard_False;
876 Standard_CString aName = name;
877 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
879 Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(D);
882 return Standard_True;
885 return Standard_False;
888 //=======================================================================
889 //function : LastPick
891 //=======================================================================
892 void Draw::LastPick(Standard_Integer& view,
895 Standard_Integer& button)
902 //=======================================================================
905 //=======================================================================
908 repaint2d = Standard_True;
909 repaint3d = Standard_True;
912 //=======================================================================
913 //function : trigonometric functions
915 //=======================================================================
917 //static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer n, const char** a)
918 static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer , const char** a)
921 Standard_Real x = Draw::Atof(a[1]);
923 if (!strcasecmp(a[0],"cos"))
925 else if (!strcasecmp(a[0],"sin"))
927 else if (!strcasecmp(a[0],"tan"))
929 else if (!strcasecmp(a[0],"sqrt"))
931 else if (!strcasecmp(a[0],"acos"))
933 else if (!strcasecmp(a[0],"asin"))
935 else if (!strcasecmp(a[0],"atan2"))
936 di << ATan2(x,Draw::Atof(a[2]));
942 //=======================================================================
944 //=======================================================================
946 static Standard_Boolean Numeric(char c)
948 return (c == '.' || (c >= '0' && c <= '9'));
951 static Standard_Boolean Alphabetic(char c)
953 return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_'));
956 static Standard_Real Parse(char*&);
958 static Standard_Real ParseValue(char*& name)
960 while (*name == ' ' || *name == '\t') name++;
971 cout << "Mismatched parenthesis" << endl;
977 x = ParseValue(name);
982 x = - ParseValue(name);
990 while (Numeric(*p)) p++;
991 // process scientific notation
992 if ((*p == 'e') || (*p == 'E')) {
993 if (Numeric(*(p+1)) || *(p+1) == '+' || *(p+1) == '-')
996 while (Numeric(*p) || Alphabetic(*p)) p++;
1000 if (Numeric(*name)) // numeric litteral
1002 else if (!Draw::Get((Standard_CString) name,x)) { // variable
1004 // search for a function ...
1007 Standard_Integer argc = 1;
1009 while ((*q == ' ') || (*q == '\t')) q++;
1011 Standard_Integer pc = 1;
1014 while ((pc > 0) && *q) {
1015 if (*q == '(') pc++;
1016 if (*q == ')') pc--;
1017 if ((pc == 1) && (*q == ',')) argc++;
1021 cout << "Unclosed parenthesis"<< endl;
1025 // build function call
1026 // replace , and first and last () by space
1028 Standard_Integer i = 2;
1029 while (*p != '(') p++;
1034 if (*p == '(') pc++;
1035 if (*p == ')') pc--;
1036 if ((pc == 1) && (*p == ',')) {
1047 // call the function, save the current result
1049 if (*theCommands.Result()) {
1050 sv = new char [strlen(theCommands.Result())];
1051 strcpy(sv,theCommands.Result());
1052 theCommands.Reset();
1054 if (theCommands.Eval(name) != 0) {
1055 cout << "Call of function " << name << " failed" << endl;
1059 x = Atof(theCommands.Result());
1060 theCommands.Reset();
1069 Draw_ParseFailed = Standard_True;
1077 while (*name == ' ' || *name == '\t') name++;
1082 static Standard_Real ParseFactor(char*& name)
1084 Standard_Real x = ParseValue(name);
1088 if (c == '\0') return x;
1093 x *= ParseValue(name);
1097 x /= ParseValue(name);
1108 static Standard_Real Parse(char*& name)
1110 Standard_Real x = ParseFactor(name);
1114 if (c == '\0') return x;
1119 x += ParseFactor(name);
1123 x -= ParseFactor(name);
1133 //=======================================================================
1136 //=======================================================================
1137 Standard_Real Draw::Atof(const Standard_CString name)
1140 char* n = new char[1+strlen(name)];
1143 Standard_Real x = Parse(n);
1144 while ((*n == ' ') || (*n == '\t')) n++;
1145 if (*n) Draw_ParseFailed = Standard_True;
1150 Standard_Integer Draw::Atoi(const Standard_CString name)
1152 return (Standard_Integer ) Draw::Atof(name);
1154 //=======================================================================
1156 //purpose : set a TCL var
1157 //=======================================================================
1158 void Draw::Set(const Standard_CString Name, const Standard_CString val)
1160 Standard_PCharacter pName, pVal;
1162 pName=(Standard_PCharacter)Name;
1163 pVal=(Standard_PCharacter)val;
1165 Tcl_SetVar(theCommands.Interp(), pName, pVal, 0);
1167 //=======================================================================
1168 // Command management
1169 // refresh the screen
1170 //=======================================================================
1172 static void before()
1174 repaint2d = Standard_False;
1175 repaint3d = Standard_False;
1178 void Draw_RepaintNowIfNecessary()
1180 if (repaint2d) dout.Repaint2D();
1181 if (repaint3d) dout.Repaint3D();
1182 repaint2d = Standard_False;
1183 repaint3d = Standard_False;
1186 static void after(Standard_Integer)
1188 Draw_RepaintNowIfNecessary();
1191 extern void (*Draw_BeforeCommand)();
1192 extern void (*Draw_AfterCommand)(Standard_Integer);
1195 //=======================================================================
1196 //function : Commands
1198 //=======================================================================
1199 void Draw::VariableCommands(Draw_Interpretor& theCommandsArg)
1201 static Standard_Boolean Done = Standard_False;
1203 Done = Standard_True;
1205 // set up start and stop command
1206 Draw_BeforeCommand = &before;
1207 Draw_AfterCommand = &after;
1209 // set up some variables
1212 Handle(Draw_Axis3D) theAxes3d = new Draw_Axis3D(gp_Pnt(0,0,0),Draw_bleu,20);
1214 Draw::Set(n,theAxes3d);
1215 theAxes3d->Protected(Standard_True);
1217 Handle(Draw_Axis2D) theAxes2d = new Draw_Axis2D(gp_Pnt2d(0,0),Draw_bleu,20);
1219 Draw::Set(n,theAxes2d);
1220 theAxes2d->Protected(Standard_True);
1224 Draw::Get(n)->Protected(Standard_True);
1227 Draw::Set(n,RealLast());
1228 Draw::Get(n)->Protected(Standard_True);
1231 Draw::Set(n,RealFirst());
1232 Draw::Get(n)->Protected(Standard_True);
1235 Handle(Draw_Grid) theGrid = new Draw_Grid();
1236 Draw::Set(n, theGrid);
1237 theGrid->Protected(Standard_True);
1242 g = "DRAW Numeric functions";
1244 theCommandsArg.Add("cos" ,"cos(x)" ,__FILE__,trigo,g);
1245 theCommandsArg.Add("sin" ,"sin(x)" ,__FILE__,trigo,g);
1246 theCommandsArg.Add("tan" ,"tan(x)" ,__FILE__,trigo,g);
1247 theCommandsArg.Add("acos" ,"acos(x)" ,__FILE__,trigo,g);
1248 theCommandsArg.Add("asin" ,"asin(x)" ,__FILE__,trigo,g);
1249 theCommandsArg.Add("atan2" ,"atan2(x,y)" ,__FILE__,trigo,g);
1250 theCommandsArg.Add("sqrt","sqrt(x)",__FILE__,trigo,g);
1252 g = "DRAW Variables management";
1254 theCommandsArg.Add("protect","protect name ...",__FILE__,protect,g);
1255 theCommandsArg.Add("unprotect","unprotect name ...",__FILE__,protect,g);
1257 theCommandsArg.Add("bsave","bsave name filename",__FILE__,save,g);
1258 theCommandsArg.Add("brestore","brestore filename name",__FILE__,restore,g);
1260 theCommandsArg.Add("isdraw","isdraw var, return 1 if Draw value",__FILE__,isdraw,g);
1261 theCommandsArg.Add("isprot","isprot var, return 1 if Draw var is protected",__FILE__,isprot,g);
1263 theCommandsArg.Add("autodisplay","toggle autodisplay [0/1]",__FILE__,autodisplay,g);
1264 theCommandsArg.Add("display","display [name1 name2 ...], no names display all",__FILE__,display,g);
1265 theCommandsArg.Add("donly","donly [name1 name2 ...], erase and display",__FILE__,erase,g);
1266 theCommandsArg.Add("erase","erase [name1 name2 ...], no names erase all",__FILE__,erase,g);
1267 theCommandsArg.Add("draw","draw view mode [name1 name2 ...], draw on view with mode",__FILE__,draw,g);
1268 theCommandsArg.Add("clear","clear display",__FILE__,erase,g);
1269 theCommandsArg.Add("2dclear","clear display (2d objects)",__FILE__,erase,g);
1270 theCommandsArg.Add("repaint","repaint, force redraw",__FILE__,repaintall,g);
1272 theCommandsArg.Add("dtyp", "dtyp name1 name2",__FILE__,whatis,g);
1273 theCommandsArg.Add("dval", "dval name, return value",__FILE__,value,g);
1274 theCommandsArg.Add("dname", "dname name, print name",__FILE__,dname,g);
1275 theCommandsArg.Add("dump", "dump name1 name2 ...",__FILE__,dump,g);
1276 theCommandsArg.Add("copy", "copy name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1277 // san - 02/08/2002 - `rename` command changed to `renamevar` since it conflicts with
1278 // the built-in Tcl command `rename`
1279 //theCommands.Add("rename","rename name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1280 theCommandsArg.Add("renamevar","renamevar name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1281 theCommandsArg.Add("dset","var1 value1 vr2 value2 ...",__FILE__,set,g);
1283 // commands to access C environment variables; see Mantis issue #23197
1284 theCommandsArg.Add("dgetenv","var : get value of environment variable in C subsystem",__FILE__,dgetenv,g);
1285 theCommandsArg.Add("dsetenv","var [value] : set (unset if value is empty) environment variable in C subsystem",__FILE__,dsetenv,g);
1287 theCommandsArg.Add("pick","pick id X Y Z b [nowait]",__FILE__,pick,g);
1288 theCommandsArg.Add("lastrep","lastrep id X Y [Z] b, return name",__FILE__,lastrep,g);