Query Model Curve from Divided Path

Does anyone have a method for querying the original Model Curve element from a Divided Path element?

Currently you can only query a Divided Path’s points in Dynamo.

sorry dude but it seems that in Revit API language a “divided path” really means something more like “points on curve”. There is no straight forward method to get a curve from divided path.

I can imagine one scenario though: delete all curves in model sequentially and monitor which divided path gets deleted with it. Since path is hosted on curve when you delete the curve path will be deleted with it so you will get that id back from delete() method. Once you hit the one that you want just roll back the transaction and there you have your curve and divided path. Of course this method is a total workaround for something that should be there out of the box, but i think it would work like this:

Capture

 

 

And here is the Python code:

 

Capture

I think that Konrad’s solution is much more definitive and concrete, but I wanted to offer a possible solution with the default geometry tools. As long as you don’t have cases in which multiple curves share the same start and end points, you might be able to simply compare all of the curves’ starts and ends for a match?

2015-09-09_10-55-12

 

You could also experiment with the elements’ bounding boxes’ min and max points in a similar manner.

Thanks Dimitar I appreciate the tip but there are two problems with that in this case:

(1) There are duplicate curves***

(2)There is no guarantee that divided path nodes are at the ends of a curve (in this case they are offset to the interior of the curve by a specified parameter) therefore neither end points nor bounding boxes would give a correct match

***This is where things get weird. In my graph I am selecting all the divided path elements and all the model curve elements in the family. The model curve element count is always double of the divided path element count, leading me to believe that Dynamo is reading both the divided path and the original reference curve as model curves, which would also explain why I have exactly one duplicate of each curve.

My first thought was that there might be ID matches between corresponding model curves and divided paths, but upon further inspection every element had a unique ID.

double

So at this point I was about to send the geometry to Grasshopper to use some of the tools there to sort this mess out, when I started thinking about Konrad’s mentiong of trans.RollBack() and the nature of one element generating another, which is that the element IDs are likely sequential.

So I took Konrad’s element by ID selection node (see this thread: http://dynamobim.com/forums/topic/id-string-to-elements/) and it worked. The nice thing about this method is I don’t have to select all the model curves in the document - I just pull them by subtracting 1 from the IDs of the divided path elements.

goodgod

OMG Dynamo is weird.

This is cool. Good job.