Lee Mac Posted November 19, 2010 Posted November 19, 2010 maybe there is an easier way to do what I'm trying to do, I have just been out of the game for awhile now and don't know any other way Well tbh, I'm haven't really got the experience behind me to advise you the best way to produce your drawings - I'm just a coder. But, if you think LTSCALE would work better, change the DIMSCALE to LTSCALE Quote
mggeray Posted November 21, 2010 Posted November 21, 2010 Lee, Mac Regarding On L8.lsp would it be possible that it would change only the layers on xref drawing/s? and instead of 8 the colors from 1-250 to 9 and 251-above to 252. I've been following almost all your posts and have been using ur great works. Thanks Quote
Lee Mac Posted November 21, 2010 Posted November 21, 2010 Hi Mggeray, Firstly, welcome to CADTutor & thanks for your kind words, I'm glad you like my programs To get you going, partway to your solution, in the layer list of the L8 list, try using just "~*|*" This should make it only operate on XRef layers. The other part of your problem will need a bit more modification... Quote
Lee Mac Posted November 21, 2010 Posted November 21, 2010 Try this: (defun c:L8 ( / ColourFilters layers def bdef n c ss ) (vl-load-com) ;; © Lee Mac 2010 [color=blue] (setq ColourFilters '( ;; Lower Upper Colour ( 1 250 9) (251 255 252) ) )[/color] (setq layers (mapcar 'strcase '( [color=blue] ;; List your Layers Here (may use Wildcards): "~*|*" ;;------------------------------------------;;[/color] ) ) ) (while (setq def (tblnext "LAYER" (null def))) (setq n (strcase (cdr (assoc 2 def))) c (cdr (assoc 62 def))) (if (not (vl-some (function (lambda ( s ) (wcmatch n s)) ) layers ) ) ( (lambda ( tbl / NewCol ) (if (setq NewCol (vl-some (function (lambda ( f ) (if (<= (car f) (abs c) (cadr f)) (caddr f) ) ) ) ColourFilters ) ) (entmod (subst (cons 62 (* NewCol (/ (abs c) c))) (assoc 62 tbl) tbl ) ) ) ) (entget (tblobjname "LAYER" n)) ) ) ) (while (setq bdef (tblnext "BLOCK" (null bdef))) ( (lambda ( tbl / l ) (while (setq tbl (entnext tbl)) (if (assoc 62 (setq l (entget tbl))) (if (setq l (entmod (subst (cons 62 256) (assoc 62 l) l ) ) ) (entupd tbl) ) ) ) ) (tblobjname "BLOCK" (cdr (assoc 2 bdef))) ) ) (if (setq ss (ssget "_X" (list (cons -4 "<NOT") (cons 8 (LM:lst->str layers ",")) (cons -4 "NOT>") ) ) ) ( (lambda ( i / e l ) (while (setq e (ssname ss (setq i (1+ i)))) (if (assoc 62 (setq l (entget e))) (if (setq l (entmod (subst (cons 62 256) (assoc 62 l) l ) ) ) (entupd e) ) ) ) ) -1 ) ) (princ) ) ;;-------------------=={ List to String }==-------------------;; ;; ;; ;; Constructs a string from a list of strings separating ;; ;; each element by a specified delimiter ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; lst - a list of strings to process ;; ;; del - delimiter by which to separate each list element ;; ;;------------------------------------------------------------;; ;; Returns: String containing each string in the list ;; ;;------------------------------------------------------------;; (defun LM:lst->str ( lst del ) ;; © Lee Mac 2010 (if (cdr lst) (strcat (car lst) del (LM:lst->str (cdr lst) del)) (car lst) ) ) Quote
mggeray Posted November 21, 2010 Posted November 21, 2010 Lee, Thanks for welcoming me here in cadtutor. Im a new cad user and Im lucky that I found this forum. It has been been a great help for my first job. I dont know how i can repay for your awesome works. There is a lot of thing I would like to ask... I hope that I wouldnt abuse your generousity. The modified L8code is awesome, as always... Thanks a lot. Quote
Lee Mac Posted November 21, 2010 Posted November 21, 2010 You're very welcome, happy I could help out Quote
tasty geezer Posted December 1, 2010 Author Posted December 1, 2010 Lee Mac, First I want to thank you for your generosity in helping me so far...You got me off to a running start. Although, I have been banging my head trying to get the mpl2.lsp to function as I need it to. The block that it brings in (ALD_block.dwg) is at 1:1. That is that the text height is 1'-0" and the symbols are drawn to scale (a lighting fixture symbol for a 6" downlight is drawn at 6" and the text height for that symbol is at 1'-0". Through trial and error and trying to wrap my head around AutoCAD 2010, I have come to the conclusion that I need the "ALD_block.dwg" to scale based on the Annotation scale. For Example: In model space, I set my annotation scale to 1/4" because I plan on showing the information in Paper Space with a 1/4" viewport. I run the mpl2.lsp and need the "ALD_block.dwg" to come in at that scale. In paper space with a 1/4"=1'-0" viewport I want the text height to be 1/8". If I change the Annotation Scale to 1/2", for a detail for example, and run the mpl2.lsp again in the same drawing the "ALD_block.dwg" needs to come in at the new scale (the 1/2" block would be half the size as the previous inserted block at 1/4") and the text height in the 1/2"=1'-0" viewport in paper space would be 1/8" as well... Does this make sense? Is it possible to do what I am trying to do? Much Thanks, Tasty Geezer Quote
irneb Posted December 2, 2010 Posted December 2, 2010 Does the entire block need to scale up-and-down according to the CAnnoScale? Or is it just the text inside the block? I.e. does the 6" downlight symbol stay 6" diameter no matter what the scale is? Or does it scale the symbol as well so it always plots out the same size on the paper - i.e. at larger scales the symbol becomes larger compared to the other linework? If the symbol stays at 6", but the text adjusts to suit the scale ... you need not edit the lisp - only the block definition. - Open the block using BEdit. - Select the text and open Properties Palette (Ctrl+1). - Change its Annotative property to Yes. Right-click on the text and choose: Annotative Scale --> Add/Delete Scales. - Click Add and add all the scales you want the text to show up at. OK and OK. - For each of those scales set your CAnnoScale (the list on the status bar) check that the text displays correctly. If not stretch or grip-edit it so you modify its position for that scale only. - BClose and yes to save. The block should now work as previous, but the text inside will display according to the CAnnoScale (per viewport). Quote
tasty geezer Posted December 2, 2010 Author Posted December 2, 2010 The entire block needs to scale up and down based on the annotation scale (is that the same as cannoscale?) This way the symbol always plots out the same size. Thanks! Quote
tasty geezer Posted December 2, 2010 Author Posted December 2, 2010 here's the block that I need to scale accordignly to the annotation scale when I run the mpl2.lsp. The text height needs to show up in paper space at 1/8" Thanks for your help! ALD_block.dwg Quote
irneb Posted December 3, 2010 Posted December 3, 2010 OK, so you want it as per attached? Well, to get it working you need to modify each and every block definition, performing the following tasks for each. Ensure your current CAnnoScale is set to one of those you want the blocks to show up with (e.g. 1/8" = 1'0") Open block definition in BEdit Set block's annotative property to Yes Set block's Units to Inches (not Unitless, this causes problems in some cases) Select all attributes Set their Lock Position to Yes BClose and save Run AttSync to syncronize the existing block references' attributes to the new definitions. Run objectscale on all the block references to add other scales to those blocks (e.g. 1/4" = 1'-0") Most of the above steps can easily be accomplished through some simple lisping. The difficult bits are to set the block annotative and set its units. E.g.: Command: (setq blk (tblobjname "block" "pA1")) <Entity name: -40116758> Command: (setq bd (entget blk '("*"))) ((-1 . <Entity name: -40116758>) (0 . "BLOCK") (330 . <Entity name: -40116770>) (5 . "64105") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockBegin") (70 . 2) (10 0.0 0.0 0.0) (-2 . <Entity name: -40110cd8>) (2 . "pA1") (1 . "")) Command: (entget (cdr (assoc 330 bd)) '("*")) ((-1 . <Entity name: -40116770>) (0 . "BLOCK_RECORD") (5 . "64102") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: -40110798>) (102 . "}") (330 . <Entity name: -4011a3f8>) (100 . "AcDbSymbolTableRecord") (100 . "AcDbBlockTableRecord") (2 . "pA1") (360 . <Entity name: -40116758>) (340 . <Entity name: 0>) (102 . "{BLKREFS") (331 . <Entity name: -40111598>) (331 . <Entity name: -40110d20>) (102 . "}") [color=seagreen](70 . 1)[/color] (280 . 1) (281 . 1) (-3 [color=red]("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}"))[/color] ("AcDbDynamicBlockGUID" (1000 . "{58EA1C68-A841-4E86-822B-E80DCF392F06}")) ("AcDbBlockRepETag" (1070 . 1) (1071 . ))) Edit sorry: forgot to attach. ALD_block.dwg Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.