Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Raster, raster, go away

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
4392 Views, 12 Replies

Raster, raster, go away

Hi,

I am trying to find a good way to rid myself of raster images that come from
Vectorworks dxf's. I posted this problem on the Autocad 2006 NG and so far
we've eliminated using bedit to delete them, and they aren't attached as
"images" so I can't just detach them. It was suggested that maybe some
generous programmer would be able to help me with a script that could find
and eradicate the nasty rasters...

I've attached an example file. I would really like to keep all of the blocks
that come in the file intact so I need someway to enter all of the blocks
(including anonymous blocks)(and there could easily be 1000 blocks in a
file) and delete all of the raster images within each one.

Has anyone here come across such a script or would anyone be up to the
challenge of writing one?

Thanks
Heather
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: Anonymous

Hi Heather,
I had a look at your drawing and I can't find any raster images in your drawing file(or the block), am i missing something here?

Regards
Anthony
Message 3 of 13
Anonymous
in reply to: Anonymous

Hi Anthony,
When I refedit the block there are 9 raster images in it. (I just checked
the drawing I attached to make sure and ....they were there)
Exploding the block makes them selectable also but.... I really don't want
to explode the architect's base plan...

Thanks for looking,
Heather

wrote in message news:4974141@discussion.autodesk.com...
Hi Heather,
I had a look at your drawing and I can't find any raster images in your
drawing file(or the block), am i missing something here?

Regards
Anthony
Message 4 of 13
Anonymous
in reply to: Anonymous

Heather,

This will delete the raster image objects in your example drawing without exploding
the block. Those things are wipeout objects. The code will only delete that type of
object when it's contained in a block. Just a word of caution in case any of your
blocks contain wipeouts.

It has some error checking for objects on locked layers. Avoid that, unlock all
layers first.

Joe Burke

[code]
;; 10/3/2005 Delete raster wipeouts in block definitions.
(defun c:DeleteBlockWipeouts ( / cnt blocks flag)
(setq cnt 0)
(setq blocks
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object))))
(vlax-for x blocks
(if
(and
(not (wcmatch (strcase (vlax-get x 'Name)) "*MODEL*,*PAPER*,*|*"))
(= :vlax-false (vla-get-IsXRef x))
)
(vlax-for item x
(if (= "AcDbWipeout" (vlax-get item 'ObjectName))
(if (not (vl-catch-all-error-p
(vl-catch-all-apply 'vla-delete (list item))))
(setq cnt (1+ cnt))
(setq flag T)
)
)
)
)
)
(princ (strcat "\nNumber of wipeouts deleted: " (itoa cnt)))
(if flag
(princ "\nSome items could not be deleted. Check for locked layers. ")
)
(princ)
) ;end
[/code]


"Heather" wrote in message
news:4974067@discussion.autodesk.com...
Hi,

I am trying to find a good way to rid myself of raster images that come from
Vectorworks dxf's. I posted this problem on the Autocad 2006 NG and so far
we've eliminated using bedit to delete them, and they aren't attached as
"images" so I can't just detach them. It was suggested that maybe some
generous programmer would be able to help me with a script that could find
and eradicate the nasty rasters...

I've attached an example file. I would really like to keep all o
f the blocks
that come in the file intact so I need someway to enter all of the blocks
(including anonymous blocks)(and there could easily be 1000 blocks in a
file) and delete all of the raster images within each one.

Has anyone here come across such a script or would anyone be up to the
challenge of writing one?

Thanks
Heather
Message 5 of 13
Anonymous
in reply to: Anonymous

Thank you Joe,
very useful

Bruno Toniutti
Message 6 of 13
Anonymous
in reply to: Anonymous

That's the one! It Works GREAT! You can't imaging how much time this saves
me.

Thank you!
Heather
Message 7 of 13
Anonymous
in reply to: Anonymous

Heather and Bruno,

You're welcome.

Joe Burke

"Heather" wrote in message
news:4975061@discussion.autodesk.com...
That's the one! It Works GREAT! You can't imaging how much time this saves
me.

Thank you!
Heather
Message 8 of 13
Anonymous
in reply to: Anonymous

WOOW Super works perfectly Smiley Happy


@Anonymous wrote:
Heather,

This will delete the raster image objects in your example drawing without exploding
the block. Those things are wipeout objects. The code will only delete that type of
object when it's contained in a block. Just a word of caution in case any of your
blocks contain wipeouts.

It has some error checking for objects on locked layers. Avoid that, unlock all
layers first.

Joe Burke

[code]
;; 10/3/2005 Delete raster wipeouts in block definitions.
(defun c:DeleteBlockWipeouts ( / cnt blocks flag)
(setq cnt 0)
(setq blocks
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object))))
(vlax-for x blocks
(if
(and
(not (wcmatch (strcase (vlax-get x 'Name)) "*MODEL*,*PAPER*,*|*"))
(= :vlax-false (vla-get-IsXRef x))
)
(vlax-for item x
(if (= "AcDbWipeout" (vlax-get item 'ObjectName))
(if (not (vl-catch-all-error-p
(vl-catch-all-apply 'vla-delete (list item))))
(setq cnt (1+ cnt))
(setq flag T)
)
)
)
)
)
(princ (strcat "\nNumber of wipeouts deleted: " (itoa cnt)))
(if flag
(princ "\nSome items could not be deleted. Check for locked layers. ")
)
(princ)
) ;end
[/code]


"Heather" wrote in message
news:4974067@discussion.autodesk.com...
Hi,

I am trying to find a good way to rid myself of raster images that come from
Vectorworks dxf's. I posted this problem on the Autocad 2006 NG and so far
we've eliminated using bedit to delete them, and they aren't attached as
"images" so I can't just detach them. It was suggested that maybe some
generous programmer would be able to help me with a script that could find
and eradicate the nasty rasters...

I've attached an example file. I would really like to keep all o
f the blocks
that come in the file intact so I need someway to enter all of the blocks
(including anonymous blocks)(and there could easily be 1000 blocks in a
file) and delete all of the raster images within each one.

Has anyone here come across such a script or would anyone be up to the
challenge of writing one?

Thanks
Heather

@Anonymous wrote:
Heather,

This will delete the raster image objects in your example drawing without exploding
the block. Those things are wipeout objects. The code will only delete that type of
object when it's contained in a block. Just a word of caution in case any of your
blocks contain wipeouts.

It has some error checking for objects on locked layers. Avoid that, unlock all
layers first.

Joe Burke

[code]
;; 10/3/2005 Delete raster wipeouts in block definitions.
(defun c:DeleteBlockWipeouts ( / cnt blocks flag)
(setq cnt 0)
(setq blocks
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object))))
(vlax-for x blocks
(if
(and
(not (wcmatch (strcase (vlax-get x 'Name)) "*MODEL*,*PAPER*,*|*"))
(= :vlax-false (vla-get-IsXRef x))
)
(vlax-for item x
(if (= "AcDbWipeout" (vlax-get item 'ObjectName))
(if (not (vl-catch-all-error-p
(vl-catch-all-apply 'vla-delete (list item))))
(setq cnt (1+ cnt))
(setq flag T)
)
)
)
)
)
(princ (strcat "\nNumber of wipeouts deleted: " (itoa cnt)))
(if flag
(princ "\nSome items could not be deleted. Check for locked layers. ")
)
(princ)
) ;end
[/code]


"Heather" wrote in message
news:4974067@discussion.autodesk.com...
Hi,

I am trying to find a good way to rid myself of raster images that come from
Vectorworks dxf's. I posted this problem on the Autocad 2006 NG and so far
we've eliminated using bedit to delete them, and they aren't attached as
"images" so I can't just detach them. It was suggested that maybe some
generous programmer would be able to help me with a script that could find
and eradicate the nasty rasters...

I've attached an example file. I would really like to keep all o
f the blocks
that come in the file intact so I need someway to enter all of the blocks
(including anonymous blocks)(and there could easily be 1000 blocks in a
file) and delete all of the raster images within each one.

Has anyone here come across such a script or would anyone be up to the
challenge of writing one?

Thanks
Heather

 

Message 9 of 13
dbroad
in reply to: Anonymous

If it had been me answering the OP, 12 years ago, I would have asked why deleting wipeouts would be a good thing.  I use them all the time to save lots of fiddling with trimming, breaking, extending, exploding blocks,  and such.  The table block was extremely well designed  (other than the fact that it didn't have a name and had a ridiculous insertion point) and would be very useful in space planning to hide floor hatch.  With the right plotter settings, wipeouts work extremely well.

Architect, Registered NC, VA, SC, & GA.
Message 10 of 13
john.uhden
in reply to: dbroad

If you had ever wiped out on a skateboard going down a 20° (3:1±) paved walk you would have a different opinion of wipeouts.  😕

 

Ya know, before there were wipeouts I used to use "white-outs" (color 255 2D solids or wide polylines).

 

Actually, one of the best uses of wipeouts was for corner markers on land surveys.  Our survey draftsmen were always using circles and then trimming the property lines at the circle.  Good luck dimensioning the property line.  So I created a "hole" block with a multi-vertex polygon with a wipeout inside to yield the same appearance without trimming.

John F. Uhden

Message 11 of 13
dbroad
in reply to: john.uhden

You should switch to snow or water skiing.  Wipeouts in soft snow are just fine as long as the bindings release and there aren't any trees directly in front of you. 🙂

 

Exactly. No trimming and false dimensions required if the wipeout masks the true line endpoint.  I use them for section keys and elevation keys. They work great for porch columns to mask windows and siding hatch behind.  Porch railings with wipeouts work great as well.

Architect, Registered NC, VA, SC, & GA.
Message 12 of 13
john.uhden
in reply to: dbroad

I can still water ski just fine.  Got up the very first time I tried.  Didn't do so well with the snow skiing.  The slope was almost pure ice, and I really didn't know how to turn.  I musta been going 60 mph with the lodge approaching me fast.  I just leaned to my left and bailed out just before I would have crashed through the low windows.  It was so much fun!

 

Years ago, my kids picked up a used skurf board, aka wake board.  By the time I reached about 64, my eldest daughter taught me how to get up, but she hadn't taught me about letting go... SMACK!!!  Hitting the water ribs first at 20 mph kinda hurts for a week.  Haven't tried it since.  Don't have much of a chance anymore anyway with the boat not running.

John F. Uhden

Message 13 of 13
joselggalan
in reply to: Anonymous

try this:

 

;;---------------------------------------------------------
;; jlggalan 
;; Delete objets in block for condition....
(defun C:TEST1 (/ sele slen cod lstChanges
		  ;|functions|; jlgg-SSToList MakeListCount
	       )
 
	;; MakeListCount - jlggalan
	(defun MakeListCount (ItemName / PairCount)
	 (if (not (setq PairCount (assoc ItemName lstChanges)))
	  (setq lstChanges (cons (cons ItemName 1) lstChanges))
	  (setq lstChanges (subst (cons ItemName (1+ (cdr PairCount))) PairCount lstChanges))
	 )
	)
 
	;; jlgg-SSToList - jlggalan
	(defun jlgg-SSToList (ss / ssl n)
	 (if (and ss (= (type ss) 'PICKSET))
	  (repeat (setq n (sslength ss))
	   (setq ssl (cons (ssname ss (setq n (1- n))) ssl))))
	);c.defun 
 ;;------------ MAIN --------------------------
 (setvar "cmdecho" 0)
 (prompt "\nSelect Blocks: ")
 (if (setq sele (ssget '((0 . "INSERT"))))
  (progn
   (vl-cmdf "_.undo" "_BE")
   (setq sele (jlgg-SSToList sele)
	 slen (length sele)
	 cod 0)
   (mapcar
    (function
     (Lambda (Ent / oEnt)
      (setq oEnt (vlax-ename->vla-object Ent))
      
      (LM:ApplytoBlockObjects
       (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
       (vla-get-effectivename oEnt)
       (function
	(lambda ( obj / typeObj Delete strError)
	 (setq typeObj (vla-get-ObjectName obj))
	 (cond
	  ((vlax-erased-p obj)
	   (setq Delete nil)
	  )
	  ((= "AcDbWipeout" typeObj)
	   (setq Delete T)
	  )
	  ;((= "AcDbPoint" typeObj)
	  ; (setq Delete T)
	  ;)
	 );c.cond

	 ;;Del Object
	 (cond
	  ((not Delete))
	  ((vl-catch-all-error-p
	    (setq strError (vl-catch-all-apply (function VLA-Delete)(list obj))))
	   (print typeObj)(princ " : ")
	   (princ (vl-catch-all-error-message strError))
	   (princ)
	  )
	  (t (MakeListCount typeObj))
	 );c.cond
	)
       );c.function
      );;c.LM:ApplytoBlockObjects

      (setq cod (1+ cod))
      (prompt (strcat "\rProcessing blocks: " (itoa cod)  " of " (itoa slen)))
     )
    );c.function
    sele
   );c.mapcar
   (vl-cmdf "_.undo" "_E")
   (if lstChanges
    (mapcar (function (lambda (PairCount / )
     (prompt (strcat "\nProcessed [" (car PairCount) "]: " (itoa (cdr PairCount))  " items " ))
    )) lstChanges)	    
   )
  );c.progn
 );c.if 
 
 (princ)
);c defun

;; Apply to Block Objects  -  Lee Mac
;; Evaluates a supplied function on all objects in a block definition.
;; Arguments:
;; blks - VLA Block Collection in which block resides
;; name - Block name
;; func - function to apply to all objects in block
;; Returns a list of results of evaluating the function, else nil.
(defun LM:ApplytoBlockObjects (blks name func / def result name)
    (setq func (eval func))
    (if (not (vl-catch-all-error-p (setq def (vl-catch-all-apply 'vla-item (list blks name)))))
        (vlax-for obj def
	 ;(print (vla-get-ObjectName obj))
	 (if (not (vlax-erased-p obj))
	   (cond
	    ((vl-catch-all-error-p (setq name (vl-catch-all-apply (function vla-get-ObjectName) (list obj)))))
	    ((= name "AcDbBlockReference")
	     (setq result (cons (func obj) result))
	     (LM:ApplytoBlockObjects blks (vla-get-effectivename obj) func)
	    )
	    (T (setq result (cons (func obj) result)))
	   )
	  
	 )
	)
    )
    (reverse result)
)

(princ)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report