Author Topic: How can I efficiently erase the dimensions?  (Read 2910 times)

0 Members and 1 Guest are viewing this topic.

tjuzkj

  • Guest
How can I efficiently erase the dimensions?
« on: December 14, 2011, 01:11:08 AM »
Hello.
I often need to erase the dimensions except the outermost dimensions. The example is as follows.It wastes me a lot of time.
So I want to have a lisp routine to help me to do so efficinently.
I mean if I  choose the dimensions ,the inner dimensions will be erased automatically and the two outmost dimensions will be retained。
Who can help me?Thank you!

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How can I efficiently erase the dimensions?
« Reply #1 on: December 14, 2011, 04:11:45 AM »
Have you tried using the Filter / QSelect commands. I'd use them on a Window/WPolygon selection over the middle of the drawing, then filter for only Dimensions.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Brick_top

  • Guest
Re: How can I efficiently erase the dimensions?
« Reply #2 on: December 14, 2011, 06:51:46 AM »
I use this little routine

Code: [Select]
(defun c:cco ()
   (setq ocmdecho (getvar "cmdecho"))
   (setvar "cmdecho" 0)
   (initget "Line Ellipse Arc Circle LWpolyline Text Mtext Hatch Spline Solid 3dsolid Dimension Image Point")
(setq var (getkword "\nLine/Ellipse/Arc/Circle/LWpolyline/Text/Mtext/Hatch/Spline/Solid/3dsolid/Dimension/Image/Point:")
              gro (cons 0 var)
              ss (ssget (list gro))           
        )
   (setvar "cmdecho" ocmdecho)
   (princ "\nThe name of the selection is ss:")
   (princ)     
)

you can then delete it by using the command erase and calling the selection set "!ss"

at least this is how I do it.. I'm sure there are better ways

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Brick_top

  • Guest
Re: How can I efficiently erase the dimensions?
« Reply #4 on: December 14, 2011, 10:09:43 AM »
LOL as I said there are better ways to do it ^^

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: How can I efficiently erase the dimensions?
« Reply #5 on: December 14, 2011, 10:12:35 AM »
LOL as I said there are other ways to do it ^^
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

tjuzkj

  • Guest
Re: How can I efficiently erase the dimensions?
« Reply #6 on: December 14, 2011, 08:11:54 PM »
I search out a lisp routine.It do it well.However,I find if the two outmost dimensions contain aligned dimensions,it can not do what
I want to do.Who can modify it?Running this routine needs to load libsub.fas.

Code: [Select]
(defun c:gps_deldm
       (/ entlst i lst n pt1 pt2 ptlst ptx pty ss x xlst y ylst z)

;;;subfunction begins
  (defun getapt (lst / i x y)
    (setq x (nth 0 lst))
    (setq i 1
  y (nth i lst)
    )
    (while (and y (<= (fix (/ (- y x) 280.0)) 0))
      (setq i (+ i 1)
    y (nth i lst)
      )
    )
    (setq x (last lst))
    (setq i (- (length lst) 2)
  z (nth i lst)
    )
    (while (and z (>= (fix (/ (- z x) 280.0)) 0))
      (setq i (- i 1)
    z (nth i lst)
      )
    )
    (list y z)
  )
;;;subfunction ends ---------------------------------

  (princ "\n erase dimensions(retain the two outermost dimensions):")
  (setq ss (ssget ":L" '((0 . "DIMENSION"))))
  (if ss
    (progn
      (setq entlst (gps->ss-2lst ss))
      (foreach n entlst
(setq ptlst (trans (dxf 10 (entget n)) 0 1))
(setq ptx (car ptlst))
(setq pty (cadr ptlst))
(setq xlst (append xlst (list ptx)))
(setq ylst (append ylst (list pty)))
      )

      (setq xlst (vl-sort xlst '<))
      (setq ylst (vl-sort ylst '<))

      (setq xlst (getapt xlst))
      (setq ylst (getapt ylst))
      (setq pt1 (list (+ (car xlst) 100) (+ (car ylst) 100)))
      (setq pt2 (list (- (cadr xlst) 100) (- (cadr ylst) 100)))
      (setq ss
     (ssget
       "w"
       pt1
       pt2
       '((-4 . "<OR")
(-4 . "<AND")
(0 . "LEADER")
(-4 . "AND>")
(-4 . "<AND")
(0 . "*DIMENSION*")
(-4 . "AND>")
(-4 . "<AND")
(0 . "INSERT")
(-4 . "<OR")
(2 . "_SECTION")
(2 . "_AXISO")
(2 . "_AXISO#")
(-4 . "OR>")
(-4 . "AND>")
(-4 . "OR>")
)
     )
      )
      (if ss
(command ".erase" ss "")
      )
    )
  )
  (gps->error-restore)
)

jaydee

  • Guest
Re: How can I efficiently erase the dimensions?
« Reply #7 on: December 14, 2011, 09:51:41 PM »
Hi
Just wonder if your outer most dimension is generally longer then most, if it is then i would try filter out the dxf code 42
(42 . dimensionlength) and if anything small then a given dimension unit then erase.

Just a suggestion.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: How can I efficiently erase the dimensions?
« Reply #8 on: December 15, 2011, 01:23:10 PM »
Have you tried using the Filter / QSelect commands. I'd use them on a Window/WPolygon selection over the middle of the drawing, then filter for only Dimensions.


X2

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

pBe

  • Bull Frog
  • Posts: 402
Re: How can I efficiently erase the dimensions?
« Reply #9 on: December 16, 2011, 07:32:02 AM »
Hi
Just wonder if your outer most dimension is generally longer then most, if it is then i would try filter out the dxf code 42
(42 . dimensionlength) and if anything small then a given dimension unit then erase.

Just a suggestion.

Good idea, it just might work  :-)

<limited testing>

Code: [Select]
(defun c:DimGone (/ ss dm_lst ent ang compare)
  (defun _dxf (dx en)
    (cdr (assoc dx (entget en)))
    )
  (setq ss (ssget "_X" '((0 . "DIMENSION"))))
  (repeat (sslength ss)
    (setq ent (ssname ss 0))
    (if (not (setq compare (assoc (setq ang
(rtos (angle (_dxf 10 ent) (_dxf 14 ent)) 2 2)
)
  dm_lst
  )
   )
     )
      (setq dm_lst (cons (list
   ang
   (_dxf 42 ent)
   ent
   )
dm_lst
)
    )
      (if (> (_dxf 42 ent) (cadr compare))
(progn
  (entdel (last compare))
  (setq dm_lst (subst (list ang (_dxf 42 ent) ent) compare dm_lst))
  )
(entdel ent)
)
      )
    (ssdel ent ss)
    )
  (princ)
  )

EDIT:(setq dm_lst (subst (list ang (_dxf 42 ent) ent) compare dm_lst)) <---rookie mistake   :-D
« Last Edit: December 17, 2011, 05:35:51 AM by pBe »

mkweaver

  • Bull Frog
  • Posts: 352
Re: How can I efficiently erase the dimensions?
« Reply #10 on: December 16, 2011, 08:20:03 AM »
If you're using Acad 2011 (or 2010 with the subsciption advantage pack) you can run select similar on a dimension then isolate the selected dimensions.  Then erasing the inner dimensions will likely be nothing more than erasing a crossing selection.

pBe

  • Bull Frog
  • Posts: 402
Re: How can I efficiently erase the dimensions?
« Reply #11 on: December 17, 2011, 05:35:05 AM »
POST UPDATED: