Jump to content

Text or Block Count


johnengineer

Recommended Posts

Ok I've experimented a bit, try this instead:

 

(defun c:bu (/ *error* doc oldc ss sel scl)
 (vl-load-com)

 (defun *error* (msg)
   (if doc (vla-EndUndoMark doc))
   (if oldc (setvar "CMDECHO" oldc))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq doc (vla-get-ActiveDocument
             (vlax-get-acad-object)))
 (setq oldc (getvar "CMDECHO") scl (getvar "DIMSCALE"))
 (setvar "CMDECHO" 0)

 (if (setq ss (ssget '((0 . "INSERT") (66 . 1))))
   (progn
     (vla-StartUndoMark doc)
     (command "_.-objectscale" ss "" "_add" "1:1" "")
     (setvar "CANNOSCALE" "1:1")
     (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet doc))        
       (foreach x
         (if (eq :vlax-true
               (vla-get-IsDynamicBlock Obj))
           '(XEffectiveScaleFactor YEffectiveScaleFactor ZEffectiveScaleFactor)
           '(XScaleFactor YScaleFactor ZScaleFactor))
         (vlax-put-property Obj x scl))
       (command "_.attsync" "_Name" (vla-get-Name Obj)))
     (vla-delete sel)
     (vla-EndUndoMark doc)))

 (setvar "CMDECHO" oldc)
 (princ))

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • gilsoto13

    12

  • Lee Mac

    11

  • VVA

    3

  • alanjt

    1

Top Posters In This Topic

Ok I've experimented a bit, try this instead:

 

(defun c:bu (/ *error* doc oldc ss sel scl)
 (vl-load-com)

 (defun *error* (msg)
   (if doc (vla-EndUndoMark doc))
   (if oldc (setvar "CMDECHO" oldc))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq doc (vla-get-ActiveDocument
             (vlax-get-acad-object)))
 (setq oldc (getvar "CMDECHO") scl (getvar "DIMSCALE"))
 (setvar "CMDECHO" 0)

 (if (setq ss (ssget '((0 . "INSERT") (66 . 1))))
   (progn
     (vla-StartUndoMark doc)
     (command "_.-objectscale" ss "" "_add" "1:1" "")
     (setvar "CANNOSCALE" "1:1")
     (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet doc))        
       (foreach x
         (if (eq :vlax-true
               (vla-get-IsDynamicBlock Obj))
           '(XEffectiveScaleFactor YEffectiveScaleFactor ZEffectiveScaleFactor)
           '(XScaleFactor YScaleFactor ZScaleFactor))
         (vlax-put-property Obj x scl))
       (command "_.attsync" "_Name" (vla-get-Name Obj)))
     (vla-delete sel)
     (vla-EndUndoMark doc)))

 (setvar "CMDECHO" oldc)
 (princ))

 

 

well. There are new names and stuff.. but even then the result is the same... those things won't show... still my bu.lsp just skipping the named 0* blocks is the option... I guess we can stick with this until I find the option to add the block name list... but I will try it tomorrow in my off-work time.

Link to comment
Share on other sites

Sorry, I forgot something, try this:

 

(defun c:bu (/ *error* doc oldc ss sel scl)
 (vl-load-com)

 (defun *error* (msg)
   (if doc (vla-EndUndoMark doc))
   (if oldc (setvar "CMDECHO" oldc))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq doc (vla-get-ActiveDocument
             (vlax-get-acad-object)))
 (setq oldc (getvar "CMDECHO") scl (getvar "DIMSCALE"))
 (setvar "CMDECHO" 0)

 (if (setq ss (ssget '((0 . "INSERT") (66 . 1))))
   (progn
     (vla-StartUndoMark doc)
     (command "_.-objectscale" ss "" "_add" "1:1" "")
     (setvar "CANNOSCALE" "1:1")
     (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet doc))        
       (foreach x
         (if (eq :vlax-true
               (vla-get-IsDynamicBlock Obj))
           '(XEffectiveScaleFactor YEffectiveScaleFactor ZEffectiveScaleFactor)
           '(XScaleFactor YScaleFactor ZScaleFactor))
         (vlax-put-property Obj x scl))
       (command "_.attsync" "_Name"
         (vlax-get-property Obj
           (if (eq :vlax-true
                 (vla-get-isDynamicBlock Obj)) 'EffectiveName 'Name))))
     (vla-delete sel)
     (vla-EndUndoMark doc)))

 (setvar "CMDECHO" oldc)
 (princ))

Link to comment
Share on other sites

ooo my goonies...

 

It's aliiveee!!

 

 

It really works now... I don't know how much you did, but it really works completely now... it seems there's nothing impossible for you.

 

How much do I owe you now?

 

If 100 dlls per hour... and you took about 5 or 6... this lisp is going to be expensive now ...my entire 2 weeks paycheck...

 

:s

 

Hope I can pay with my "complete web autocad blocks collection" available in less than a month...

 

I will use it from now on... Now that's what I call a lisp.

Link to comment
Share on other sites

ooo my goonies...

 

It's aliiveee!!

 

 

It really works now... I don't know how much you did, but it really works completely now... it seems there's nothing impossible for you.

 

How much do I owe you now?

 

If 100 dlls per hour... and you took about 5 or 6... this lisp is going to be expensive now ...my entire 2 weeks paycheck...

 

:s

 

Hope I can pay with my "complete web autocad blocks collection" available in less than a month...

 

I will use it from now on... Now that's what I call a lisp.

 

Glad you like it. :)

Link to comment
Share on other sites

  • 3 weeks later...
Glad you like it. :)

 

Ooou no... guess what?.... I have been using this beauty... but today I found that I cannot select normal blocks with the last version.. only dynamic blocks... I didn't realize of it until now...

 

If anything is possible... is it possible to make it work with normal and dynamic blocks at once?.. I thought it was doing it before... but I was actually using my old version where all blocks were being sincronized (My Pc was loading automatically the old version)

 

I like your version, but it now won´t let me select normal blocks... is it fixable?

Link to comment
Share on other sites

You should be able to select normal blocks - but it will only allow attributed blocks. :)

 

Well, I checked it out again... and yes, it just allow attributed blocks, that's what I want to change... In my case we have a standard library combining normal, attributed and dynamic blocks... so I need this routine to work on all of them at the same time...

 

I got my previous version that was sincronizing them all, then I made it to sincronized all but those starting with 0 (cero), and it still works for my case, but yours was better in order to sincronize only selected blocks, but if it doesn't work with normal blocks... it becomes useless for my purpose.

 

Well, you don´t need to waste more time in it.. but well...

Link to comment
Share on other sites

Try this:

 

(defun c:bu (/ *error* doc oldc ss sel scl)
 (vl-load-com)

 (defun *error* (msg)
   (if doc (vla-EndUndoMark doc))
   (if oldc (setvar "CMDECHO" oldc))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq doc (vla-get-ActiveDocument
             (vlax-get-acad-object)))
 (setq oldc (getvar "CMDECHO") scl (getvar "DIMSCALE"))
 (setvar "CMDECHO" 0)

 (if (setq ss (ssget '((0 . "INSERT"))))
   (progn
     (vla-StartUndoMark doc)
     (command "_.-objectscale" ss "" "_add" "1:1" "")
     (setvar "CANNOSCALE" "1:1")
     (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet doc))        
       (foreach x
         (if (eq :vlax-true
               (vla-get-IsDynamicBlock Obj))
           '(XEffectiveScaleFactor YEffectiveScaleFactor ZEffectiveScaleFactor)
           '(XScaleFactor YScaleFactor ZScaleFactor))
         (vlax-put-property Obj x scl))
       (if (eq :vlax-true (vla-get-HasAttributes Obj))
         (command "_.attsync" "_Name"
           (vlax-get-property Obj
             (if (eq :vlax-true
                   (vla-get-isDynamicBlock Obj)) 'EffectiveName 'Name)))))
     (vla-delete sel)
     (vla-EndUndoMark doc)))

 (setvar "CMDECHO" oldc)
 (princ))

Link to comment
Share on other sites

Ok I've experimented a bit, try this instead:

 

(defun c:bu (/ *error* doc oldc ss sel scl)
 (vl-load-com)

 (defun *error* (msg)
   (if doc (vla-EndUndoMark doc))
   (if oldc (setvar "CMDECHO" oldc))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq doc (vla-get-ActiveDocument
             (vlax-get-acad-object)))
 (setq oldc (getvar "CMDECHO") scl (getvar "DIMSCALE"))
 (setvar "CMDECHO" 0)

 (if (setq ss (ssget '((0 . "INSERT") (66 . 1))))
   (progn
     (vla-StartUndoMark doc)
     (command "_.-objectscale" ss "" "_add" "1:1" "")
     (setvar "CANNOSCALE" "1:1")
     (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet doc))        
       (foreach x
         (if (eq :vlax-true
               (vla-get-IsDynamicBlock Obj))
           '(XEffectiveScaleFactor YEffectiveScaleFactor ZEffectiveScaleFactor)
           '(XScaleFactor YScaleFactor ZScaleFactor))
         (vlax-put-property Obj x scl))
       (command "_.attsync" "_Name" (vla-get-Name Obj)))
     (vla-delete sel)
     (vla-EndUndoMark doc)))

 (setvar "CMDECHO" oldc)
 (princ))

 

icon14.gif

 

Aneenee... It works... I am gonna check what you did... I don´t know anyhting about vlisp but... I already started with the Purgefiles.lsp by adding a line to audit... and worked... that's a start.

 

And thanks for it... Faith returned to my heart.

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