Jump to content

Recommended Posts

Posted

Here is what I want to accomplish with using a lisp routine:

Place all Line work and Line Type on layer “0”

Check to see if all text is on layer “0”, if not then place on layer “0”

Change all text style to Arial

Delete tiff image no matter what layer it’s on

Delete layer name Tiff_image

Purge all at least 3 times to insure that there are nothing left in the file

Zoom extents

Quick save

Close

Can anyone help me with this task?

Posted

Place all Line work and Line Type on layer “0” (what does this mean?)

Check to see if all text is on layer “0”, if not then place on layer “0” (done)

Change all text style to Arial (do you have a style named arial or do you mean the font?)

Delete tiff image no matter what layer it’s on (done)

Delete layer name Tiff_image (the purge will take care of this if there are no other objects on that layer)

Purge all at least 3 times to insure that there are nothing left in the file

(done)

Zoom extents (done)

Quick save (done)

Close (done)

 

 
(defun c:tip (/ ss ss1 en1 cnt en pth)

;;; change all text not on layer 0 to layer 0
  (setq ss1(ssget "X"
       '((0 . "MTEXT,TEXT")(410 . "Model")
       (-4 . "<NOT")(8 . "0")(-4 . "NOT>"))
       );_ssget
       );_setq
  (if ss1
       (progn
(setq cnt 0)
       (while (< cnt (sslength ss1))
(setq en1(vlax-ename->vla-object(ssname ss1 cnt)))
       (vla-put-layer en1 "0")
       (setq cnt (1+ cnt))
       );_while
       );_progn
       );_if
  ;;;***delete all TIFF files in model space
(setq ss (ssget "_X" '((0 . "IMAGE")(410 . "Model"))))
  (if ss
       (progn
(setq cnt 0)       
(while (< cnt (sslength ss))
      (setq en(vlax-ename->vla-object(ssname ss cnt)))                 
(setq pth(vla-get-imagefile en))
       (if(=(strcase(vl-filename-extension pth))".TIFF")
(command "-image" "detach" (vl-filename-base pth))
       );_if
(setq cnt (1+ cnt))
       );_while
       );_progn
       );_if
  ;;;*** purge 3 times***
  (command "-purge" "ALL" "" "NO")
  (command "-purge" "ALL" "" "NO")
  (command "-purge" "ALL" "" "NO")

  ;;;*** zoom extence
  (command "zoom" "extents")

  ;;;*** quick save
  (command "qsave")

  ;;;*** close
  (command "close")
  (princ)
 );_defun

 

Since I only did half the work I’m only charging $500,000,00

please credit my paypal account.

Posted
[/code]Since I only did half the work I’m only charging $500,000,00

please credit my paypal account.

Dang! I want a piece of that. :xmas:

Posted

I looked, but couldn't find it. How can you find the image file name in plain Autolisp? -David

Posted
I looked, but couldn't find it. How can you find the image file name in plain Autolisp? -David

It's in the dictionary......I'm pretty sure it is.

Posted

Thanks. I'll take a look see. -David

Posted
I looked, but couldn't find it. How can you find the image file name in plain Autolisp? -David

Sure it is

(setq imagename (cdr (assoc 1
       (entget (cdr (assoc 340 (entget en))))))

 

~'J'~

Posted
Sure it is

(setq imagename (cdr (assoc 1
       (entget (cdr (assoc 340 (entget en))))))

 

~'J'~

 

Thanks!

 

I'd try something like this then:

 

[b][color=BLACK]([/color][/b]defun c:cande [b][color=FUCHSIA]([/color][/b]/ ss i en ed im[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"*LINE,*TEXT"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_.CHANGE"[/color] ss [color=#2f4f4f]""[/color] [color=#2f4f4f]"_P"[/color] [color=#2f4f4f]"_LA"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]""[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]cond [b][color=NAVY]([/color][/b][b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"STYLE"[/color] [color=#2f4f4f]"ARIAL"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b][b][color=MAROON]([/color][/b]or [b][color=GREEN]([/color][/b]findfile [color=#2f4f4f]"ARIAL.SHX"[/color][b][color=GREEN])[/color][/b]
            [b][color=GREEN]([/color][/b]findfile [color=#2f4f4f]"ARIAL.PFB"[/color][b][color=GREEN])[/color][/b]
            [b][color=GREEN]([/color][/b]findfile [color=#2f4f4f]"ARIAL.TTF"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
        [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.STYLE"[/color] [color=#2f4f4f]"ARIAL"[/color] [color=#2f4f4f]"ARIAL"[/color][b][color=MAROON])[/color][/b]
        [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]> [b][color=BLUE]([/color][/b]getvar [color=#2f4f4f]"CMDACTIVE"[/color][b][color=BLUE])[/color][/b] 0[b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]command [color=#2f4f4f]""[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b]T
        [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.STYLE"[/color] [color=#2f4f4f]"ARIAL"[/color] [color=#2f4f4f]"TXT"[/color][b][color=MAROON])[/color][/b]
        [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]> [b][color=BLUE]([/color][/b]getvar [color=#2f4f4f]"CMDACTIVE"[/color][b][color=BLUE])[/color][/b] 0[b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]command [color=#2f4f4f]""[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"*TEXT"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]setq i [b][color=MAROON]([/color][/b]sslength ss[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]not [b][color=GREEN]([/color][/b]minusp [b][color=BLUE]([/color][/b]setq i [b][color=RED]([/color][/b]1- i[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss i[b][color=GREEN])[/color][/b]
                   ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]entmod [b][color=GREEN]([/color][/b]subst [b][color=BLUE]([/color][/b]cons 7 [color=#2f4f4f]"ARIAL"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]assoc 7 ed[b][color=BLUE])[/color][/b] ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"IMAGE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]setq i [b][color=MAROON]([/color][/b]sslength ss[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]not [b][color=GREEN]([/color][/b]minusp [b][color=BLUE]([/color][/b]setq i [b][color=RED]([/color][/b]1- i[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss i[b][color=GREEN])[/color][/b]
                   im [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 1 [b][color=RED]([/color][/b]entget [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 340 [b][color=OLIVE]([/color][/b]entget en[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]= [color=#2f4f4f]".TIF"[/color] [b][color=BLUE]([/color][/b]substr im [b][color=RED]([/color][/b]- [b][color=PURPLE]([/color][/b]strlen im[b][color=PURPLE])[/color][/b] 4[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                 [b][color=GREEN]([/color][/b]entdel en[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]> [b][color=MAROON]([/color][/b]getvar [color=#2f4f4f]"DBMOD"[/color][b][color=MAROON])[/color][/b] 0[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_.PURGE"[/color] [color=#2f4f4f]"_All"[/color] [color=#2f4f4f]"_No"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.ZOOM"[/color] [color=#2f4f4f]"_E"[/color]
          [color=#2f4f4f]"_.QSAVE"[/color]
          [color=#2f4f4f]"_.CLOSE"[/color][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

Untested -David

Posted

Hey thanks a lot, payment will be sent by dog team from alaska, let me know when it gets there......:D

 

jimmy

Posted
Hey thanks a lot, payment will be sent by dog team from alaska, let me know when it gets there......:D

 

jimmy

 

Dog was stop on Canadian border due to H1N1 :D

Posted

The credit transfer was saved as a file to a hard disk. That disk has been read and the hex code is being copied (with pointers) to post-it notes and sent via carrier pigeon.

 

Incidentally, what would a dragon do in this day and age, what with most of the worlds money being stored and transferred electronically? Would it hoard credit cards? Would it sleep on the New York Stock Exchange?

 

*EDIT* I just realized that had nothing to do with anything. *backs away slowly*

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...