Author Topic: need help  (Read 7556 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #15 on: June 10, 2004, 11:02:23 AM »
Not sure why you get that error.
Recopy the routine above and try on another drawing.
If it works, sent me the drawing that it did not work in.

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

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
need help
« Reply #16 on: June 10, 2004, 12:12:50 PM »
Taking from CAB's idea yesterday, here's a revised version that works rather well.

Code: [Select]

(defun c:del_vif(/ str ss)
  (vl-load-com)
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-startundomark doc)
  (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
 (setq str (vla-get-textoverride x))
 (mapcar '(lambda (ms)
          (if (wcmatch str (strcat "*" ms "*"))
                   (vla-put-textoverride x (vl-string-subst "" ms str))
                     ))
       '("(VIF)" "(vif)" "vif" "VIF" "v.i.f." "V.I.F." "±"))
        ;; Add any other strings to remove to the above list
)
       )
  (vla-endundomark doc)
  (princ);exit quietly
  )


Jeff

ELOQUINTET

  • Guest
need help
« Reply #17 on: June 10, 2004, 12:34:59 PM »
that one works for me (no error) great job jeff

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #18 on: June 10, 2004, 12:35:50 PM »
Jeff,
Good job :) , I added code to remove the entire "%%P*".
Looks like there could be many variations of special characters.

Next Dan will be asking for a routine to select the dimension with
a text override and it would then remove all matching on the database. :shock:

CAB

Code: [Select]
(defun c:del_vif(/ str ss)
  (vl-load-com)
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-startundomark doc)
  (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
     (setq str (vla-get-textoverride x))
     (mapcar '(lambda (ms)
         (if (wcmatch str (strcat "*" ms "*"))
               (vla-put-textoverride x
                 (vl-string-subst ""
                   (vl-string-subst "" "\\" ms) str))
                         ))
           '("(VIF)" "(vif)" "vif" "VIF" "v.i.f." "V.I.F." "%%p\*" "%%P\*"))
            ;; Add any other strings to remove to the above list
   )
       )
  (vla-endundomark doc)
  (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 #19 on: June 10, 2004, 12:44:29 PM »
o gimme gimme gimme  :P

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
need help
« Reply #20 on: June 10, 2004, 02:01:42 PM »
- CAB, Jeff

excellent stuff you guys.

Dan, beer's on you ............... we'll be over around 7.
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
need help
« Reply #21 on: June 10, 2004, 02:11:44 PM »
>>>slides a cold one down the bar<<<

why wait til 7 here ya go

 8)

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
need help
« Reply #22 on: June 10, 2004, 02:13:12 PM »
It's 5 O'clock somewhere.
I drink beer and I know things....

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #23 on: June 10, 2004, 04:58:24 PM »
Here is version one. The entire dim override is deleted.
Thinking about adding the option to edit the text to match of the Dim override.
So you could edit "11'-1" %%p*" to read "%%p*" and only the %%p* would be deleted.
And perhaps an option to replace the %%p* with user entered text.
Not sure which options if any would be useful?


Code: [Select]
;;;  DimTextDel.lsp by Charles Alan Butler
;;;             Copyright 2004            
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at ab2draft@TampaBay.rr.com
;;;
;;;   Version 1.0 Beta  June 10,2004
;;;
;;; DESCRIPTION
;;; User picks dimension with text override and routine deletes
;;; all override text overrides in dims with matching override
;;;
;;;
;;;  Limitations
;;;  Deletes the entire override text
;;;
;;;
;;; Command Line Usage
;;; Command: dimtextdel
;;;         Select Dimension with Text to delete.
;;;
;;;
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;                                                                    ;
;;;  You are hereby granted permission to use, copy and modify this    ;
;;;  software without charge, provided you do so exclusively for       ;
;;;  your own use or for use by others in your organization in the     ;
;;;  performance of their normal duties, and provided further that     ;
;;;  the above copyright notice appears in all copies and both that    ;
;;;  copyright notice and the limited warranty and restricted rights   ;
;;;  notice appear in all supporting documentation.                    ;
(defun c:dimtextdel (/ str ss ovrtxt)
  (vl-load-com)
  (if (setq dm (entsel "\nSelect Dimension with Text to delete."))
    (progn
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (setq dm (vlax-ename->vla-object (car dm)))
      (if (wcmatch (vla-get-objectname dm) "*Dimension")
        (if (/= (setq ovrtxt (vla-get-textoverride dm)) "")
          (progn
            (vla-startundomark doc)
            (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 (= (setq str (vla-get-textoverride x)) ovrtxt)
                       (vla-put-textoverride x "")
                )
              )
            ); and
            (vla-endundomark doc)
          ); progn
          (alert "\n\tNo Text Override in Dimension\t")
        )
        (alert "\n\Not a Dimension\t")
      )
    )
  )
  (princ) ;exit quietly
)
(prompt "\nDimension Text Delete loaded, enter dimtextdel to run.")
(princ)
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #24 on: June 10, 2004, 06:01:58 PM »
Ok, here is version 1.1
You edit the text override, removing the text to keep.
Note that the remaining text after editing must be a match to existing.
Like "11'1\" %%p*" can be edited to "%%p*" and "%%p*" will be removed.
But "SEE TABLE A1" edited to "SEE A1" will not work because there is no
match.
The work around is this:
you may do this "SEE TABLE A1" --> "SEE "
and then "SEE TABLE A1" --> " A1"
leaving TABLE

PS one problem with ddedit. If you hit Escape it returns you to the routine
and the complete text override is deleted. Is there a way to tell if it was
exited via escape vs enter?

Code: [Select]
;;;  DimTextDel.lsp by Charles Alan Butler
;;;             Copyright 2004            
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at ab2draft@TampaBay.rr.com
;;;
;;;   Version 1.0 Beta  June 10,2004
;;;   Version 1.1 Beta  June 10,2004
;;;     Added edit of text override to remove
;;;
;;; DESCRIPTION
;;; User picks dimension with text override and routine deletes
;;; all overide text overrides in dims with matching override
;;;
;;;
;;;  Limitations
;;;  Text edit is limited, remaining text must be unbroken
;;;    "11'1\" %%p*" --> "%%p*"  is OK
;;;    "SEE TABLE A1" --> "SEE A1"  will fail to match
;;;       you may do this "SEE TABLE A1" --> "SEE "
;;;
;;;
;;; Command Line Usage
;;; Command: dimtextdel
;;;         Select Dimension with Text to remove.
;;;
;;;
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;                                                                    ;
;;;  You are hereby granted permission to use, copy and modify this    ;
;;;  software without charge, provided you do so exclusively for       ;
;;;  your own use or for use by others in your organization in the     ;
;;;  performance of their normal duties, and provided further that     ;
;;;  the above copyright notice appears in all copies and both that    ;
;;;  copyright notice and the limited warranty and restricted rights   ;
;;;  notice appear in all supporting documentation.                    ;
(defun c:dimtextdel (/ str ss dm ovrtxt repltxt txt)
  ;;  ===============  ERROR ROUTINE  =================
  (defun *error* (msg)
    (if
      (not
        (member
          msg
          '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; if
    (setvar "CMDECHO" usercmd)
    (if txt
      (progn
        (entdel txt)
        (setq txt nil)
      )
    )
    (princ)
  ) ;
 ;end error function
;;;  =================================================================
;;;                       Main Routine
;;;  =================================================================
  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (vl-load-com)
  (if (setq dm (entsel "\nSelect Dimension with Text to remove."))
    (progn
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (setq dm (vlax-ename->vla-object (car dm)))
      (if (wcmatch (vla-get-objectname dm) "*Dimension")
        (if (/= (setq ovrtxt (vla-get-textoverride dm)) "")
          (progn
            (if (entmake (list '(0 . "TEXT")
                               (cons 10 '(0 0))
                               (cons 40 (getvar "TEXTSIZE"))
                               (cons 7 (getvar "TEXTSTYLE"))
                               (cons 1 ovrtxt) ; Text String
                         )
                )
              (setq txt (entlast))
              (quit)
            ) ; endif
            (prompt
              "\nDelete the text you want to keep or press Enter to delete all."
            )
            (command "._ddedit" txt "")
            (setq repltxt (cdr (assoc 1 (entget txt))))
            (entdel txt)
            (setq txt nil)
            (vla-startundomark doc)
            (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 (= (setq str (vla-get-textoverride x)) ovrtxt)
                  (vla-put-textoverride
                    x
                    (vl-string-subst "" repltxt ovrtxt)
                  )
                )
              )
            ) ; and
            (vla-endundomark doc)
          ) ; progn
          (alert "\n\tNo Text Override in Dimension\t")
        )
        (alert "\n\tNot a Dimension\t")
      )
    )
  )
  (princ) ;exit quietly
)
(prompt
  "\nDimension Text Delete loaded, enter dimtextdel to run."
)
(princ)
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.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
need help
« Reply #25 on: June 15, 2004, 11:40:50 PM »
Dangit ... this looks almost like an Autodork forum ... shoot before we can get comfortable with the software someone goes and presents an UPGRADE... what is the world coming to....
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
need help
« Reply #26 on: June 16, 2004, 07:49:36 AM »
LOL - you are quite right. :)

Where have you been?

I started a dcl version to overcome the ddedit problem but quit do to lack
of interest both here and mine. Seems work is overrunning me too.
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.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
need help
« Reply #27 on: June 16, 2004, 08:08:50 AM »
Well, I have been busy on other ventures like WORK ... been under the gun for some time and it dies not look like it will get any better real soon
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

ELOQUINTET

  • Guest
need help
« Reply #28 on: June 16, 2004, 09:13:45 AM »
someone asked me a question that i didn't have the answer to so i'll ask you guys. i showed him how to copy and paste viewports from one layout to another then turn mv on. when he tries to copy another he gets the original. how can he do another?