Looking at this is in my backlog… Which is large, ever expanding, and has to be triaged based on my day job, impact of solution, ask, time needed to implement, and the like. Maybe later tonight or if I boot up the work laptop over the weekend.
It might be easier to copy the entire floor to the new location/level since you are bulk grabbing the curves.
So I dug into this in conjunction with another thing which was easy. Figured “that’ll be a five minute fix now, super easy!” Well… I figured wrong.
This kinda works, fairly consistently in IronPython2.7. But not consistently in CPython, due to some really crazy stuff in the IFailuresPreprocessor Interface class, which is a requirement to get into when you edit a sketch (there are too many things which can fail for it to not have that extra check to prevent the copy if you’ve done something silly). But this mostly works. If the sketch edit fails you may find your system gets ‘stuck’ in sketch edit mode, which stinks as you can’t cancel the operation in the UI for some reason. Also you may find subsequent runs create a duplicate copy of the sketch lines producing an error… think this is a function of the custom class being poorly implemented on my part, or perhaps the sketch edit API really doesn’t like not being compiled at run time… again, this mostly works, but just in case you should sync often.
It currently only does one set of sketch lines to another; if you need more you will want to wrap it in a custom node or add a looping mechanism in the code.
As underwhelming as that may all sound, it’s really nice looking when it works. Go ahead and give it a go, and let me know how it works out.
That would require adding new stuff into the code base, which wasn’t my intent to build. In your case you want the exact same floor at the next level, why not copy the element with the desired shape and deleting the incorrect shape to that level instead of editing the incorrectly shaped one? Easily 10x more stable and reliable.
Oh, then i don´t even know what the intended use of your code is, can you explain please?
It was a request of my coworkers to update sketchlines by the sketch lines of another floor. We are talking about a finished model with finished plans. Deleting a floor will mess up everything i guess (annotations, dimensioning, connections, etc…).
Some issues should be resolved with the upcoming release of PythonNet 3.0.
For the Interfaces it would seem that the instances remain in memory (not Disposable?) and this during the entire Revit session (because the CPython3 interpreter is active during the entire Revit session, once executed)
Add a few openings in slab B which are not in slab A. Run the code. Openings move from A to B.
As noted above and in the Python notes… there is a lot which will prevent execution. Of the infinite possible sets of lines being moved over, a sizable fraction of them will cause an error (anything crosses, anything not closed, anything touching except at an end point, etc.) Unfortunately type of error handling isn’t going to come easy enough that it instantly comes together on a Friday night in conjunction with the larger build out.
If the intent is to simply wipe the old sketch that could be added without as much work, but that is a larger update as removing elements will create it’s own issues in the code sequencing (I think an error may be returned if a sketch is empty even if a transaction is open… or at least that used to be the case the last time I hacked at this stuff pre sketch API).
I’ll see if it is a quick enough fix all the same at some point next week.
That was the intent. Might not be exactly your use case but it was pretty much perfect for the other case (where non-aligned floors wanted an aligned elevator shaft, copying the outline of the pit slab to every other level so the shaft wall could run continuously).
First use: Copy lines to show overlapping making a non-issue.
Second use: Completely overwrite old sketch, making the new shape instead.
Third use: Moving sketch lines between non-parallel sketch planes… That wasn’t a part of the stated request but this is my free time and I had an need for this on a project back when I was practicing, so why not go crazy with it?
There are some limits, and be certain that the edited shape doesn’t lose any hosted elements (ie: doors in a wall that no longer touches the door’s insertion point) and other dependent elements (ie: I am not sure that there isn’t a situation where a model line somehow hosted open the sketch but outside the sketch itself could be removed - initial testing shows it is ok). I have provided the previous curves as well as a list of the actual model elements which were removed from the model as a ‘undoable check’ should there be a future need for debugging this.