What is your end goal after grouping those curves?
You’ve only specified that the error lies with the script taking a lot of time, but that’s kinda expected when you’re using a clustering algoritm which (probably) compares each curve to every other curve to determine its group. This has a time complexity of O(n^2), where n is the number of curves.
This is going to take some time, especially when you’re trying to compare 12000+ curves against eachother. It’s probably a better idea to run the script in batches.
I need code python …I have lines arcs from linked cad I want to close it by dynamo to be area by get free points to nearest free point and add lines due to curves rotation … but it dynamo don’t respond becase it take every curve with the others curves (every curve points start end) and close dynamo
I know that is not direct to my qestion
. Here are a few common methods: to fix in autocad
Use the Join command: The Join command can be used to connect lines or arcs that are not properly joined, which can often fix gaps. Select the lines or arcs you want to join, and then type “Join” and press Enter. Follow the prompts to select the endpoints you want to join.
Use the Pedit command: The Pedit command can be used to edit polyline objects, and can be helpful in fixing gaps between polyline segments. Select the polyline you want to edit, and then type “Pedit” and press Enter. Follow the prompts to select the segment you want to modify, and then choose the “Join” option to connect the selected segment to the adjacent segment.
Use the Gap Tolerance setting: The Gap Tolerance setting can be adjusted to control how small gaps are handled when objects are snapped together. To adjust the Gap Tolerance setting, type “SNAP” and press Enter, then click on the “Settings” button. Adjust the Gap Tolerance value to a smaller value to snap together smaller gaps.
Use the Fillet command: The Fillet command can be used to create a smooth curve between two lines or arcs. Select the lines or arcs you want to connect, then type “Fillet” and press Enter. Follow the prompts to specify the fillet radius and select the endpoints to create the fillet.
Okay I think I figured out what your end goal is. If I understand you correctly you have curves loaded into Dynamo and need to create closed polygons from those unconnected curves, but you don’t know how and it takes too long.
The code here is probably not the final iteration you need, but its a start:
PS: You should really use ChatGPT to help you explain to us what you’re after and what you’re struggling with instead of adding nonsense ‘methods’/solutions at the end of your post, which don’t even relate to this problem or Dynamo.
If you have a huge building that consit of 300 isolated footing(foundation) 1200 curve with unjoined curves due because in autocad we use trim when there is beam intersect with footing so there are footing with gaps and I want to add lines to draw footings
If that isn’t available, then go back to the DWG data set and isolate the layer the footings are on, pull the unclosed polylines into Dynamo for Civil 3D, and work with the content there? You would have between 1/4 and 1/6 the number of curves to deal with from the beginning.