DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

How much data is on each layer?

Started by SFA, January 23, 2017, 05:14:11 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

SFA

Is there a way of finding out how much data is on each layer (or every layer)?
SEMPER IN EXCRETIA

DrollTroll

You can select the layer using the Layer Options dialog (or the Selection Filter). Then Open the Info Box and click on the 'Show Detail' icon to see how many entities are selected. There's no built-in type-by-type listing of how many lines, circles, etc. and how many points, there are on a given layer, like there is for the whole drawing in Drawing Info.
25 years with DesignCAD

bdeck

Here's a macro that enumerates the types within a selection.

http://forum.designcad.com/index.php?topic=6821.0

You could modify it to enumerate any other property of entites, for example the property of being on a layer, by using GETATTR or Query.

bd

Lar

Just copy n' paste everything from a layer into a new drawing then go to Drawing Info in the Help menu.

SFA

Thank you all. My problem is that I import architect's AutoCAD drawings with sometimes dozens of layers (of C**P) and I need to find and delete the extraneous ones.

I suppose I should write a macro which runs through the layers and tells me how may entities are in each (like BDECK) suggests.

SEMPER IN EXCRETIA

DrollTroll

If you just want to delete the empty layers, you can tell at a glance which ones are empty. Layers that contain objects are marked with an asterisk in the Layer dialog (or layer toolbar). Also, in the Layer dialog, if you click on the asterisk column header, the occupied layers will be listed first, and the empty ones afterwards. You can then get back to the regular ordering by clicking on the index column header.
25 years with DesignCAD

SFA

Thanks DT. What I want to do is delete lots of irrelevant information on various layers.



SEMPER IN EXCRETIA

bdeck

#7
In case you havent done this already, modifying the 4 marked lines below should be a good start.


'til.d3m    type info by layer
dim ecount(130), ename$(130)
precision 0
nent=sys(9)
input "Enter layer number", laynum       'add this line   +++++++++++++++ ( or start an incremental loop here)
for i=1 to nent
  getattr i,type,sel,lay                  'modify this line  ***************
    'if (sel mod 2)=1 then              'delete this line  ----------------
      if laynum = lay then               'add this line     ++++++++++++++
       if ecount(type)=0 then tcount=tcount+1
      ecount(type)=ecount(type)+1
      poscount=1+poscount
      endif
next i


rcount=tcount+5
gosub ntable
window rcount,50
print "Selected entities = ", poscount
print "Selected types = ", tcount
Print
Print "Count     Type ID     Type Description"
Print
for t=1 to 130
    if ecount(t)>0 then
      print "    ", ecount(t), "          ",t,"          ", ename$(t)
    endif   
next
anykey
precision 3
end         

ntable:
  ename$(1)="Line"
  ename$(2)="Ellipse"
  ename$(3)="3D Text"
  ename$(4)="Curve"
  ename$(7)="Elliptical Arc"
  ename$(11)="Bezier Curve (4-point)"
  ename$(12)="Bezier Curve (Continuous)"
  ename$(13)="2D Text"
  ename$(15)="Attribute"
  ename$(16)="Circle, Circular Arc"
  ename$(17)="Hatch"
  ename$(22)="Text Arc"
  ename$(24)="Arrow"
  ename$(26)="Symbol"
  ename$(31)="Plane"
  ename$(32)="Grid Header"
  ename$(33)="Grid Line"
  ename$(34)="Group"
  ename$(68)="Construction Line"
  ename$(70)="Point Mark"
  ename$(71)="Attribute Definition"
  ename$(74)="Dimension, Angle"
  ename$(75)="Dimension"
  ename$(76)="Dimension, Diameter/Radius"
  ename$(77)="Dimension, Arc"
  ename$(78)="Dimension, Radius Progressive"
  ename$(79)="Dimension, Progressive"
  ename$(80)="Dimension, Chamfer"
  ename$(81)="Dimension, Coordinate"
  ename$(90)="Bitmap Image"
  ename$(92)="Double Line"
  ename$(93)="Double Curve"
  ename$(94)="Double Bezier"
  ename$(95)="Double Circle/Arc"
  ename$(96)="Double Elliptical Arc"
  ename$(97)="Double Ellipse"
  ename$(119)="Multiline Text"
  ename$(113)="MultiLine"
  ename$(114)="MultiLine Curve"
  ename$(115)="MultiLine Bezier"
  ename$(116)="MultiLine Circle/Arc"
  ename$(117)="MultiLine Ellipse"
  ename$(118)="MultiLine Elliptical Arc"
  ename$(119)="MultiLine Text (2D)"
  ename$(120)="MultiLine Text (3D)"
  ename$(122)="Solid Surface (version 24 +)

return

SFA

SEMPER IN EXCRETIA

Dempsey

I have a macro (drawing-info.d3m) that counts (among other things) the number of entities and points in each layer, group and solid.

Mind you I still need to add the double line entities.

Dempsey

SFA

Dempsey,

Thank you but I got this error message??

Stan

SEMPER IN EXCRETIA

Lar

#11
This macro does away with bothering to find out what layer something is on and then opening the layer dialog, scrolling to that layer and selecting that whole layer.

Just select something in the drawing and run the macro. It will select everything on the same layer. After one layer is selected you have the option of selecting another entity and everything on that layer will be added to the first selected layer... or you can chose to make a new selection without keeping the first selection.

So, for those irritating acad drawings just click on one of those outta space entities and run the macro to select everything on that layer. You can then decide if to select more outta space stuff or end the macro and delete the selection, move them away from the rest of the drawing to sort them out, or whatever.

Oh yeah, if you run the macro with nothing selected the macro gives you the option of letting the macro select the current layer -OR- you clicking on something to select it (without having to abort the macro first). With this second option, if you want to select a number of layers and you know what entities are on those layers, you can tell the macro how many layers you want to select (it defaults to one layer, in which case just click OK without entering anything) and then click-select that amount of entities and the macro will select the stuff on all those entities (I actually forgot it was able to do this 'more that one layer all at once' thing).


'Lar
'2feb2012
'Layer Select by Entity.d3m

'25jan15: added selecting current layer if nothing is selected...
'4feb15: added ability to select more than one layer...
'***********************************************************

'if nothing is selected...
if sys(80)=0 then
restartt:
sys(1027)=4  'yes/no message box...
message "-Nothing is selected- OR -Restart selection-",CHR$(13),"Click YES to select the current layer...",CHR$(13),"Click NO to select a number of layers..."

'if YES...
if sys(1028)=6 then
EnLay=sys(3)    'get the current layer's number...
goto sel_lay
end if   'if sys(1028)=6...

'if NO...
if sys(1028)=7 then
numb=1
input "Enter the number of layers to be selected<<default=1>> then click on entities of layers to select...", numb
if sys(999) then END'DDDDDDDD  'end if CANCEL is clicked...

dim num(numb)

for numm=1 to numb
>PointSelect
{
}
'get its layer into dim...
getselect 1, ent
entity ent
num(numm)=sys(93)   'put into the array the layer number of first entity of selection set...
next   'for numm=1 to numb...

'deselect all (so SeletLayer can use Type 1)...
sys(80)=0

for sel_lays=1 to numb
>SelectLayer
{
<Layer [num(sel_lays)]
<Type 1   'add to selection...
}
next    'for sel_lays=1 to numb...

goto rep

end if   'if sys(1028)=7...

end if   'if sys(80)=0...


new_sel:

'if something is selected get its layer...
getselect 1, ent
entity ent
EnLay=sys(93)  'entity's layer...

sel_lay:
>SelectLayer
{
<Layer [EnLay]
<Type 0  'select solo...
}

if sys(80)=0 then
sys(1027)=0   'default message box...
message "Nothing was selected, current layer must be empty (otherwise by error it is off or locked - after this macro use the Layer dialog to correct)..."
goto restartt
end if

rep:

'MESSAGE STYLE BOXES (REMOVE APOSTROPHY FROM THE ONE TO BE USED):
'sys(1027)=0  'message box style = OK, (1) (default)...
'sys(1027)=1  'message box style = OK(1) / Cancel (2)...
'sys(1027)=2  'message box style = Abort (3) / Retry (4) / Ignore (5)...
'
sys(1027)=3  'message box style = Yes (6) / No (7) / Cancel (2)...
'sys(1027)=4  'message box style = Yes (6) / No (7)...
'sys(1027)=5  'message box style = Retry (4) /Cancel (2)...

message "Select More?...",CHR$(13)," <<YES: Add to Selection... NO: New Selection... CANCEL: End Macro...>>"

'1=OK, 2=Cancel, 3=Abort, 4=Retry, 5=Ignore, 6=Yes, 7=No...

'if CANCEL (end)...
if sys(1028)=2 then END'DDDDDDDDDDDDDD

'if YES (add)...
if sys(1028)=6 then
>PointSelect
{
}

'remember layer...
getselect 1, ent
entity ent
EnLay=sys(93)  'entity's layer...

'reselect previous since last pointselect would deselect them...
>SelectPrevious
{
}

>SelectLayer
{
<Layer [EnLay)]
<Type 1
}
goto rep
end if

'if NO (new)...
if sys(1028)=7 then
sys(80)=0      'deselect all...
clear   'clear all variables, especially dim(numb)...
goto restartt
end if



Lar

Dempsey

SFA,

Copy DcadAlias.d3i from the DesignCAD program directory into the directory where you keep the macro(s). That should solve your problem.
Dempsey

SFA

SEMPER IN EXCRETIA