Help Refining COGO Point Classification script

Background here: Change layer of COGO point based on position within rectangle

One last thing I want to do to finish out this script is assign a unique number to each surface (starting at one and incrementing upwards), then also pass this info on to the COGO point. Since I already used description and layer, maybe I can just add this to the end of the description (so maybe the description would be " RE- North, 1 for a point in the first rectangle). I can’t think of another way to pass on this data, maybe a user defined property but I cant imagine that would be easy to implement. Probably would also like to plot this surface number in C3D model next to the rectangles so I can see which number is associated with what rectangle, but I suppose that is not as important because I can set the points to display that information.

Here is my attempt so far, but I cannot get good results (currently just trying to pass the information to the layer, because I do not know how to put it back in the point description).
Point Layer Classification by Close Poly-WIIP.dyn (43.2 KB)

This is the original working script and test file
Point_Rectangle_test.dwg (980.7 KB)

Bearing Blocks to Points with Description and Class_Final.dyn (179.1 KB)

This seems like it should be very easy because I already have the list of indexes (adding 1 to start with 0 instead of 1)

You can use List.Count and a range to get an ascending list of numbers like this

Is this what you are trying to do here? Pure Dynamo vs Python

Yes but rather than concat that with the layer can I concat it with the point description? I was testing with the layers because I knew it would be easy to apply, but I am going to have large files and don’t want like 30k+ layers.
In this example file the descriptions would be like:
CB, 1
CB, 1
HE6, 1
RE, 1
CB, 2
CB, 2
ect

OK. Here’s the python to do what I think you’re trying to do before this - so collect by description and add a sequence number

I realise the grouping / sorting may not be correct but getting closer?
The dictionary count is reordering the list

I think that is close, but I think maybe I am not being clear. for each item in this list


each point is associated with an indexed surfaced (the first 6 points are in 0, the next 6 in 1, and so on). I just want to add 1 to those numbers (so they start with group 1 instead of 0) then tack that number at the end of the description. So the first 6 points descriptions would look like “XYZ, 1” the next 6 “XYZ, 2” and so on. Basically this last value added on to description will be identifying which rectangle it came from.

I did not see the bit about the re-ordered list so that very well may be correct. I would have to see the graphical output of the points to verify.

I think this is what you are trying to achieve


Code - I’ve added sorting

"OUT = zip(
    IN[1],
    [str(k) for j in [range(1, i[1] + 1)
    for i in sorted({i:IN[0].count(i) for i in set(IN[0])}.items())]
    for k in j])";

Looks like you are concating the first list with the third list, not quite what i am looking for. Just the first two lists, so the output here should be HE6,0 HE6,0 CB,0 CB,0 RE N,0 RE S,0 . But 1 instead of 0 (start at 1).

Dynamo

Python

Code

"OUT = [', '.join([i , j]) for i, j in zip(IN[0], [str(k + 1) for k in IN[1]])]";

Thats exactly it, now is there a good way to shove those strings back into the same point descriptions they came from?

Nevermind I figured it out, thanks so much!

1 Like