guitarguy1685 Posted February 19, 2010 Posted February 19, 2010 How would I scale a block w/o using (command "scale" etc)? thanks in advance Quote
guitarguy1685 Posted February 19, 2010 Author Posted February 19, 2010 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: WSCALESelect objects: Specify opposite corner: 1 found Select objects: Application ERROR: Invalid type sent as command input Quote
guitarguy1685 Posted February 19, 2010 Author Posted February 19, 2010 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. Quote
guitarguy1685 Posted February 19, 2010 Author Posted February 19, 2010 I know this is a conversation between me, myself and I but I figure some may be reading this 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. Quote
Glen Smith Posted February 19, 2010 Posted February 19, 2010 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 Quote
Lee Mac Posted February 19, 2010 Posted February 19, 2010 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)) 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.