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 //===============================================
50 // dictionnary of variables
51 // Variables are stored in a map Integer, Transient
52 // The Integer Value is the content of the TCl variable
53 //===============================================
55 static NCollection_Map<Handle(Draw_Drawable3D)> theVariables;
57 //=======================================================================
58 //function : FindVariable
60 //=======================================================================
62 static Standard_Integer p_id;
63 static Standard_Integer p_X;
64 static Standard_Integer p_Y;
65 static Standard_Integer p_b;
66 static const char* p_Name = "";
69 static Draw_SaveAndRestore* Draw_First = NULL;
71 //=======================================================================
72 //function : Draw_SaveAndRestore
74 //=======================================================================
76 Draw_SaveAndRestore::Draw_SaveAndRestore
78 Standard_Boolean (*test)(const Handle(Draw_Drawable3D)&),
79 void (*save)(const Handle(Draw_Drawable3D)&, ostream&),
80 Handle(Draw_Drawable3D) (*restore) (istream&),
81 Standard_Boolean display) :
92 Standard_Boolean Draw_SaveAndRestore::Test(const Handle(Draw_Drawable3D)&d)
93 {return (*myTest) (d);}
95 void Draw_SaveAndRestore::Save(const Handle(Draw_Drawable3D)& d,
99 Handle(Draw_Drawable3D) Draw_SaveAndRestore::Restore(istream& is) const
100 {return (*myRestore) (is);}
102 //=======================================================================
103 // numeric save and restore
104 //=======================================================================
106 static Standard_Boolean numtest(const Handle(Draw_Drawable3D)& d)
108 return d->IsInstance(STANDARD_TYPE(Draw_Number));
111 static void numsave (const Handle(Draw_Drawable3D)& theDrawable,
114 Handle(Draw_Number) aNum = Handle(Draw_Number)::DownCast (theDrawable);
115 ios::fmtflags aFlags = theStream.flags();
116 theStream.setf (ios::scientific);
117 theStream.precision (15);
118 theStream.width (30);
119 theStream << aNum->Value() << "\n";
120 theStream.setf (aFlags);
123 static Handle(Draw_Drawable3D) numrestore (istream& is)
127 Handle(Draw_Number) N = new Draw_Number(val);
132 static Draw_SaveAndRestore numsr("Draw_Number",
133 numtest,numsave,numrestore,
136 //=======================================================================
138 //=======================================================================
140 static Standard_Integer save(Draw_Interpretor& di, Standard_Integer n, const char** a)
142 if (n <= 2) return 1;
144 const char* name = a[2];
147 OSD_OpenStream(os, name, ios::out);
148 if (!os.is_open() || !os.good())
150 di << "Cannot open file for writing "<<name;
154 Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
157 Draw_SaveAndRestore* tool = Draw_First;
158 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
159 progress->SetScale ( 0, 100, 1 );
160 progress->NewScope(100,"Writing");
164 if (tool->Test(D)) break;
168 os << tool->Name() << "\n";
169 Draw::SetProgressBar(progress);
174 di << "No method for saving " << a[1];
177 Draw::SetProgressBar( 0 );
178 progress->EndScope();
184 Standard_Boolean res = Standard_False;
188 res = os.good() && !errno;
191 di<<"File has not been written";
199 //=======================================================================
201 //=======================================================================
203 static Standard_Integer restore(Draw_Interpretor& di, Standard_Integer n, const char** a)
206 if (n <= 2) return 1;
208 const char* fname = a[1];
209 const char* name = a[2];
213 OSD_OpenStream (fic, fname, ios::in);
214 if (!fic.is_open()) {
215 di << "Cannot open file for reading : "<<fname;
223 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
224 progress->NewScope(100,"Reading");
227 Draw_SaveAndRestore* tool = Draw_First;
228 Draw_SaveAndRestore* aDBRepTool = NULL;
230 const char* toolName = tool->Name();
231 if (!strcmp(typ,toolName)) break;
232 if (!strcmp("DBRep_DrawableShape",toolName))
234 Draw::SetProgressBar(progress);
240 //assume that this file stores a DBRep_DrawableShape variable
242 in.seekg(0, ios::beg);
247 Handle(Draw_Drawable3D) D = tool->Restore(in);
248 Draw::Set(name,D,tool->Disp() && autodisp);
252 di << "Cannot restore a " << typ;
255 Draw::SetProgressBar( 0 );
256 progress->EndScope();
264 //=======================================================================
266 //=======================================================================
268 static Standard_Integer display(Draw_Interpretor& di, Standard_Integer n, const char** a)
270 if (n <= 1) return 1;
272 for (Standard_Integer i = 1; i < n; i++) {
273 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
285 //=======================================================================
286 // erase, clear, donly
287 //=======================================================================
289 static Standard_Integer erase(Draw_Interpretor& di, Standard_Integer n, const char** a)
291 static Standard_Boolean draw_erase_mute = Standard_False;
293 if (!strcasecmp(a[1],"-mute")) {
294 draw_erase_mute = Standard_True;
299 Standard_Boolean donly = !strcasecmp(a[0],"donly");
301 if (n <= 1 || donly) {
302 // clear, 2dclear, donly, erase (without arguments)
305 // solve the names for "." before erasing
307 for (i = 1; i < n; i++) {
308 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
310 if ((a[i][0] == '.') && (a[i][1] == '\0'))
311 cout << "Missed !!!" << endl;
317 // sauvegarde des proteges visibles
318 Draw_SequenceOfDrawable3D prot;
319 NCollection_Map<Handle(Draw_Drawable3D)>::Iterator aMapIt (theVariables);
320 for (; aMapIt.More(); aMapIt.Next()) {
321 const Handle(Draw_Drawable3D)& D = aMapIt.Key();
323 if (D->Protected() && D->Visible())
328 // effacement de toutes les variables
329 Standard_Integer erasemode = 1;
330 if (a[0][0] == '2') erasemode = 2;
331 if (a[0][0] == 'c') erasemode = 3;
333 // effacement des graphiques non variables
336 else if (erasemode == 3)
341 // affichage pour donly
343 for (i = 1; i < n; i++) {
344 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
348 if (!draw_erase_mute) di << a[i] << " ";
354 // afficahge des proteges
355 for (i = 1; i <= prot.Length(); i++)
361 for (Standard_Integer i = 1; i < n; i++) {
362 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
365 dout.RemoveDrawable(D);
366 if (!draw_erase_mute) di << D->Name() << " ";
373 draw_erase_mute = Standard_False;
374 repaint2d = Standard_False;
375 repaint3d = Standard_False;
382 //=======================================================================
384 //=======================================================================
386 static Standard_Integer draw(Draw_Interpretor& , Standard_Integer n, const char** a)
389 Standard_Integer id = Draw::Atoi(a[1]);
390 if (!dout.HasView(id)) {
391 cout << "bad view number in draw"<<endl;
394 Standard_Integer mo = Draw::Atoi(a[2]);
395 Draw_Display d = dout.MakeDisplay(id);
398 for (i = 3; i < n; i++) {
399 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
400 if (!D.IsNull()) D->DrawOn(d);
406 //=======================================================================
407 // protect, unprotect
408 //=======================================================================
410 static Standard_Integer protect(Draw_Interpretor& di, Standard_Integer n, const char** a)
412 if (n <= 1) return 1;
413 Standard_Boolean prot = *a[0] != 'u';
414 for (Standard_Integer i = 1; i < n; i++) {
415 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
424 //=======================================================================
426 //=======================================================================
428 static Standard_Integer autodisplay(Draw_Interpretor& di, Standard_Integer n, const char** a)
431 autodisp = !autodisp;
433 autodisp = !(!strcasecmp(a[1],"0"));
444 //=======================================================================
446 //=======================================================================
448 static Standard_Integer whatis(Draw_Interpretor& di, Standard_Integer n, const char** a)
450 if (n <= 1) return 1;
451 for (Standard_Integer i = 1; i < n; i++) {
452 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
461 //=======================================================================
463 //=======================================================================
465 static Standard_Integer value(Draw_Interpretor& di, Standard_Integer n, const char** a)
467 if (n != 2) return 1;
468 di << Draw::Atof(a[1]);
473 //=======================================================================
476 //=======================================================================
477 static Standard_Integer dname(Draw_Interpretor& di, Standard_Integer n, const char** a)
483 Standard_PCharacter pC;
485 Handle(Draw_Drawable3D) aD;
487 for (i = 1; i < n; ++i) {
488 aD = Draw::Get(a[i]);
490 //modified by NIZNHY-PKV Tue Jun 10 10:18:13 2008f
492 pC=(Standard_PCharacter)aD->Name();
494 //modified by NIZNHY-PKV Tue Jun 10 10:18:18 2008t
500 //=======================================================================
502 //=======================================================================
505 static Standard_Integer dump(Draw_Interpretor& DI, Standard_Integer n, const char** a)
509 for (i = 1; i < n; i++) {
510 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
512 Standard_SStream sss;
514 sss << "\n\n*********** Dump of " << a[i] << " *************\n";
522 //=======================================================================
524 //=======================================================================
526 static Standard_Integer copy(Draw_Interpretor& , Standard_Integer n, const char** a)
529 Standard_Boolean cop = !strcasecmp(a[0],"copy");
531 Handle(Draw_Drawable3D) D;
532 for (Standard_Integer i = 1; i < n; i += 2) {
533 if (i+1 >= n) return 0;
540 Draw::Set(a[i],Handle(Draw_Drawable3D)());
548 //=======================================================================
551 //=======================================================================
553 static Standard_Integer repaintall(Draw_Interpretor& , Standard_Integer , const char** )
555 if (repaint2d) dout.Repaint2D();
556 repaint2d = Standard_False;
557 if (repaint3d) dout.Repaint3D();
558 repaint3d = Standard_False;
563 //=======================================================================
566 //=======================================================================
568 static Standard_Integer set(Draw_Interpretor& di, Standard_Integer n, const char** a)
571 Standard_Integer i = 1;
573 for (i = 1; i < n; i += 2) {
575 if (i+1 < n) val = Draw::Atof(a[i+1]);
582 //=======================================================================
585 //=======================================================================
587 static Standard_Integer dsetenv(Draw_Interpretor& /*di*/, Standard_Integer argc, const char** argv)
590 cout << "Use: " << argv[0] << " {varname} [value]" << endl;
594 OSD_Environment env (argv[1]);
595 if (argc > 2 && argv[2][0] != '\0')
597 env.SetValue (argv[2]);
605 //=======================================================================
608 //=======================================================================
610 static Standard_Integer dgetenv(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
613 cout << "Use: " << argv[0] << " {varname}" << endl;
617 const char* val = getenv (argv[1]);
618 di << ( val ? val : "" );
622 //=======================================================================
625 //=======================================================================
627 static Standard_Integer isdraw(Draw_Interpretor& di, Standard_Integer n, const char** a)
629 if (n != 2) return 1;
630 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
638 //=======================================================================
641 //=======================================================================
643 Standard_Integer isprot(Draw_Interpretor& di, Standard_Integer n, const char** a)
645 if (n != 2) return 1;
646 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
659 //=======================================================================
662 //=======================================================================
664 static Standard_Integer pick(Draw_Interpretor& , Standard_Integer n, const char** a)
668 Standard_Integer X,Y,b;
669 Standard_Boolean wait = (n == 6);
670 if (!wait) id = Draw::Atoi(a[1]);
671 dout.Select(id,X,Y,b,wait);
672 Standard_Real z = dout.Zoom(id);
673 gp_Pnt P((Standard_Real)X /z,(Standard_Real)Y /z,0);
679 Draw::Set(a[2],P.X());
680 Draw::Set(a[3],P.Y());
681 Draw::Set(a[4],P.Z());
687 //=======================================================================
690 //=======================================================================
692 static Standard_Integer lastrep(Draw_Interpretor& di, Standard_Integer n, const char** a)
696 Draw::Set(a[1],p_id);
702 Standard_Real z = dout.Zoom(p_id);
703 gp_Pnt P((Standard_Real)p_X /z,(Standard_Real)p_Y /z,0);
705 dout.GetTrsf(p_id,T);
708 Draw::Set(a[2],P.X());
709 Draw::Set(a[3],P.Y());
710 Draw::Set(a[4],P.Z());
713 di << "Too many args";
716 Draw::Set(a[n-1],p_b);
722 //=======================================================================
725 //=======================================================================
726 void Draw::Set(const Standard_CString name,
727 const Handle(Draw_Drawable3D)& D)
729 Draw::Set(name,D,autodisp);
733 static char* tracevar(ClientData CD, Tcl_Interp*,const char* name,const char*, int)
735 // protect if the map was destroyed before the interpretor
736 if (theVariables.IsEmpty()) return NULL;
738 Draw_Interpretor& aCommands = Draw::GetInterpretor();
740 // MSV 9.10.14 CR25344
741 Handle(Draw_Drawable3D) D(reinterpret_cast<Draw_Drawable3D*>(CD));
743 Tcl_UntraceVar(aCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
747 if (D->Protected()) {
748 D->Name(Tcl_SetVar(aCommands.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(aCommands.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 Draw_Interpretor& aCommands = Draw::GetInterpretor();
775 if ((name[0] == '.') && (name[1] == '\0')) {
777 dout.RemoveDrawable(D);
778 if (displ) dout << D;
782 // Check if the variable with the same name exists
784 Tcl_VarTraceInfo(aCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
786 Handle(Draw_Drawable3D) anOldD(reinterpret_cast<Draw_Drawable3D*>(aCD));
787 if (!anOldD.IsNull()) {
788 if (theVariables.Contains(anOldD) && anOldD->Protected()) {
789 cout << "variable is protected" << endl;
795 Tcl_UnsetVar(aCommands.Interp(),name,0);
799 D->Name(Tcl_SetVar(aCommands.Interp(),name,name,0));
801 // set the trace function
802 Tcl_TraceVar(aCommands.Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
803 tracevar,reinterpret_cast<ClientData>(D.operator->()));
808 else if (D->Visible())
809 dout.RemoveDrawable(D);
813 //=======================================================================
816 //=======================================================================
817 void Draw::Set(const Standard_CString Name, const Standard_Real val)
819 if ((Name[0] == '.') && (Name[1] == '\0')) return;
820 Standard_CString aName = Name;
821 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
822 Handle(Draw_Number) N;
824 N = Handle(Draw_Number)::DownCast(D);
827 N = new Draw_Number(val);
828 Draw::Set(aName,N,Standard_False);
833 //=======================================================================
836 //=======================================================================
837 Handle(Draw_Drawable3D) Draw::Get(Standard_CString& name,
838 const Standard_Boolean )
840 Standard_Boolean pick = ((name[0] == '.') && (name[1] == '\0'));
841 Handle(Draw_Drawable3D) D;
843 cout << "Pick an object" << endl;
844 dout.Select(p_id,p_X,p_Y,p_b);
845 dout.Pick(p_id,p_X,p_Y,5,D,0);
848 name = p_Name = D->Name();
849 //p_Name = (char *)D->Name();
855 Tcl_VarTraceInfo(Draw::GetInterpretor().Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
857 D = reinterpret_cast<Draw_Drawable3D*>(aCD);
858 if (!theVariables.Contains(D))
861 if (D.IsNull() && complain)
862 cout <<name<<" does not exist"<<endl;
868 //=======================================================================
871 //=======================================================================
872 Standard_Boolean Draw::Get(const Standard_CString name,
875 if ((name[0] == '.') && (name[1] == '\0')) {
876 return Standard_False;
878 Standard_CString aName = name;
879 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
881 Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(D);
884 return Standard_True;
887 return Standard_False;
890 //=======================================================================
891 //function : LastPick
893 //=======================================================================
894 void Draw::LastPick(Standard_Integer& view,
897 Standard_Integer& button)
904 //=======================================================================
907 //=======================================================================
910 repaint2d = Standard_True;
911 repaint3d = Standard_True;
914 //=======================================================================
915 //function : trigonometric functions
917 //=======================================================================
919 //static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer n, const char** a)
920 static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer , const char** a)
923 Standard_Real x = Draw::Atof(a[1]);
925 if (!strcasecmp(a[0],"cos"))
927 else if (!strcasecmp(a[0],"sin"))
929 else if (!strcasecmp(a[0],"tan"))
931 else if (!strcasecmp(a[0],"sqrt"))
933 else if (!strcasecmp(a[0],"acos"))
935 else if (!strcasecmp(a[0],"asin"))
937 else if (!strcasecmp(a[0],"atan2"))
938 di << ATan2(x,Draw::Atof(a[2]));
944 //=======================================================================
946 //=======================================================================
948 static Standard_Boolean Numeric(char c)
950 return (c == '.' || (c >= '0' && c <= '9'));
953 static Standard_Boolean Alphabetic(char c)
955 return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_'));
958 static Standard_Real Parse(char*&);
960 static Standard_Real ParseValue(char*& name)
962 while (*name == ' ' || *name == '\t') name++;
973 cout << "Mismatched parenthesis" << endl;
979 x = ParseValue(name);
984 x = - ParseValue(name);
992 while (Numeric(*p)) p++;
993 // process scientific notation
994 if ((*p == 'e') || (*p == 'E')) {
995 if (Numeric(*(p+1)) || *(p+1) == '+' || *(p+1) == '-')
998 while (Numeric(*p) || Alphabetic(*p)) p++;
1002 if (Numeric(*name)) // numeric litteral
1004 else if (!Draw::Get((Standard_CString) name,x)) { // variable
1006 // search for a function ...
1009 Standard_Integer argc = 1;
1011 while ((*q == ' ') || (*q == '\t')) q++;
1013 Standard_Integer pc = 1;
1016 while ((pc > 0) && *q) {
1017 if (*q == '(') pc++;
1018 if (*q == ')') pc--;
1019 if ((pc == 1) && (*q == ',')) argc++;
1023 cout << "Unclosed parenthesis"<< endl;
1027 // build function call
1028 // replace , and first and last () by space
1030 Standard_Integer i = 2;
1031 while (*p != '(') p++;
1036 if (*p == '(') pc++;
1037 if (*p == ')') pc--;
1038 if ((pc == 1) && (*p == ',')) {
1049 Draw_Interpretor& aCommands = Draw::GetInterpretor();
1051 // call the function, save the current result
1053 if (*aCommands.Result()) {
1054 sv = new char [strlen(aCommands.Result())];
1055 strcpy(sv,aCommands.Result());
1058 if (aCommands.Eval(name) != 0) {
1059 cout << "Call of function " << name << " failed" << endl;
1063 x = Atof(aCommands.Result());
1073 Draw_ParseFailed = Standard_True;
1081 while (*name == ' ' || *name == '\t') name++;
1086 static Standard_Real ParseFactor(char*& name)
1088 Standard_Real x = ParseValue(name);
1092 if (c == '\0') return x;
1097 x *= ParseValue(name);
1101 x /= ParseValue(name);
1112 static Standard_Real Parse(char*& name)
1114 Standard_Real x = ParseFactor(name);
1118 if (c == '\0') return x;
1123 x += ParseFactor(name);
1127 x -= ParseFactor(name);
1137 //=======================================================================
1140 //=======================================================================
1141 Standard_Real Draw::Atof(const Standard_CString name)
1144 char* n = new char[1+strlen(name)];
1147 Standard_Real x = Parse(n);
1148 while ((*n == ' ') || (*n == '\t')) n++;
1149 if (*n) Draw_ParseFailed = Standard_True;
1154 Standard_Integer Draw::Atoi(const Standard_CString name)
1156 return (Standard_Integer ) Draw::Atof(name);
1158 //=======================================================================
1160 //purpose : set a TCL var
1161 //=======================================================================
1162 void Draw::Set(const Standard_CString Name, const Standard_CString val)
1164 Standard_PCharacter pName, pVal;
1166 pName=(Standard_PCharacter)Name;
1167 pVal=(Standard_PCharacter)val;
1169 Tcl_SetVar(Draw::GetInterpretor().Interp(), pName, pVal, 0);
1171 //=======================================================================
1172 // Command management
1173 // refresh the screen
1174 //=======================================================================
1176 static void before()
1178 repaint2d = Standard_False;
1179 repaint3d = Standard_False;
1182 void Draw_RepaintNowIfNecessary()
1184 if (repaint2d) dout.Repaint2D();
1185 if (repaint3d) dout.Repaint3D();
1186 repaint2d = Standard_False;
1187 repaint3d = Standard_False;
1190 static void after(Standard_Integer)
1192 Draw_RepaintNowIfNecessary();
1195 extern void (*Draw_BeforeCommand)();
1196 extern void (*Draw_AfterCommand)(Standard_Integer);
1199 //=======================================================================
1200 //function : Commands
1202 //=======================================================================
1203 void Draw::VariableCommands(Draw_Interpretor& theCommandsArg)
1205 static Standard_Boolean Done = Standard_False;
1207 Done = Standard_True;
1209 // set up start and stop command
1210 Draw_BeforeCommand = &before;
1211 Draw_AfterCommand = &after;
1213 // set up some variables
1216 Handle(Draw_Axis3D) theAxes3d = new Draw_Axis3D(gp_Pnt(0,0,0),Draw_bleu,20);
1218 Draw::Set(n,theAxes3d);
1219 theAxes3d->Protected(Standard_True);
1221 Handle(Draw_Axis2D) theAxes2d = new Draw_Axis2D(gp_Pnt2d(0,0),Draw_bleu,20);
1223 Draw::Set(n,theAxes2d);
1224 theAxes2d->Protected(Standard_True);
1228 Draw::Get(n)->Protected(Standard_True);
1231 Draw::Set(n,RealLast());
1232 Draw::Get(n)->Protected(Standard_True);
1235 Draw::Set(n,RealFirst());
1236 Draw::Get(n)->Protected(Standard_True);
1239 Handle(Draw_Grid) theGrid = new Draw_Grid();
1240 Draw::Set(n, theGrid);
1241 theGrid->Protected(Standard_True);
1246 g = "DRAW Numeric functions";
1248 theCommandsArg.Add("cos" ,"cos(x)" ,__FILE__,trigo,g);
1249 theCommandsArg.Add("sin" ,"sin(x)" ,__FILE__,trigo,g);
1250 theCommandsArg.Add("tan" ,"tan(x)" ,__FILE__,trigo,g);
1251 theCommandsArg.Add("acos" ,"acos(x)" ,__FILE__,trigo,g);
1252 theCommandsArg.Add("asin" ,"asin(x)" ,__FILE__,trigo,g);
1253 theCommandsArg.Add("atan2" ,"atan2(x,y)" ,__FILE__,trigo,g);
1254 theCommandsArg.Add("sqrt","sqrt(x)",__FILE__,trigo,g);
1256 g = "DRAW Variables management";
1258 theCommandsArg.Add("protect","protect name ...",__FILE__,protect,g);
1259 theCommandsArg.Add("unprotect","unprotect name ...",__FILE__,protect,g);
1261 theCommandsArg.Add("bsave","bsave name filename",__FILE__,save,g);
1262 theCommandsArg.Add("brestore","brestore filename name",__FILE__,restore,g);
1264 theCommandsArg.Add("isdraw","isdraw var, return 1 if Draw value",__FILE__,isdraw,g);
1265 theCommandsArg.Add("isprot","isprot var, return 1 if Draw var is protected",__FILE__,isprot,g);
1267 theCommandsArg.Add("autodisplay","toggle autodisplay [0/1]",__FILE__,autodisplay,g);
1268 theCommandsArg.Add("display","display [name1 name2 ...], no names display all",__FILE__,display,g);
1269 theCommandsArg.Add("donly","donly [name1 name2 ...], erase and display",__FILE__,erase,g);
1270 theCommandsArg.Add("erase","erase [name1 name2 ...], no names erase all",__FILE__,erase,g);
1271 theCommandsArg.Add("draw","draw view mode [name1 name2 ...], draw on view with mode",__FILE__,draw,g);
1272 theCommandsArg.Add("clear","clear display",__FILE__,erase,g);
1273 theCommandsArg.Add("2dclear","clear display (2d objects)",__FILE__,erase,g);
1274 theCommandsArg.Add("repaint","repaint, force redraw",__FILE__,repaintall,g);
1276 theCommandsArg.Add("dtyp", "dtyp name1 name2",__FILE__,whatis,g);
1277 theCommandsArg.Add("dval", "dval name, return value",__FILE__,value,g);
1278 theCommandsArg.Add("dname", "dname name, print name",__FILE__,dname,g);
1279 theCommandsArg.Add("dump", "dump name1 name2 ...",__FILE__,dump,g);
1280 theCommandsArg.Add("copy", "copy name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1281 // san - 02/08/2002 - `rename` command changed to `renamevar` since it conflicts with
1282 // the built-in Tcl command `rename`
1283 //theCommands.Add("rename","rename name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1284 theCommandsArg.Add("renamevar","renamevar name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1285 theCommandsArg.Add("dset","var1 value1 vr2 value2 ...",__FILE__,set,g);
1287 // commands to access C environment variables; see Mantis issue #23197
1288 theCommandsArg.Add("dgetenv","var : get value of environment variable in C subsystem",__FILE__,dgetenv,g);
1289 theCommandsArg.Add("dsetenv","var [value] : set (unset if value is empty) environment variable in C subsystem",__FILE__,dsetenv,g);
1291 theCommandsArg.Add("pick","pick id X Y Z b [nowait]",__FILE__,pick,g);
1292 theCommandsArg.Add("lastrep","lastrep id X Y [Z] b, return name",__FILE__,lastrep,g);