Hello, I hope you can help me with this problem. I am trying to make a selection of all the layers in my document and have Dynamo give me the total areas per layer, but I am having problems with this. If you can help me, I would really appreciate it.
Add a List.RemoveIfNot after the all objects on layer.
Alternatively you CPUâs get the object type from the resulting objects and use an equality test to check for equality to the name of hatch object. The resulting boolean becomes a filter for the object lists - make sure both inputs on the List.FilterByBoolMask node are set to @@L2 to keep things aligned.
Alternatively you could select all hatches first and then group their by their layer.
Hi Jacob thanks for your answer, Iâve questions for the solution what you bring me. When I try to make the list.remove if not, in the type i donât know what type i need to make the seleccition, i supposee is the hatch but, Iâm really lost with this.
Hi,
Have you verified your hatch? I see that Loop = 0.
I think you donât need to filter your objects; I didnât encounter any issues.
Can you post what youâve tried? Hard to guide you out of the woods if you donât indicate where you are.
Hi, i try another form to get the areas, but in my draw how i´ve 56 layers, including multiple polylines, i nedd to create a filter for only count the hatches right?, bucause, when i try to make a list, tha full area does not appear
Not sure what direction youâre going nowâŚ
Currently half your problem is that youâre trying to learn how to swim during a sharknado of data, and that never ends well. So instead of jumping into N layers with M objects per layer of which L are hatches start simple.
Make a new dwg with 4 layers named ["0", "1", "2", "DefPoints"]
(or whatever the standard no-plot layer in AutoCAD is). Put 2 hatch objects on layer â0â. On layer â1â put a hatch and a line. On layer â2â put two lines. On the defpoints layer put nothing.
When you use All Objects On Layer
you should have a total of 6 objects. Then try Hatch.GetFromObject
and Hatch.Area
and see if the structure makes more sense.
Ok, I do it.
Now, in the actualy dwg I´ve 2 polylines and 2 hatchs, and four layers only.
In the Hatch.getfromobjetc, I get the hatch and next the area, but how i filter the hatch; âSolid fillâ in the list 0, and 2, so that null does not appear and only hatch
And really thanks for your help.
Put a List.Clean in after the âHatch.GetFromObjectâ node to remove the ânullâ objects.
Excellent, and sorry but one more question, since before the number was null, it gave numbers of 0 when applying the function to add the elements by list, so it did not order the list of layers, how do I adapt a list with the names of the layers and the shaded area?
There should be one sum of the hatch areas for each layer, with empty lists totally 0 area. You might need two âsumâ nodes or a List.Flatten with the correctly list Level (@L3 I think) to ensure things maintain alignment. Using the sample file and double checking your results will help ensure things align for now.
Hi again, thanks for your answer. Iâll try to apply this answer and your first answer to my post because I donât know how I can make a filter and dynamo bring me the layer name exactly with the area like the number 0, 1, 2. My last picture is the layer 4, 15 and 17 with their respective names. I donât know how to make a layer: List 4 (CA-EJE) = list 0 (8.293) Hatch Area
On the List.Clean node set the âpreserve indiciesâ to âTrueâ and see if that clears it up.
Hi, again thanks for your help, Iâm really apreciate that, yes with this, the list.clean, preserve indices, but in the final list, i have problems with the sum, but the simple solutyion in the dwg is drag with a lot of layer only to hatches and not the same for polyline and hatch.
Hey Ramon,
Take a look at this solution and see if it works for your needs. Should filter out all the non-hatch items on your layers, sum up the hatches and sort them into a dictionary by layer name and total area.
Update!
These days I have been working on the Script, with all your comments, the answer I found is the following:
When I try to classify the lines by layers all the lines are with distance at 0, and the hatches with different areas are all fine in the list, the problem, if this same layer has been used in a polyline and hatching the Script to give distances or hatching area is null, and the list does not work.
And for that the solution is very simple, create multiple layers for my drawing, layers to draw polylines and layers for hatching, with this if my drawing has polylines and hatching, I have no problem, because with the different layers, to give the hatching area or the distances it works fine.
The only problem is the accumulation of layers, for a large drawing it can be complicated but if I work very specifically with my layers, I can know areas and distances automatically.
Thanks again for all your help, for the moment I will work with many layers haha.