Author Topic: need help  (Read 7598 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
need help
« on: June 08, 2004, 11:38:52 AM »
i've been assigned some as built drawings and am looking for an easy way to remove vif from all dimensions in a drawing. anybody have something that would do the job. thanks in advance

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
need help
« Reply #1 on: June 08, 2004, 12:04:11 PM »
Sure, here's a lisp that does this. You can change the text to search for/replace with to whatever suits your needs. The routine is case sensitive so if your dimensions actually have VIF you will need to adjust it.

Code: [Select]

(defun c:del_vif(/ str ss)
  (vl-load-com)
  (and (ssget "X" '((0 . "*DIM*")));get all dimension objects
       (setq ss (vla-get-activeselectionset
 (vla-get-activedocument
   (vlax-get-acad-object))));use ActiveX ss
       (vlax-for x ss
(if (wcmatch (setq str (vla-get-textoverride x)) "*vif*");if it matches this string
  (vla-put-textoverride x (vl-string-subst "" "vif" str));replace it with empty string
  )
)
       )
  (princ);exit quietly
  )


Jeff

ELOQUINTET

  • Guest
need help
« Reply #2 on: June 08, 2004, 12:20:25 PM »
thanks jeff works like a charm a real timesaver appreciate it  :wink:

ELOQUINTET

  • Guest
one problem...
« Reply #3 on: June 08, 2004, 01:04:06 PM »
how do i modify this to delete multiple formats. example: i always put V.I.F. but some people put (VIF) some put vif etc. etc. how can i encorporate all the formats so i can be assured there will be no vif on the drawing?

Code: [Select]
   (if (wcmatch (setq str (vla-get-textoverride x)) "*V.I.F.*");if it matches this string
      (vla-put-textoverride x (vl-string-subst "" "V.I.F." str));replace it with empty string

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
need help
« Reply #4 on: June 08, 2004, 01:36:06 PM »
This should do it. Replace the entire (vlax-for ) loop with this.
Code: [Select]

(vlax-for x ss
(cond ((wcmatch (setq str (vla-get-textoverride x)) "*vif*")
(vla-put-textoverride x (vl-string-subst "" "vif" str))
)
      ((wcmatch (setq str (vla-get-textoverride x)) "*v.i.f.*")
(vla-put-textoverride x (vl-string-subst "" "v.i.f." str))
)
      ((wcmatch (setq str (vla-get-textoverride x)) "*VIF*")
(vla-put-textoverride x (vl-string-subst "" "VIF" str))
)
      ((wcmatch (setq str (vla-get-textoverride x)) "*V.I.F.*")
(vla-put-textoverride x (vl-string-subst "" "V.I.F." str))
)
      ((wcmatch (setq str (vla-get-textoverride x)) "*(VIF)*")
(vla-put-textoverride x (vl-string-subst "" "(VIF)" str))
)
  )
)


Jeff

ELOQUINTET

  • Guest
need help
« Reply #5 on: June 08, 2004, 03:08:29 PM »
jeff something wrong here's what i get when apploading:

; error: malformed list on input

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #6 on: June 08, 2004, 03:18:25 PM »
Jeff,
Could it be done this way?

Code: [Select]
(vlax-for x ss
  (mapcar '(lambda (ms)
           (if (wcmatch (setq str (vla-get-textoverride x)) ms)
                    (vla-put-textoverride x (vl-string-subst "" ms str))
                      ))
        '("vif" "VIF" "v.i.f." "V.I.F." "(VIF)"))
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
need help
« Reply #7 on: June 08, 2004, 04:06:45 PM »
so here's what i've got now but am still getting the same message. any of you experts see what's goin on, and could inform me pllllllease

Code: [Select]
(defun c:del_vif(/ str ss)
  (vl-load-com)
  (and (ssget "X" '((0 . "*DIM*")));get all dimension objects
       (setq ss (vla-get-activeselectionset
        (vla-get-activedocument
          (vlax-get-acad-object))));use ActiveX ss
(vlax-for x ss
  (mapcar '(lambda (ms)
           (if (wcmatch (setq str (vla-get-textoverride x)) ms)
                    (vla-put-textoverride x (vl-string-subst "" ms str))
                      ))
        '("vif" "VIF" "v.i.f." "V.I.F." "(VIF)"))
)
  (princ);exit quietly
  )

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #8 on: June 08, 2004, 04:17:42 PM »
dan,
use this..  I was just messing around with options.

Code: [Select]
(defun c:del_vif (/ str ss)
  (vl-load-com)
  (and (ssget "X" '((0 . "*DIM*"))) ;get all dimension objects
       (setq ss (vla-get-activeselectionset
                  (vla-get-activedocument
                    (vlax-get-acad-object)
                  )
                )
       ) ;use ActiveX ss
       (vlax-for x ss
         (cond ((wcmatch (setq str (vla-get-textoverride x)) "*vif*")
                (vla-put-textoverride x (vl-string-subst "" "vif" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*v.i.f.*")
                (vla-put-textoverride x (vl-string-subst "" "v.i.f." str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*VIF*")
                (vla-put-textoverride x (vl-string-subst "" "VIF" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*V.I.F.*")
                (vla-put-textoverride x (vl-string-subst "" "V.I.F." str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*(VIF)*")
                (vla-put-textoverride x (vl-string-subst "" "(VIF)" str))
               )
         )
       )

  )
  (princ) ;exit quietly
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
need help
« Reply #9 on: June 08, 2004, 04:44:01 PM »
mmm doesn't quite work cab. for some reason if it reads as 47" (VIF) when changed it reads as 47" (). damn brackets urrrrgh :twisted:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #10 on: June 08, 2004, 05:01:06 PM »
Revised:
Code: [Select]
(defun c:del_vif (/ str ss)
  (vl-load-com)
  (and (ssget "X" '((0 . "*DIM*"))) ;get all dimension objects
       (setq ss (vla-get-activeselectionset
                  (vla-get-activedocument
                    (vlax-get-acad-object)
                  )
                )
       ) ;use ActiveX ss
       (vlax-for x ss
         (cond ((wcmatch (setq str (vla-get-textoverride x)) "*vif*")
                (vla-put-textoverride x (vl-string-subst "" "vif" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*v.i.f.*")
                (vla-put-textoverride x (vl-string-subst "" "v.i.f." str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*V.I.F.*")
                (vla-put-textoverride x (vl-string-subst "" "V.I.F." str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*(VIF)*")
                (vla-put-textoverride x (vl-string-subst "" "(VIF)" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*VIF*")
                (vla-put-textoverride x (vl-string-subst "" "VIF" str))
               )
         )
       )

  )
  (princ) ;exit quietly
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
need help
« Reply #11 on: June 09, 2004, 08:15:49 AM »
works great now cab

ELOQUINTET

  • Guest
need help
« Reply #12 on: June 10, 2004, 10:15:05 AM »
i just encountered another problem. i also have to get rid of any plus minus symbols. i tried putting this in the code but no go. heeeeelp please

[/code]               ((wcmatch (setq str (vla-get-textoverride x)) "*%%p*")
                (vla-put-textoverride x (vl-string-subst "" "%%p" str))
Code: [Select]

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #13 on: June 10, 2004, 10:32:08 AM »
Code: [Select]
(defun c:del_vif (/ str ss)
  (vl-load-com)
  (and (ssget "X" '((0 . "*DIM*"))) ;get all dimension objects
       (setq ss (vla-get-activeselectionset
                  (vla-get-activedocument
                    (vlax-get-acad-object)
                  )
                )
       ) ;use ActiveX ss
       (vlax-for x ss
         (cond ((wcmatch (setq str (vla-get-textoverride x)) "*vif*")
                (vla-put-textoverride x (vl-string-subst "" "vif" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*v.i.f.*")
                (vla-put-textoverride x (vl-string-subst "" "v.i.f." str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*V.I.F.*")
                (vla-put-textoverride x (vl-string-subst "" "V.I.F." str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*(VIF)*")
                (vla-put-textoverride x (vl-string-subst "" "(VIF)" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*VIF*")
                (vla-put-textoverride x (vl-string-subst "" "VIF" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*%%p\**")
                (vla-put-textoverride x (vl-string-subst "" "%%p*" str))
               )
               ((wcmatch (setq str (vla-get-textoverride x)) "*%%P\**")
                (vla-put-textoverride x (vl-string-subst "" "%%P*" str))
               )
         )
       )

  )
  (princ) ;exit quietly
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
need help
« Reply #14 on: June 10, 2004, 10:47:09 AM »
cab here's what i get

; error: Automation Error. Calling method AddItems of interface
IAcadSelectionSet failed