Jump to content

Duplicate OLE objects in multiple layouts


pmadhwal7

Recommended Posts

Hi,

All in my dwg their is ole object are overlapped in multiple layouts and I want to remove them in one command because of my dwg file are very heavy, any one have any ide reading this please help

Link to comment
Share on other sites

This will hide them. Regen to bring them back.

 

(defun C:ALL-OLE (/ SS)
  (if (setq SS (ssget "_X" '((0 . "OLE2FRAME"))))
    (foreach obj (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
      (redraw obj 2) ;(entdel obj) ;if you just want to delete them 
    )
  )
)

 

Edited by mhupp
code updated
  • Like 3
Link to comment
Share on other sites

19 hours ago, mhupp said:

This will hide them. Regen to bring them back.

 

(defun C:ALL-OLE ()
  (if (setq SS(ssget "_x" '((0 . "OLE2FRAME")))
    (foreach obj (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
      (redraw obj 2) ;(entdel obj) ;if you just want to delete them 
    )
  )
)

 

Hi thanks for replay after uploading this i error comes

 

Command: ; error: malformed list on input

Link to comment
Share on other sites

I think like you Mhupp I use Notepad ++ now so for simple code easy to check, if its hundreds of lines I resort to my 1980's check brackets lisp, handy when debugging someone else's code.

 

For a bit of nostalgia

 

; By Alan H
; circa 1980's

(defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln)
(setvar "cmdecho" 0)
(prompt "\nlook at end of line")
;(setq chekdfile (getstring "enter name of file :"))
(SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4))
(setq opf (open chekdfile "r"))
(setq bkt 0)
(setq blkl 0)
(setq rdctl 1)
(setq wkfile (open "c:\temp\wow.lsp" "w")) ; change out directory to suit
(setq currentln "a")
(while (/= blkl 6)
(setq currentln (read-line opf))
(if (= currentln nil)(setq currentln ""))
(if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1))
(setq wln currentln)                                                        
(while (/= wln "")
        (setq ltr (substr wln 1 1))
        (setq wln (substr wln 2))
        (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0)))
               ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1)))
                ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1)))
                ((and (= ltr ";")(= rdctl 1))(setq wln ""))
                ;(t (prompt ltr))
        )
)
(setq ncln (strcat currentln ";" (itoa bkt)
(princ (itoa bkt))
(if (= rdctl 0) "string open" "")))
(if (/= currentln "")(write-line ncln wkfile))
)
(close wkfile)
(close opf)
(prompt (strcat "open brakets= " (itoa bkt) "."))
)

(command "chkbrk")
(princ)

 

Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

Yeah I thought this is a simple lisp cant screw this up. deleted one too many ) when modifying an old ssget with "_X" that had multiple filters.

Link to comment
Share on other sites

On 3/10/2022 at 10:15 PM, mhupp said:

sorry was missing a ")"

i want to remove duplicate OLE, lsp that you provided are hiding OLE

Link to comment
Share on other sites

I would use a crayon before I would use OLE.

  • For spreadsheets use a linked table.
  • For images use a linked rasterimage  object.
Link to comment
Share on other sites

6 minutes ago, TerryDotson said:

I would use a crayon before I would use OLE.

  • For spreadsheets use a linked table.
  • For images use a linked rasterimage  object.

Agreed. 👍

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...