cs-script
cs-script copied to clipboard
cs referencing hell
Hi Oleg :)
Thanks for this thing. At the moment i try to add scripting to revit. I am not the c# hero and the only way to enhance revit is to load a dll - Autodesk said. That you can forget cause even on a fast com that will need 3 minutes. Not a option
I managed to add one cs file to my revit code.
BTW: The roslyn engine does not work out of revit due dll restrictions
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom; CSScript.EvaluatorConfig.DebugBuild = true; string path = System.IO.Path.GetDirectoryName(mainfile); CSScript.GlobalSettings.AddSearchDir(Path.GetFullPath(path)); //csscriptlibdir CSScript.GlobalSettings.AddSearchDir(csscriptlibdir); //csscriptlibdir
dynamic script = CSScript.Evaluator
.ReferenceAssembliesFromCode(code)
.ReferenceAssembly(Assembly.GetExecutingAssembly())
.ReferenceAssembly(Assembly.GetExecutingAssembly().Location)
.ReferenceDomainAssemblies()
.LoadCode(code);
well that works so far. I can adress revit entitys and do my engineering stuff on a limited base.
But i know sooner or later i will have a real monster of single code file... Last times as i do something similar with autocad i end up after a "few" years with 380 files...
What i want is to modularize my code by single files :)
main.cs vactor.cs ... whatever.cs
most prefereable by subfolders (380 files in a folder are also no gift)
main.cs .\lib\math\vector.cs .\lib\math\math.cs .\lib\util... .\lib\div\whatever.cs
Sorry can you please provide a sample for a hosted csscript ? in my case i wrote a revit extension dll which just lay out everything to cs-script which works fine. I can load the extension and execute ONE cs file which does not care about search folders and whatever
Greetings from germany Thomas