CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.097.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator and the updated Barcode generator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedscale block

 Post Reply Post Reply
Author
lijinsong View Drop Down
Groupie
Groupie


Joined: 06.Dec.2014
Location: China
Using: 2014
Status: Offline
Points: 27
Direct Link To This Post Topic: scale block
    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)
)



Back to Top
John Connor View Drop Down
Senior Member
Senior Member


Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
Direct Link To This Post 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>>

Back to Top
lijinsong View Drop Down
Groupie
Groupie


Joined: 06.Dec.2014
Location: China
Using: 2014
Status: Offline
Points: 27
Direct Link To This Post Posted: 07.Dec.2014 at 15:34
He he, I know you are a master, is also a chinese too. Don't be so seriousLike watching a movie, You think it plays good, then it is good.  You think it plays bad,then it is bad. 

Back to Top
John Connor View Drop Down
Senior Member
Senior Member


Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
Direct Link To This Post 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.


Edited by John Connor - 08.Dec.2014 at 12:04
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>

Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,227 seconds.