ironpython

revitapi ironpython ToRoom returns “indexer # object”

一曲冷凌霜 提交于 2019-12-10 22:46:20
问题 in revit api i am trying to access the ToRoom / FromRoom properties for doors. the simplified code snippet in ironpython: fc = FilteredElementCollector(doc) doors = fc.OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType().ToElements() for door in doors: froom = door.FromRoom my result is an "indexer # object at 0x0000000000035" how can i access the room object from here? 回答1: This is an IronPython / funky Revit API issue. Basically, the way FromRoom is defined, it can be either

IronPython / C# I can't reopen a serial port after Script has been run

亡梦爱人 提交于 2019-12-10 22:24:40
问题 The program "Mission Planner" allows python scripts to be ran in order to customize the behavior of the program. The "Mission Planner" runs the script in its own thread. When the thread is running I have the option to press the abort button which calls "Thread.Abort()" within "Mission Planner". When I press this button the script aborts but when I run the script again I cannot open the serial port this time. I believe it is because the thread aborts before closing the serial port. Is there a

What is required to use ipython in ironpython?

妖精的绣舞 提交于 2019-12-10 21:29:59
问题 I'd love to use IronPython to explore the .net runtime and libraries, but coming from CPython I miss IPython's completion and shortcuts. Last time I checked IPython couldn't be used due to a lack of sys.getframe, but the latest beta versions included support for it. Is there anything lacking? Can one start to use IPython with IronPython, and if so, what must one do? 回答1: There were some issues in 2.6 Beta 1 which prevented it from work - see http://lists.ironpython.com/pipermail/users

C# monkey patching - is it possible?

巧了我就是萌 提交于 2019-12-10 19:23:52
问题 Is it possible to write a C# assembly which when loaded will inject a method into a class from another assembly? If yes, will the injected method be available from languages using DLR, like IronPython? namespace IronPython.Runtime { public class Bytes : IList<byte>, ICodeFormattable, IExpressionSerializable { internal byte[] _bytes; //I WANT TO INJECT THIS METHOD public byte[] getbytes() { return _bytes; } } } I need that method, and I would like to avoid recompiling IronPython if possible.

Unable to get a block of code into my regex match groups

故事扮演 提交于 2019-12-10 19:08:59
问题 So yeah, the title is pretty weird but I have no other idea how to describe my problem properly. Whatever... lets get to the problem. Job to get done My boss wants a function that read all functions of a python file and return a DataTable containing the found functions. This function should be written in IronPython (Python which actually uses C# libraries). The Problem I am relatively new to Python and I have no idea what this language is capable of, so I started to write my function and yeah

Calling C# object from IronPython

别来无恙 提交于 2019-12-10 18:58:26
问题 I have the following C# code to compile it into MyMath.dll assembly. namespace MyMath { public class Arith { public Arith() {} public int Add(int x, int y) { return x + y; } } } And I have the following IronPython code to use this object. import clr clr.AddReferenceToFile("MyMath.dll") import MyMath arith = Arith() print arith.Add(10,20) When I run this code with IronPython, I get the following error. Traceback (most recent call last): File ipycallcs, line unknown, in Initialize NameError:

Is IronPython usable as a replacement for CPython?

前提是你 提交于 2019-12-10 17:18:49
问题 Has IronPython gotten to a point where you can just drop it in as a replacement for CPython? To clarify: I mean can IronPython run applications originally written for CPython (no .NET involved, of course) 回答1: Yes, pretty much, at least on Windows with "real" (Microsoft) .NET underneath. If you're depending on C-coded extensions, chances are that ironclad can bail you out; you get 2.6 support, just about every CPython standard library or third-party extension module (maybe not trivial for

Spotfire IronPython Script to Scroll through a Filter and Update a Visualization Each Step (Play Button through Date Ranges)

荒凉一梦 提交于 2019-12-10 15:56:19
问题 Morning Everyone, I've been working on this issue for a couple of days and I can't figure out a fix. I've researched and googled to no avail. Any help/insight would be greatly appreciated. I am trying to create a button that when clicked will automatically go through a Date filter (starting on 1/1/15 say) and go through 1/2 -1/5 updating a map with the newly filtered marker layer as it steps through the function. I have gotten the filter to step through 1/1-1/5; however, it doesn't update the

IronPython use C# module documentation

你。 提交于 2019-12-10 15:34:54
问题 I have a C# module which can be imported into IronPython (well, technically the all can, but one that's meant to be imported). However, the default help used for C# modules by IronPython just isn't sufficient enough. Is there a way to grab and attach the VS exported xml documentation to a C# module with IronPython's help system? Or is there some way in the C# code to specify what IronPython should put in lieu of the default documentation? 回答1: If the XML file is in the same location as the

IronPython import performance with compiled code

ぐ巨炮叔叔 提交于 2019-12-10 11:35:45
问题 I am doing some experiments with IronPython 2.6.1 and the clr.CompileModules function to compile my large scripts into assemblies. Testing has shown good cold start performance performance improvements but in some cases importing the compiled module is actually slower than executing a large string that represents my code in some cases. My question is, if i use something like scope.Engine.Execute(string.Format("from {0} import {0}", theModule), scope); or the ImportModule function, even though