Print Page | Close Window

scale block

Printed From: CAD Forum
Category: EN
Forum Name: CAD - general
Forum Description: General discussion about CAD, formats, standards, management, licensing, networking, harware, other CAD applications
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=10838
Printed Date: 28.Sep.2026 at 12:10


Topic: scale block
Posted By: lijinsong
Subject: scale block
Date Posted: 07.Dec.2014 at 10:52
; 1  specify base point scaling.
(defun c:tt()
 (princ "\n Choose the arrow block")
 (setq en(entsel))
 (if en(progn
 (setq enn(car en) 
          enpt(getpoint" input scaling point") 
          sfx(getreal" input scaling coefficient: ") )
 (vla-getboundingbox (vlax-ename->vla-object enn) 'enpt1 'enpt2) 
 (setq enpt1 (vlax-safearray->list enpt1) 
       enpt2 (vlax-safearray->list enpt2)
       enmp  (mapcar '(lambda(x y)(/(+ x y)2))enpt1 enpt2)
       endi  (distance enpt enmp)
       enan  (angle enpt enmp)
       szj   (ssget)
       l     (sslength szj) 
       n     0
 )
 (repeat l
  (setq szjenn(ssname szj n))
  (vla-getboundingbox (vlax-ename->vla-object szjenn) 'szjpt1 'szjpt2) 
  (setq szjpt1 (vlax-safearray->list szjpt1) 
        szjpt2 (vlax-safearray->list szjpt2)
        szjmp  (mapcar '(lambda(x y)(/(+ x y)2))szjpt1 szjpt2)
        szjpt  (polar szjmp enan endi)
        n      (1+ n )  
  )
  (vl-cmdf "scale" szjenn "" "non"szjpt sfx )
 ) ))

;2scale same name of Block .

(defun c:tt()
  (SETQ b1 (ENTSEL "\nPlease select the block: ")
 i  0 
        hh (getreal"Enter the new scaling coefficient:  ")
  ) 
  (IF b1    
    (PROGN   
      (SETQ b2 (CAR b1)   
            b3 (ENTGET b2)  
            b4 (ASSOC 0 b3)  
            b5 (CDR b4)  
      )
     (IF (= b5 "INSERT")  
      (PROGN    
       (SETQ b6 (ASSOC 2 b3)  
             b7 (CDR b6)  
             b8 (SSGET (LIST b4 b6)) 
             b9 (SSLENGTH b8) 
             
       )
       (alert (strcat b7 "  *  " (itoa b9)))
      )    
      (PRINC "\nObject is not a block!") 
      )     
    )     
    (PRINC "\nNo selection block!")  
  )    
  (repeat  b9
     (setq bb(ssname b8 i) instp(cdr(assoc 10 (entget bb))))
     (command "scale" bb "" "non"instp hh )
     (setq i(1+ i))
   )
  (PRINC)
)

3 “Polygon single line text center”  -i do not know why some dwg use it will failure.
(defun C:tt()
   
    (setq ss  (ssget ":E:S" )   
          en  (ssname ss 0 )  
          vo  (vlax-ename->vla-object en)
    )
    (vlax-invoke-method vo 'GetBoundingBox  'MinPoint 'MaxPoint  ) 
    (setq p1  (vlax-safearray->list  MinPoint)
          P2  (vlax-safearray->list  MaxPoint )
          mp  (mapcar'(lambda(x y)(/(+ x y)2))p1 p2)
    )
    (command "-boundary" "non"p1 "" )
    (setq PL (entlast)     
          vo(vlax-ename->vla-object PL)
    )
    (vlax-invoke-method vo 'GetBoundingBox 'MinPoint 'MaxPoint  )
    (setq  p1(vlax-safearray->list  MinPoint)
           P2(vlax-safearray->list  MaxPoint)
           mpL (mapcar'(lambda(x y)(/(+ x y)2))p1 p2)
    )
    (command "_move" ss"" "non"mp "non"mpL)
)






Replies:
Posted By: John Connor
Date Posted: 07.Dec.2014 at 13:20
So what's all this garbage?

I would not run any of your code until a full explanation of each routine is added to every post you've made. 


-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: lijinsong
Date Posted: 07.Dec.2014 at 15:34
He he, I know you are a master, is also a chinese too. Don't be so serious, Like watching a movie, You think it plays good, then it is good.  You think it plays bad,then it is bad. 



Posted By: John Connor
Date Posted: 07.Dec.2014 at 18:49
Why do I need a lisp routine to scale a block?  Invoke the SCALE command and select the block.  What is the advantage of your lisp routine?

It would be helpful if you explained what your lisp routine is supposed to do and give a real world example of the routine in use.  A video demonstration of the routine in action would be best.


-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>




Print Page | Close Window