cedwards Posted July 8, 2010 Posted July 8, 2010 Hello everyone, I have a lisp request that would really help me! I need to convert the celtscale for all(for sure lines & plines) objects to celtscale/ltscale. any help would be greatly appreciated. Quote
Lee Mac Posted July 8, 2010 Posted July 8, 2010 Not sure that I completely understand it, but perhaps: (defun c:ce/lt ( / ss ) ;; © Lee Mac 2010 (if (setq ss (ssget "_X" '((-4 . "<") (48 . 0.0)))) ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (LM:Update (LM:SubstDXF 48 (/ (getvar 'CELTSCALE) (cdr (assoc 48 (entget e)))) (entget e) ) ) ) ) -1 ) ) (princ) ) (defun LM:SubstDXF ( code value elist ) (entmod (subst (cons code value) (assoc code elist) elist ) ) ) (defun LM:Update ( elist ) (entupd (cdr (assoc -1 elist)) ) ) Quote
cedwards Posted July 8, 2010 Author Posted July 8, 2010 Sorry if I didn't explain myself very well. I wanting to select all the objects in a drawing(if not all then for sure lines and plines) and change the celtscale for each object to the current celtscale divided by the current ltscale. For example: I selected a line: it's celtscale is 4 drawing ltscale is 16 I would the to change the lines celtscale to .25 (4/16) and leave the lt scale the same. Quote
Lee Mac Posted July 8, 2010 Posted July 8, 2010 Objects don't have a celtscale, rather a linetype scale that is calculated by the current ltscale and celtscale sys vars. Quote
cedwards Posted July 8, 2010 Author Posted July 8, 2010 CELTSCALE – Current Element LineType Scale – Sets the current object linetype scaling factor. You can force an individual elements LTSCALE with this setting. The Global Scale Factor value controls the LTSCALE system variable, which changes the linetype scale globally for both new and existing objects. The Current Object Scale value controls the CELTSCALE system variable, which sets the linetype scale for new objects. The CELTSCALE value is multiplied by the LTSCALE value to get the displayed linetype scale. You can easily change linetype scales in your drawing either individually or globally. The objects Linetype scale is what I'm needing to change see attach picture. Quote
Lee Mac Posted July 8, 2010 Posted July 8, 2010 I would guess you mean this? (defun c:ce/lt ( / ss ) ;; © Lee Mac 2010 (if (setq ss (ssget "_X")) ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (LM:Update (LM:SubstDXF 48 (/ (cdr (assoc 48 (entget e))) (getvar 'ltscale)) (entget e) ) ) ) ) -1 ) ) (princ) ) (defun LM:SubstDXF ( code value elist ) (entmod (subst (cons code value) (assoc code elist) elist ) ) ) (defun LM:Update ( elist ) (entupd (cdr (assoc -1 elist)) ) ) Quote
cedwards Posted July 9, 2010 Author Posted July 9, 2010 I guess what I'm asking is how do I get(read the value) of the Linetype Scale(the one listed in the properties palette) for a object? Quote
cedwards Posted July 9, 2010 Author Posted July 9, 2010 Maybe the link below will help. I'm wanting to do the same thing except for the new linetype scale would be a function of the current one. New Linetype Scale = (Current Linetype scale)(/LTSCALE) http://forums.autodesk.com/t5/AutoCAD-2006/globally-reset-Linetype-Scale-for-all-entities-in-a-drawing/m-p/1410799 Quote
Lee Mac Posted July 9, 2010 Posted July 9, 2010 My last code post will set the Object's linetype scale to its old linetype scale divided by the ltscale sys var for the drawing. This change is only applied to objects with an linetype scale not equal to 1. Quote
cedwards Posted July 9, 2010 Author Posted July 9, 2010 ok thanks, but the code doesn't seem to do anything. I set the ltscale I want then run the lisp and it doesn't change the Linetype Scale. The code runs with no error's but it doesn't seem to change the value. Quote
Lee Mac Posted July 9, 2010 Posted July 9, 2010 Could be that the objects aren't getting picked up - try the updated code above. Quote
cedwards Posted July 9, 2010 Author Posted July 9, 2010 The revised code semi works. It changes a few objects/lines and then errors out. Command: CE/LT ; error: bad argument type: numberp: nil Any suggestions? Quote
Lee Mac Posted July 9, 2010 Posted July 9, 2010 Yeah, I thought that might happen - hence the use of the filter in the original code... Ok, one more try Quote
Lee Mac Posted July 9, 2010 Posted July 9, 2010 (defun c:ce/lt ( / ss ) ;; © Lee Mac 2010 (if (setq ss (ssget "_X")) ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (LM:Update (LM:SubstDXF 48 (/ (cond ( (cdr (assoc 48 (entget e))) ) ( 1.0 )) (getvar 'ltscale) ) (entget e) ) ) ) ) -1 ) ) (princ) ) (defun LM:SubstDXF ( code value elist ) (entmod (subst (cons code value) (assoc code elist) elist ) ) ) (defun LM:Update ( elist ) (entupd (cdr (assoc -1 elist)) ) ) Quote
cedwards Posted July 9, 2010 Author Posted July 9, 2010 That did the trick....Thank you very very much!!!! Quote
dannypd Posted October 26, 2011 Posted October 26, 2011 it give an error "; error: bad argument type: numberp:" Is it possible to correct? Quote
SLW210 Posted October 26, 2011 Posted October 26, 2011 Are you using the latest code from post #14? Quote
dannypd Posted October 27, 2011 Posted October 27, 2011 yes. I have tried the latest code in AutoCAD2008 & 2010 but doesn't work. BTW, will it change the element ltscale inside the block? thanks Quote
dannypd Posted October 27, 2011 Posted October 27, 2011 Is it possible to change all the elements ltscale and LTS to 1 without selecting entities. I'm using acadiso linetypes. Any help would be appreciated. Danny 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.