Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4150

Python script to join open curves in blocks

$
0
0

I have a set of closed curves that were made into blocks. Each block contains one closed curve. Somehow we broke all the closed curves open and they are now all open curve segments. I can edit the block and select the curves and type ‘join’ and it fixes the issue. but I have thousands of blocks. What is the script that might accomplish this task.
I am trying the following but it appears to have no affect. I have one instance of each block in the file and I can print out ids for each curve and it seems to be looping correctly.

block_names = rs.BlockNames();
for block_name in block_names:
  block_objects = rs.BlockObjects(block_name)
  curves = []
  for id in block_objects:
    if rs.IsCurve(id):
      curves.append(id)
 rs.JoinCurves(curves)

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4150

Trending Articles