Jump to content

Changing OBJECT (LINES) LTSCALE


loudy000

Recommended Posts

Hi all, ive been trying to create simple lisp that do the following

 

1. Select objects (lines, polylines, circle, arc etc.)

2. prompt the user to put desired linetype scale

 

but unfortunately my code is not working the way i wanted, any help is highly appreciated. Thank you.

 

(defun c:TEST (/ SSET )
(setq sset (ssget))
(command "_.CHANGE" SSET "_P" "LTSCALE" ))
 

Link to comment
Share on other sites

(defun C:test ( / n SS i e enx )
(and
	vlax-get-acad-object
	(not (initget (+ 2 4)))
	(or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1))
	(setq SS (ssget "_:L"))
	(repeat (setq i (sslength SS))
		(setq e (ssname SS (setq i (1- i))))
		(vla-put-LinetypeScale (vlax-ename->vla-object e) n)
	); repeat
); and
(princ)
) (vl-load-com) (princ)

Link to comment
Share on other sites

(defun C:test ( / n SS i e enx )
(and
	vlax-get-acad-object
	(not (initget (+ 2 4)))
	(or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1))
	(setq SS (ssget "_:L"))
	(repeat (setq i (sslength SS))
		(setq e (ssname SS (setq i (1- i))))
		(vla-put-LinetypeScale (vlax-ename->vla-object e) n)
	); repeat
); and
(princ)
) (vl-load-com) (princ)

thank you very much Grrr. Cheers!

Link to comment
Share on other sites

thank you very much Grrr. Cheers!

 

I also tried with Vanilla:

(defun C:test ( / n SS i e enx )
(and
	(not (initget (+ 2 4)))
	(or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1))
	(setq SS (ssget "_:L"))
	(repeat (setq i (sslength SS))
		(setq e (ssname SS (setq i (1- i))))
		(setq enx (entget e))
		(cond
			( (assoc 48 enx)
				(setq enx (subst (cons 48 n) (assoc 48 enx) enx))
			)
			( (not (assoc 48 enx))
				(setq enx (append (list (cons 48 n)) enx))
			)	
		); cond			
		(entmod enx) (entupd (cdr (assoc -1 enx)))
	); repeat
); and
(princ)
)

Seems to work now, it failed the first time so I gave up and used VLISP ( forgot to remove the enx variable from the first code ).

Still doesn't work.

EDIT: oh, and I just had to use

(not (initget 4))

instead of

(not (initget (+ 2 4)))

Edited by Grrr
Link to comment
Share on other sites

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