Results 1 to 2 of 2

Thread: LISP- SUBSTITUIÇÃO DE BLOCOS (BLOCK REPLACER)

  1. #1
    100 Club
    Join Date
    2012-08
    Posts
    111
    Login to Give a bone
    0

    Post LISP- SUBSTITUIÇÃO DE BLOCOS (BLOCK REPLACER)

    Boa Tarde pessoal,
    Alguem poderia me ajudar a fazer uma pequena modificação neste lisp.
    Bom, este lisp serve para trocar um determinado bloco por outro a sua escolha. Existem 2 opções de seleção do bloco a ser substituido: Single e Global.
    EU gostaria de alterar a opção Single, nesta opção ela permite apenas uma seleção o nome já diz, "single". Queria mudar este modo de seleção, gostaria que eu selecionasse manualmente quantos blocos que eu quisesse, não apenas 1 mas vários.
    Code:
     (defun c:blkreplacer (/ answr ent idx newname obj ss)
      (vl-load-com)
      ;;setup default on first run
      (if (not jmm-replaceall)
        (setq jmm-replaceall "Single")
        )
      (command ".undo" "be")
      ;;if the user selects something, inputs a ne block name AND it exists in the dwg...
      (if (and (setq ss (ssget ":S" '((0 . "INSERT"))))
        (progn
          (initget "Single Global")
          (if (setq answr (getkword "\nReplace just this block or Globally replace?[Single/Global]: "))
            (setq jmm-replaceall answr)
            (setq answr jmm-replaceall)
            )
          )
        (setq newname (getstring "\nBlock name to replace with: "))
        (tblobjname "BLOCK" newname)
        )
        (progn
          (if (eq jmm-replaceall "Global");;get ALL occurances if it's Global, else use the original ss
     (setq ss (ssget "x" (list '(0 . "INSERT") (assoc 2 (entget (ssname ss 0))))))
     )
          (setq idx -1)
          (while (setq ent (ssname ss (setq idx (1+ idx))))
     (setq obj (vlax-ename->vla-object ent))
     (vla-put-name obj newname);;change the name
     (vla-update obj)
     )
          )
        )
      (command ".undo" "end")
      (princ (strcat "\nReplaced " (itoa idx) " blocks......"))
      (princ)
      )


    Obrigado, pessoal!

  2. #2
    100 Club
    Join Date
    2012-08
    Posts
    111
    Login to Give a bone
    0

    Default Re: LISP- SUBSTITUIÇÃO DE BLOCOS (BLOCK REPLACER)

    ALguem pode me ajudar, por favor??

    Obrigado

Similar Threads

  1. Parameter block a lisp.
    By luislhss in forum AutoLISP
    Replies: 2
    Last Post: 2013-08-06, 12:29 PM
  2. Select & entget object information in XREF and block-in-block with Lisp
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2012-11-14, 09:11 AM
  3. lisp for checking block name
    By john.237249 in forum AutoLISP
    Replies: 0
    Last Post: 2011-09-22, 08:02 PM
  4. Need a block lisp
    By jgulino in forum AutoCAD Tips & Tricks
    Replies: 5
    Last Post: 2008-06-27, 05:10 PM
  5. Rotate Block LISP ?
    By spaynter in forum AutoLISP
    Replies: 5
    Last Post: 2005-05-19, 06:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •