Author Topic: Change select all to select simple  (Read 1485 times)

0 Members and 1 Guest are viewing this topic.

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Change select all to select simple
« on: April 28, 2017, 04:44:25 PM »
Hi, how are you:

I have the following lisp that changes the height of all the texts, that are within the block. The problem is that it makes a total selection, I would like to change to a simple selection using ssget, I hope they can help me thanks.


Code - Auto/Visual Lisp: [Select]
  1. (defun ChangeAllTextAltura (Doc Alt / IsLo tempObjType)
  2.  (setq IsLo (if (= (vla-get-IsLayout Blk) :vlax-true) T nil))
  3.  (if (= (vla-get-IsXref Blk) :vlax-false)
  4.   (vlax-for Obj Blk
  5.    (setq tempObjType (vla-get-ObjectName Obj))
  6.    (cond
  7.     ((vl-position tempObjType '("AcDbText" "AcDbMText" "AcDbAttributeDefinition"))
  8.      (vla-put-Height Obj Alt)
  9.      (if (not IsLo)
  10.       (vla-put-Layer Obj "0")
  11.      )
  12.     )
  13.     ((wcmatch tempObjType "AcDb*Dimension")
  14.      (vla-put-Height Obj Alt)
  15.     )
  16.     ((= tempObjType "AcDbBlockReference")
  17.      (foreach Att (vlax-invoke Obj 'GetAttributes)
  18.       (vla-put-Height Att Alt)
  19.      )
  20.      (foreach Att (vlax-invoke Obj 'GetConstantAttributes)
  21.       (vla-put-Height Att Alt)
  22.      )
  23.     )
  24.    )
  25.   )
  26.  )
  27. )
  28. )



Code - Auto/Visual Lisp: [Select]
  1. (defun c:TH ()
  2. ([font=Verdana][size=2px]ChangeAllTextAltura [/size][/font] (vla-get-ActiveDocument (vlax-get-Acad-Object)) 0.15)
  3. (command "regenall")
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

Chris

  • Swamp Rat
  • Posts: 548
Re: Change select all to select simple
« Reply #1 on: April 28, 2017, 09:11:45 PM »
I dont think it will be that simple.  to select attributes within a block, you'd either have to explode the block or find some way to pass the cooridinate of selection point into the program and somehow associate the point with the attribute within the block.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: Change select all to select simple
« Reply #2 on: April 29, 2017, 09:48:20 PM »
If I understand right you want to change say 1 attribute text, so just use bedit change the text, then attsync the blocks.
A man who never made a mistake never made anything

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Change select all to select simple
« Reply #3 on: April 30, 2017, 07:41:06 AM »
You'll have to modify the subfunction a bit:

Code - Auto/Visual Lisp: [Select]
  1. ; (ChangeAllTextAltura (vla-get-ActiveDocument (vlax-get-Acad-Object)) 0.15 '("MyBlock1" "MyBlock2" "MyBlock3"))
  2. (defun ChangeAllTextAltura (Doc Alt ForBlocks / IsLo tempObjType)
  3.   (vlax-for Blk (vla-get-Blocks Doc)
  4.     (cond
  5.       ( (eq (vla-get-IsXref Blk) :vlax-true) )
  6.       ( (not (member (vla-get-Name Blk) ForBlocks)) )
  7.       (T (setq IsLo (= (vla-get-IsLayout Blk) :vlax-true))
  8.         (vlax-for Obj Blk
  9.           (setq tempObjType (vla-get-ObjectName Obj))
  10.           (cond
  11.             ( (vl-position tempObjType '("AcDbText" "AcDbMText" "AcDbAttributeDefinition"))
  12.               (vla-put-Height Obj Alt)
  13.               (if (not IsLo)
  14.                 (vla-put-Layer Obj "0")
  15.               )
  16.             )
  17.             ( (wcmatch tempObjType "AcDb*Dimension")
  18.               (vla-put-Height Obj Alt)
  19.             )
  20.             ( (= tempObjType "AcDbBlockReference")
  21.               (foreach Att (append (vlax-invoke Obj 'GetAttributes) (vlax-invoke Obj 'GetConstantAttributes))
  22.                 (vla-put-Height Att Alt)
  23.               )
  24.             )
  25.           )
  26.         )
  27.       )
  28.     )
  29.   )
  30. )  
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg