TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Pad 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
;;-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")
-
Unauthorized use of the software or its documentation can result in civil damages and criminal prosecution.
-
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
-
(setq origin-block (ssname (ssget ":S" '( ( 0 . "insert")( 2 . "PT")))0))
(setq origin-block-x-scale (cdr (assoc 41 (entget origin-block))))
-
thank you Devitg :-)
-
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.
-
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 .
-
fair enough.
Cheers
-
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.
-
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.
-
This will tell you the X, Y and Z scale
(defun C:GScale()
(mapcar '(lambda (X) (cdr(assoc X(entget (ssname (ssget "x" '((0 . "INSERT")(2 . "PT")))0)))))
'(41 42 43)
)
)
-
I have emailed her, its was bounced back as undeliverable.
Jobs done now, thanks for every bodies input.
-
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.
-
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.
-
If not all the same scale.
(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. :)