Jump to content

Recommended Posts

Posted

First time poster so I apologize in advance if I make a mistake here. If I need to add more info please let me know as well. I'm trying to learn AutoLISP and I'm stuck on this Lisp Routine that I'm trying to write:

 

 

;* C:BSCALE changes the X, Y, and/or Z values of existing blocks without

;* affecting properties or attributes. It uses the DXF and UREAL functions,

;* which must be loaded.

(defun C:BSCALE ( / en ed old41 old42 old43 new41 new42 new43)

(if (and (setq en (entsel "\nSelect block to rescale: ")) ;get the block

(= (dxf 0 (setq ed (entget (car en)))) "INSERT") ;test if an insert

);and

(entmod ;update entity

(setq old41 (dxf 41 ed) ;extract old X

old42 (dxf 42 ed) ;old Y

old43 (dxf 43 ed) ;old Z

new41 (ureal 1 "" "X scale factor " old41) ;prompt for new X

new42 (ureal 1 "" "Y scale factor " old42) ;new Y

new43 (ureal 1 "" "Z scale factor " old43) ;new Z

;change data in entity list

ed (subst (cons 41 new41) (cons 41 old41) ed) ;change X

ed (subst (cons 42 new42) (cons 42 old42) ed) ;change Y

ed (subst (cons 43 new43) (cons 43 old43) ed) ;change Z

) ;setq returns ed

);entmod

);if

(princ) ;end cleanly

);defun

(princ)

;*

 

 

When I run the lisp routine I get the error message: no function definition: SETQMSG. The lisp routines DXF and UREAL work fine on their own, but I can post them up as well if it would help. If you guys could tell me why I'm getting this error message and how I can fix it, I would appreciate it.

Posted

Just having 1 setq for lots of lines is probably where the problem is move your questions new41 to before the entmod maybe.

 

Just me use VL pick object etc then (vla-put-XScalefactor obj new41)

 

Post ureal defun as well.

Posted

Thanks for responding. Sorry I am so late in replying. Was a busy day at work. I was in the process of putting the UREAL defun on here when I saw the error within it. I'm a newb. Anyway, problem solved. Thanks for your help. :)

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