// Created by: DAUTRY Philippe // Copyright (c) 1997-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _MSC_VER #include #endif //======================================================================= //function : DFBrowse //purpose : // arg 1 : DF name // [arg 2] : Browser name //======================================================================= static Standard_Integer DFBrowse (Draw_Interpretor& di, Standard_Integer n, const char** a) { if (n<2) { cout << "Use: " << a[0] << " document [brower_name]" << endl; return 1; } Handle(TDF_Data) DF; if (!DDF::GetDF (a[1], DF)) { cout << "Error: document " << a[1] << " is not found" << endl; return 1; } Handle(DDF_Browser) NewDDFBrowser = new DDF_Browser(DF); TCollection_AsciiString name("browser_"); name += ((n == 3)? a[2] : a[1]); Draw::Set (name.ToCString(), NewDDFBrowser); // Load Tcl Script TCollection_AsciiString aTclScript (getenv ("CSF_DrawPluginDefaults")); aTclScript.AssignCat ( "/dftree.tcl" ); OSD_File aTclScriptFile (aTclScript); if (aTclScriptFile.Exists()) { #ifdef OCCT_DEBUG cout << "Load " << aTclScript << endl; #endif di.EvalFile( aTclScript.ToCString() ); } else { cout << "Error: Could not load script " << aTclScript << endl; cout << "Check environment variable CSF_DrawPluginDefaults" << endl; } // Call command dftree defined in dftree.tcl TCollection_AsciiString aCommand = "dftree "; aCommand.AssignCat(name); di.Eval(aCommand.ToCString()); return 0; } //======================================================================= //function : DFOpenLabel //purpose : // arg 1 : Browser name // [arg 2] : Label name //======================================================================= static Standard_Integer DFOpenLabel (Draw_Interpretor& di, Standard_Integer n, const char** a) { if (n < 2) return 1; Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True)); TDF_Label lab; if (n == 3) TDF_Tool::Label(browser->Data(),a[2],lab); TCollection_AsciiString list(lab.IsNull()? browser->OpenRoot() : browser->OpenLabel(lab)); di<Data(),a[2],lab); if (lab.IsNull()) return 1; TCollection_AsciiString list(browser->OpenAttributeList(lab)); di << list.ToCString(); return 0; } //======================================================================= //function : DFOpenAttribute //purpose : // arg 1 : Browser name // arg 2 : Attribute index //======================================================================= static Standard_Integer DFOpenAttribute (Draw_Interpretor& di, Standard_Integer n, const char** a) { if (n < 3) return 1; Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True)); const Standard_Integer index = Draw::Atoi(a[2]); TCollection_AsciiString list = browser->OpenAttribute(index); di<