Author Topic: block scale  (Read 2169 times)

0 Members and 1 Guest are viewing this topic.

Pad

  • Bull Frog
  • Posts: 305
block scale
« on: November 24, 2009, 05:26:22 AM »
Hello,

What I am looking for is a lisp which will report the scale of one particular block within a drawing.
The lisp routine below reports the scale of all blocks within a drawing, I'd like to know how to modify it so that it just reports the scale of single a block called 'PT'.
This block will be in the drawing multiple times but all would be at the same scale.

Thanks
Pads

Code: [Select]
;;-DISCLAIMER-

;;In no event shall Moss Designs be held liable to anyone for special, collateral, incidental, or consequential damages in connection with
;;or arising out of use of this product.  The sole and exclusive liability to Moss Designs shall not exceed the purchase price of the product.


;;Use of the software has been provided under a Software License Agreement.

;;Information described in this software is furnished for information purposes only, is subject to change without notice, and should not be
;;construed as a commitment by Moss Designs.  Moss Designs assumes no responsibility or liability for any errors or inaccuracies
;;that may appear in this software.

;;The software contains valuable trade secrets and proprietary information and is protected by United States copyright laws and copyright laws
;;of other countries.  Unauthorized use of the software or its documentation can result in civil damages and criminal prosecution.
;;Ver 1.0
;;November 12, 1999
;;Moss Designs
;;www.mossdesigns.com
;;(408) 231-9863
;;21951 Bear Creek Way
;;Los Gatos, CA 95033
;;Contact Elise Moss, Moss Designs
;;elise_moss@techie.com
;;if you have any questions or problems with this software
;;*****************************************************************************************************************************
;;this software lists the blocks in a drawing and their scales

(defun c:bsclist(/)
  (setq ssblocks (ssget "X" '((0 . "INSERT"))))
  (setq i 0); initialize counter
  (setq ssl (sslength ssblocks))
  (while (< i ssl)
   (progn
    (setq en (ssname ssblocks i))
    (setq el (entget en))
    (setq insert-name (cdr (assoc 2 el)))
    (setq xsc (cdr (assoc 41 el)))
    (setq ysc (cdr (assoc 42 el)))
    (setq line (strcat "BLOCKNAME: " insert-name "  X-SCALE: " (rtos xsc) "  Y-SCALE: " (rtos ysc)))
    (princ line)
    (princ "\n")
    (setq i (+ 1 i))
  ));end while
  (princ)
);end defun
(princ "\nType 'bsclist' to list blocks and their scales")

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: block scale
« Reply #1 on: November 24, 2009, 05:32:14 AM »

Quote
Unauthorized use of the software or its documentation can result in civil damages and criminal prosecution.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Pad

  • Bull Frog
  • Posts: 305
Re: block scale
« Reply #2 on: November 24, 2009, 05:56:40 AM »
Well its free to download from their website  http://www.mossdesigns.com/downloads.htm  BSCLIST.LSP
Surely if they make it freely available, then we are authorised to use it?!

If that's not the case, then forget that lisp.  Do you know how I could find the 'PT' block scale using lisp?
Thanks

« Last Edit: November 24, 2009, 06:04:25 AM by Pad »

DEVITG

  • Bull Frog
  • Posts: 426
Re: block scale
« Reply #3 on: November 24, 2009, 06:58:40 AM »

(setq origin-block (ssname (ssget ":S"  '( ( 0 . "insert")( 2 . "PT")))0))

(setq origin-block-x-scale (cdr (assoc 41 (entget origin-block))))
Location @ Córdoba Argentina<br /><br />using acad 2008 under win XP

Pad

  • Bull Frog
  • Posts: 305
Re: block scale
« Reply #4 on: November 24, 2009, 07:11:08 AM »
thank you Devitg  :-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: block scale
« Reply #5 on: November 24, 2009, 07:59:11 AM »
Well its free to download from their website  http://www.mossdesigns.com/downloads.htm  BSCLIST.LSP
Surely if they make it freely available, then we are authorised to use it?!
< .. >

OK, Thanks.

Seems a weird agreement/condition statement under those circumstances ..

I will make no comment regarding the quality of the code other than that it seems to be a little immature to require that sort header.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Lee Mac

  • Seagull
  • Posts: 12267
  • London, England
Re: block scale
« Reply #6 on: November 24, 2009, 08:02:18 AM »
Well its free to download from their website  http://www.mossdesigns.com/downloads.htm  BSCLIST.LSP
Surely if they make it freely available, then we are authorised to use it?!
< .. >

OK, Thanks.

Seems a weird agreement/condition statement under those circumstances ..

I will make no comment regarding the quality of the code other than that it seems to be a little immature to require that sort header.

I second that .

Pad

  • Bull Frog
  • Posts: 305
Re: block scale
« Reply #7 on: November 24, 2009, 08:07:15 AM »
fair enough.
Cheers

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: block scale
« Reply #8 on: November 24, 2009, 08:26:05 AM »
Well its free to download from their website  http://www.mossdesigns.com/downloads.htm  BSCLIST.LSP
Surely if they make it freely available, then we are authorised to use it?!
< .. >

OK, Thanks.

Seems a weird agreement/condition statement under those circumstances ..

I will make no comment regarding the quality of the code other than that it seems to be a little immature to require that sort header.

I second that .

It's like holding your pinkie up when you drink. It doesn't do anything, it just makes you feel fancy.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: block scale
« Reply #9 on: November 24, 2009, 08:59:43 AM »
I am sure that if you had asked Elise Moss would have modified that lisp code for you, and probably included it in her next Newsletter.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16721
  • Superior Stupidity at its best
Re: block scale
« Reply #10 on: November 24, 2009, 09:00:12 AM »
This will tell you the X, Y and Z scale

Code: [Select]
(defun C:GScale()
  (mapcar '(lambda (X) (cdr(assoc X(entget (ssname (ssget "x" '((0 . "INSERT")(2 . "PT")))0)))))
          '(41 42 43)
  )
)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Pad

  • Bull Frog
  • Posts: 305
Re: block scale
« Reply #11 on: November 24, 2009, 10:16:24 AM »
I have emailed her, its was bounced back as undeliverable.
Jobs done now, thanks for every bodies input.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: block scale
« Reply #12 on: November 24, 2009, 12:08:33 PM »
I have emailed her, its was bounced back as undeliverable.
Jobs done now, thanks for every bodies input.


try another mail here: Elise Moss <elise_moss@mossdesigns.com>
and let me know if it also bounces back, so I can let her know she has an email issue she might not be aware of.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Pad

  • Bull Frog
  • Posts: 305
Re: block scale
« Reply #13 on: November 24, 2009, 01:07:15 PM »
Its all resolved so I don't plan on pursuing it any further.
This is the email I used (which was contained within the lisp) elise_moss@techie.com, the lisp is quite old so maybe this email is now redundant.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10365
Re: block scale
« Reply #14 on: November 24, 2009, 01:32:33 PM »
If not all the same scale.
Code: [Select]
(defun C:GScale(/ sc)
  (mapcar
    (function
      (lambda (x / elst)
         (setq elst (entget x)
               sc (cons (list (cdr (assoc 41 elst))
                              (cdr (assoc 42 elst))
                              (cdr (assoc 43 elst))) sc))
      ))
    (mapcar 'cadr (ssnamex (ssget "x" '((0 . "INSERT")(2 . "PT")))))
  )
  (while (setq itm (car sc))
    (setq sc (cdr sc))
    (if (not (vl-position itm sc))
      (princ (strcat "\nX-scale: " (vl-princ-to-string (car itm))
                     "  Y-scale: " (vl-princ-to-string (cadr itm))
                     "  Z-scale: " (vl-princ-to-string (caddr itm))))
    )
  )
  (princ)
)

Edited code as it had my block name. :)
« Last Edit: November 24, 2009, 01:55:53 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.