Jump to content

Recommended Posts

Posted

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.

Posted

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))
 )
)

Posted

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.

Posted

Objects don't have a celtscale, rather a linetype scale that is calculated by the current ltscale and celtscale sys vars.

Posted
CELTSCALECurrent 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.

SnapShot.jpg

Posted

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))
 )
)

Posted

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?

Posted

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.

Posted

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.

Posted

Could be that the objects aren't getting picked up - try the updated code above.

Posted

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?

Posted

Yeah, I thought that might happen - hence the use of the filter in the original code...

 

Ok, one more try

Posted
(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))
 )
)

Posted

That did the trick....Thank you very very much!!!!

  • 1 year later...
Posted

it give an error "; error: bad argument type: numberp:"

Is it possible to correct?

Posted

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

Posted

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...