Sketch Lines - Edit, Copy, Paste

Wow, thats amazing Jacob, thank you for your work!
Now I’m sad that i have to wait until I’m back in the office on Monday to test it^^

1 Like

Hello Jacob,

The script works great for floors that are no structural floors.
With structural floors i get the error that there is no span direction defined for the target floor.
Is it possible to also copy the span direction to the target floor?

It´s great that you made 3 seperate python codes and i get the curves and can do with them what i want. :slight_smile:

Even if i only want to transfer the opening in the middle of the floor it doesn’t work because of the span direction.

Should i go the workaround of setting the floor to not structural and then back to structural, or will there be a better solution?

That might be best for now as I do not know if the sketch lines have a ‘defines structural span’ property. I will look later though.

For adding in the opening, does the prior bit of Python work?

1 Like

So setting structural before and after works fine :slight_smile:

but i failed at copying just a opening and not the outline:

I got it working by using the outline of the target view:

:smiley:

Can you please explain why “pull onto plane” is necessary?

The sketch lines have to be on the sketch plane which defines the element itself, otherwise the API can’t interpolate how the shape should be extruded. You’ll notice that in the API you can’t draw the curves defining a profile loop on another work plane.

The wall example in the GIF above should give a rather extreme case as to why - the source wall was out of plumb with the target, and now we get a oval shape instead of a circle for the opening.

1 Like

Jacob, i found a complex slab for testing, but i have a problem with the polycurves.
Curve produced more than one WIRE in polycurve.
It is only the very long line on index 8 that makes troubles.
Could this have to do anything with your “Get Curves Sketch” or should I open another thread for that problem?

Kind Regards :slight_smile:

It’s another problem by the looks of it. Be sure to post the RVT with that slab and the DYN to that point. I may be able to edit the sketch lines to produce loops but that’s awhile out.

1 Like

This is just Great!! Why did I miss it?

I’ve tested your script, and I found that it works fine for every floors, but for the walls which were just created and never been profile edited, it doesn’t work.
For these walls, it works after the walls just entered Edit-Profile mode and Reset-Profile button activated even if no profile changed.
Am I right?

Correct. Walls (or anything really) without a profile need to have such added first. Not sure if that is an option in the API at this time, but it’s on my list of things to review (LOTS of work stuff on my plate right now so don’t wait for me if it is something you need or want :slight_smile: )

2 Likes

@jacob.small I found a method DoubleClickTarget Enumeration which seems that it makes the code enter edit mode by double clicking target.
What if the code can activate Reset-Profile by double clicking and finish the mode without editing?
I think it should be a workaround if it’s possible.
I’d like to try it but I’m not good at using API in python script. :sob:

@Hyunu_Kim That might work, but it would then require the end user click ‘ok’ on the sketch before you could move onto other documents, which means we would be required to use the Revit user interface in each item we run the check on, which means we can’t process a list, which is very un-Dynamo in nature so I’d go a different root.

I am at an Autodesk conference this week, just started a new role at Autodesk last week, and have a lot of my usual responsibilities from the old role, my usual voluntary and outreach stuff ongoing, and a few ‘new job’ efforts going on so I can’t take the deep dive, but I can give my usual guidance to someone who wants to try to do so, and doubly so if they want to learn how to do this type of work on their own… you appear to meet those last two requirements so in that vein below is a list of steps I would tackle the first attempt at making this work, using some non-formatted Python where I felt like it could come in handy.

Try this:

Use a select model elements to select two walls, one with the edited sketch and one without. Then copy one of my Python nodes, open it up, and try the following (read everything through before you start, remember to check the comments carefully, and note that the comments you leave will make your next edit that much easier if you are overly clear in your documentation):

  1. The line which imports the necessary sections from the Autodesk.Revit.DB class should include the Wall class (or change it to a wild card).
  2. The inputs get wiped out
  3. define the variable “wallList” as something like wallList = UnwrapElement(IN[0])
  4. Read up on the CreateProfileSketch method to convert to a non-sketch based element to a sketch based one CreateProfileSketch Method
  5. everything after the inputs and before the transactions gets wiped out.
  6. everything between the transaction nodes gets wiped out
  7. define the variable outcomes as an empty list something like outcomes =
  8. inside the transaction, start a new for loop along the lines of “for wll in wallList: “
  9. in the offset line below start a new ‘try:’ statement
  10. in the twice offset line below call the convert method on the wll object as the variable ‘attempt’, something like attempt = wll. CreateProfileSketch()
  11. append the resulting attempt to the outcomes list using something like outcomes.append(attempt)
  12. slide back to the “try” level, and start the ‘except:’
  13. in the doubly offset line below set the attempt variable to a handle failure message, something like ‘attempt = “well this didn’t work but I am not sure why yet” ’
  14. append the resulting attempt to the outcomes list using something like outcomes.append(attempt)
  15. after the transaction end line we only need to ensure our walls are passed along to the Dynamo environment, so clear everything after the transaction ending to the end of the code
  16. define our output as something like OUT = outcomes

Make sure you save often to keep things from getting lost should you crash; that is the Python code and the DYN - if you only do one you might lose work.

This will NOT allow the sketch to be edited in the same dynamo run, as per the remarks section of the CreateProfileSketch… but if you can’t make it work by itself is then you can’t make it work as part of the larger workflow… so baby steps we go. :slight_smile:

If you (or anyone else feeling adventurous) give it a shot let me know.

1 Like

@jacob.small I just tried what you suggested. but unfortunately got fail messages only.
In the list, one is a wall just created, and the other is Reset-Activated one. Both gave me the fail massage.
I’ll try other ways.
Thanks for your kind explanation anyway. I learn a lot from you always. I should call you JacobBig. :wink: Hope your conference to be with huge success.

2 Likes

@jacob.small Oh…it works… I missed to start and end Transaction…
After the code run, the wall which was non-activated Reset, just Activated…
Wow… this is crazy… It gives me even bigger potential possibilities on Enjoy Dynamo and Revit.
Thank you so much.

2 Likes