Help Refining Script to Insert Cogo Points from Blocks

See background of issue here: Solved: Re: Extracting COGO Points from blocks with descriptions - Page 2 - Autodesk Community

Have a script that is mostly perfect but it outputs some garbage points. What I want is cogo points at each block location with a description matching the block. Currently this script gives 53 extra points that are garbage. Any help is appreciated.
BlockName2RawDesc

@V0rticity
Check if you can do a filter of block reference on layer, on name or selection instead of select all block and their block reference in the file.
For the moment you will get

Carl,
WBLOCK’ing out the blocks to a new drawing allows the Dynamo Script to work as expected.
I can’t figure out how to add a screen shot, drawing file, and Dynamo Script to this reply. Here’s a link to my Civil 3D forum reply:
Message 40
Dave

I’ll try again to post the WBLOCK’ed dwg and dyn files. It works!
BlockName2RawDesc_2.dyn (6.5 MB)
BlockNames2CogoPtDesc.dwg (131.2 KB)

I think this approach will work, I changed the script a bit to select only items on a layer I name “BEARINGS”. Now the point output is good, but the descriptions all say “*Model Space”

1 Like

Good work!
What is the output from Block.Name? Can you expand the node?

Something that is not correct, see below:
image

Though the correct block names are at the bottom of this list:
image

I might missed one thing.
Not at my computer at the moment but is there a node to get Blockreference instead of block?
Blocks is not inserted in the drawing, they are stored waiting to be inserted as Blockreferences.
If you can get Blockreferences on a layer or by name they should be correct input.

Not sure to what you are referring but it looks like Block.Name only accepts Block as an input, not block reference.

@hosneyalaa I can’t even get this to work.

@hosneyalaa when I change the lacing on the last block to longest, I get a 560 list as well, but the outputs are all wrong and the descriptions are not the block names. I don’t know where it is pulling names from but none are correct

Sooo, now I’m back from orienteering competition. :slight_smile:
@V0rticity
Here is my solution where I filter out all blockreferences named DB and not those named “Tree” and then I create Cogopoints at the DB block reference insertions point


Select BlockReference DB and create Cogopoints.dyn (4.8 MB)

DB and Tree Block references.dwg (1.1 MB)

OK, but my problem would be not all of my blocks are the same name, in your example all your points of interest are in the same block type.

Do they have any similarities?
Layer, part av name, parameters?

Yes, I can put them on the same layer.

Based on your code I think I figured it out I was mixing data types.

1 Like

Oki, now I think we have a winner.
So I put the DB on layer “DB_Layer” and Trees on layer “Tree_Layer”


[Select BlockReference DB and create Cogopoints_FilterOnLayer.dyn|attachment]
Select BlockReference DB and create Cogopoints_FilterOnLayer.dyn (4.8 MB)

Edit - I forgot to set layer

1 Like

That one works too! Thanks for all your help sir, interesting to see how you can come to the same output by different means.

1 Like