Remove data from imported SHP

Remove data from imported SHP

DawnAW
Advocate Advocate
2,322 Views
11 Replies
Message 1 of 12

Remove data from imported SHP

DawnAW
Advocate
Advocate

Hello,

 

This is probably a very basic question, but I can't seem to find the answer.

 

I have imported a GIS SHP file and everything looks good.  The objects that were imported have data that was imported with them.  I see the data in the properties box.  For example, I have a line that represents a pipe.  When I look at its properties I see that it is a water pipe and that it has a diameter of 36".

 

The problem is that I don't need this information for my purposes.  It seems to add a lot to the file size and I just need the lines.

 

Is there a way to remove this information?

 

Thank you.

0 Likes
Accepted solutions (4)
2,323 Views
11 Replies
Replies (11)
Message 2 of 12

Pointdump
Consultant
Consultant
Accepted solution

Hi Dawn,
"Is there a way to remove this information?"
When you use MAPIMPORT, leave the default "Do not import attribute data" checked.
Dave

 

AttData_1.png

 

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
Message 3 of 12

DawnAW
Advocate
Advocate

Thanks so much for pointing that out.  I didn't even think of it.  I will do that in the future.

 

I suppose once that attribute data is in the file it can't be removed within AutoCAD?

 

In the past I have exported the file to another CAD program like MicroStation and then brought it back into AutoCAD.  That seemed to work but I was hoping to avoid the step since the files are usually quite large.

 

Thanks for replying with the good tip.

0 Likes
Message 4 of 12

Pointdump
Consultant
Consultant

Dawn,
"...once that attribute data is in the file it can't be removed within AutoCAD?"
Sadly, no way I can think of. But then I learn something new every day, so maybe someone will chime in with something clever.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 5 of 12

ChicagoLooper
Mentor
Mentor
Accepted solution

@DawnAW wrote

<<....It seems to add a lot to the file size....>>

 

Believe it or not, you're not saving much by dumping the Object Data.  If you really wanna shed weight, detach unnecessary rasters, they're data hogs.

 

Here's a simple test. I downloaded a topographic shapefile from the USGS, US Geological Service, this particular site is The National Map (TNM), then used MAPIMPORT to bring in the linework making sure to grab Object Data during import. The contours and the corresponding OD are shown in image-1.

 

Image-1Image-1

 

The same import was performed on two separate drawings. DEMO_100 and DEMO_101 are the same, both have the same 937 contours, but only DEMO_100 has object data. Eliminating the object data only saves 87 KB. That's a measley 1.67%! You gotta ask yourself, will any slow down lasts longer than a hiccup?  See image-2.

 

Image-2Image-2

If you're still compelled to dump the object data you can do it by using ADEATTACHDATA command. Or you can use the ribbon. The command allows you to remove the OD. When you click Detach from Objects button, your cursor will change from crosshairs to a square. Use your square cursor to select objects individually or to grab multiple objects with a crossing window or lasso. Once the objects have been properly selected, hit ENTER and you're done.  See image-3.

 

<<Note: If you're using a crossing window you may want to use Select Similar=>Isolate Selected Objects first to make it easier to select the objects.>>

 

Image-3Image-3

 

 

Chicagolooper

EESignature

Message 6 of 12

O_Eckmann
Mentor
Mentor
Accepted solution

Hi,

 

You can use ADEDEFDATA command to view each ObjetcDataTable.

You can erase table which remove data for each object with this table.

 

Olivier

Olivier Eckmann

EESignature

Message 7 of 12

DawnAW
Advocate
Advocate

Thank you for spelling all that out.  It was very informative.  It was also helpful to eliminate the data by selecting the objects.  Much appreciated!

0 Likes
Message 8 of 12

DawnAW
Advocate
Advocate

I really liked this command.  It seems to remove the information without having to select elements.

 

I was able to remove all the table.  I still seem to have some objects that have data attached.  Is this possible?

 

Thanks! 

0 Likes
Message 9 of 12

O_Eckmann
Mentor
Mentor

Hi,

 

If you don't have anymore table, you shouldn't have object data attached to objects.

IF you have a small portion of DWG with this case, I'd like to see.

Olivier

Olivier Eckmann

EESignature

0 Likes
Message 10 of 12

DawnAW
Advocate
Advocate

I have cut a small area off of my drawing that previously had tables and attached it.  You will see that the only feature that has the data is the little symbol (block).

 

Initially, I thought it was just block attributes but when I tried to use battman or batsync, I get the following message:

"This drawing contains no attributed blocks."

 

So I assumed that it is part of the object data.  Perhaps this is something else completely.

 

Thanks for your help.

0 Likes
Message 11 of 12

O_Eckmann
Mentor
Mentor
Accepted solution

Hi,

 

These data are attributes of block, not ObjectData. 

Current definition of block doesn't have anymore attrib, that's why BATTMAN say there is no block with attrib.

It possible to have block with attrib present in the drawing and not in current definition.

To create this situation, you simply create a block with attribut, insert some of this bloc, then go to block editor and erase all attributes. Current def has no attributes but blocks already inserted keep their attributes.

If you want to remove all attributes of existing blocks, you can use this code

(defun C:DeleteAttrib ( / SS I AT ATT oBloc)
  (if (setq SS (ssget (list (cons 0 "INSERT") (cons 66 1))))
    (progn
      (setq I 0)
      (repeat (sslength ss)
	(setq oBloc (ssname ss I ))
	(setq I (1+ I))
        (setq AT (entnext oBloc))
	(while (/= "SEQEND" (cdr (assoc 0 (entget AT))))
	  (setq ATT (vlax-ename->vla-object AT))
	  (setq AT (entnext AT))
	  (vla-delete ATT)
	)
      )
    )
  )
)

 

Olivier

Olivier Eckmann

EESignature

0 Likes
Message 12 of 12

DawnAW
Advocate
Advocate

Thank you for looking into that.  And thanks for the code.  It worked great!

0 Likes