Jump to content

Scaling w/o pushing a command line


Recommended Posts

Posted

How would I scale a block w/o using (command "scale" etc)? thanks in advance

Posted

I'm currently trying to select multiple blocks and trying to scale each of them by the current DIMSCALE. To keep them in their place I want each one to be scaled with their insertion point as the base point. I saw a LISP by Lee Mac and tried to modify it to do my task. This is what I have but I'm getting an error.

 

(defun c:wscale (/ i ss ent eLst)
 (setq wgScale (getvar "DIMSCALE"))
 
 (if (setq i -1              ;if this = T
           ss (ssget "_:L"))  
     (while            ;Then do this
       (setq ent                
          (ssname ss
              (setq i (1+ i))))
     
     (setq eLst (entget ent))        
     
     (setq ePT (assoc 10 eLst))
     (vl-cmdf "_.scale" ent "" ePT wgScale)
   )

 );end if

 (princ))

 

I get this error

Command: WSCALE

Select objects: Specify opposite corner: 1 found

 

Select objects: Application ERROR: Invalid type sent as command input

Posted

it appears as thought all I was missing was a "cdr"

 

(defun c:wscale (/ i ss ent eLst)
 (setq wgScale (getvar "DIMSCALE"))
 
 (if (setq i -1              ;if this = T
           ss (ssget "_:L"))  
     (while            ;Then do this
       (setq ent                
          (ssname ss
              (setq i (1+ i))))
     
     (setq eLst (entget ent))        
     
     (setq ePT [color=Red](cdr[/color] (assoc 10 eLst))[color=Red])[/color]
     (vl-cmdf "_.scale" ent "" ePT wgScale)
   )

 );end if

 (princ))

 

I thought (assoc ...) would return x,y,z but it returned (10 x,y,z) which made the command line fail.

 

I'm going to add a 2nd part to this question. I would like to type the command and have the LISP select all the blocks in the drawing who's block name contains the word "PART".

 

I'm searching around for an answer in the mean time. I figure I have to filter for (0 . "INSERT") and (2 . "*part") don't think I can use an asterik there but you can see my logic.

Posted

I know this is a conversation between me, myself and I but I figure some may be reading this :lol:

 

anyways I noticed there are x,y and z scale factors in the DXF codes of the block. I think I'll try to change those values instead of using a command line.

Posted

I'm not sure exactly what you want to do, but can you use a quick select to get all of a block type selected, then modify the properties x,y,z scales?

 

Glen

Posted

Example:

 

(defun c:wscale  (/ i ss ent eLst scl)
 
 (and (zerop (setq scl (getvar "DIMSCALE")))
      (setq scl 1.0))

 (if (setq i  -1 ss (ssget "_:L" '((0 . "INSERT"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (setq eLst (entget ent))

     (mapcar
       (function
         (lambda (x)
           (setq eLst (subst (cons x scl)
                             (assoc x eLst) eLst)))) '(41 42 43))

     (entmod eLst)))

 (princ))

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