Author Topic: Is it possible  (Read 1443 times)

0 Members and 1 Guest are viewing this topic.

MvdP

  • Guest
Is it possible
« on: September 23, 2005, 01:45:26 PM »
to change the units(inch to millimeters) of all blocks in a drawing without modifying the block (ex. with refedit.)


MvdP

Bob Wahr

  • Guest
Re: Is it possible
« Reply #1 on: September 23, 2005, 02:55:48 PM »
possible? sure.  Seems like it would be easier just to scale them up by 25.4 though.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Is it possible
« Reply #2 on: September 24, 2005, 12:24:21 AM »
there it is...

Code: [Select]
;| ;
BLOCKSCALE ;
By: AndreaLISP ;
2005-08-4 ;
;
|;
(defun c:scaleblock ()
 (prompt "\nPlease select entity to modify : ") (setq ch_a (ssget))
 (setq ch_b (getreal "\nEntere the scale factor : "))
 (setq ch_c (sslength ch_a))
 
 (setq index 0)
  (repeat ch_c
   (setq ch_d (ssname ch_a index))
   (setq ch_a1 (entget (ssname ch_a index)))
   (setq ch_a2 (cdr (assoc 0 ch_a1)));;nom du block
    (if (= ch_a2 "INSERT")
      (progn
      (setq ch_e (assoc 10 ch_a1))
      (setq ch_f (cdr ch_e))
      (setq index (1+ index))
      (vl-cmdf "_.scale" ch_d "" ch_f ch_b )
      );;progn
      (setq index (1+ index))
    );;if
     
  );;repeat
)


or


Code: [Select]
;| ;
C H S C A L E ;
By: AndreaLISP ;
2005-08-4 ;
;
|;

(Defun c:chscale (/ ch_a ch_b ch_c index ch_d ch_a1 ch_e ch_f ch_z)
 (prompt "\nPlease select entity to modify : ") (setq ch_a (ssget))
 (setq ch_b (getreal "\nEntere the scale factor : "))
 (setq ch_z (getpoint "\nSpecify the base point : "))
 (setq ch_c (sslength ch_a))
(vl-cmdf "_.scale" ch_a "" ch_z  ch_b)

 
 (setq index 0)
  (repeat ch_c
   (setq ch_d (ssname ch_a index))
   (setq ch_a1 (entget (ssname ch_a index)))
   (setq ch_a2 (cdr (assoc 0 ch_a1)));;nom du block
    (if (= ch_a2 "INSERT")
      (progn
      (setq ch_e (assoc 10 ch_a1))
      (setq ch_f (cdr ch_e))
      (setq index (1+ index))
      (vl-cmdf "_.scale" ch_d "" ch_f (/ 1 ch_b ))
      );;progn
      (setq index (1+ index))
    );;if
     
  );;repeat
)
Keep smile...

MvdP

  • Guest
Re: Is it possible
« Reply #3 on: September 24, 2005, 03:14:54 AM »
Andrea thanks for the routine,but maybe i was not totally clear with my guestion.
Some of of the drawings (2002)that i receive have mixed up units for the inserted blocks (some are unitless some are in inches and in some in mm).And it is much easier if all the the blocks have the same insert scale instead of  different scales.I know a workaround (wblock the block set units to mm and insert again) but can it be quicker.?

MvdP
« Last Edit: September 24, 2005, 03:37:58 AM by MvdP »

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Is it possible
« Reply #4 on: September 24, 2005, 11:00:07 PM »
oh....I see.... :?

Let me think... :|

ok !! I found it !! :ugly:


Code: [Select]
;| ;
GLOBALBLOCKSCALE ;
By: AndreaLISP ;
2005-09-24 ;
;
|;
(defun c:globalblockscale ()
(prompt "\nPlease select entity to modify : ") (setq ch_a (ssget))
(setq ch_b (getreal "\nEntere the scale factor : "))
(setq ch_c (sslength ch_a))

(setq index 0)
  (repeat ch_c
   (setq ch_d (ssname ch_a index))
   (setq ch_a1 (entget (ssname ch_a index)))
   (setq ch_a2 (cdr (assoc 0 ch_a1)))
    (if (= ch_a2 "INSERT")
      (progn
      (setq ch_e (assoc 41 ch_a1)) 
      (setq index (1+ index))
 
  (setq BL1 (cons (car ch_e) ch_b))
  (setq ch_a1 (subst BL1 ch_e ch_a1))
  (entmod ch_a1)
     
  (setq ch_e (assoc 42 ch_a1))
  (setq BL1 (cons (car ch_e) ch_b))
  (setq ch_a1 (subst BL1 ch_e ch_a1))
  (entmod ch_a1)   
 
      );;progn
      (setq index (1+ index))
    );;if
     
  );;repeat
)
Keep smile...