Jump to content

Recommended Posts

Posted

I have a survey with the topographic elevations (not annotative) called out with leaders.

I would like to scale all those leaders by "x" all at the same time and all from the tip of the leaders (individually).

Is there a Lisp routine that I can use to do this?

I am currently selecting each individual one and applying the scale command. This is very time consuming and tedious, any help will be greatly appreciated.

23-1906ATOPOSTRIP.dwg

  • Like 1
Posted

How much do you know about lisp ? You can select "Leader" 

 

(defun c:wow ( / ss le x pt oldsnap leent co-ord)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setq sc (getreal "\nEnter scale value "))
(setq ss (ssget '((0 . "*LEADER"))))
(repeat (setq x (sslength ss))
(setq le (ssname ss (setq x (1- x))))
(setq leent (entget le))
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) leent)))
(setq pt (caddr co-ord))
(command "scale" le "" pt sc)
)
(setvar 'osmode oldsnap)
(princ)
)

 

Posted
3 hours ago, BIGAL said:

How much do you know about lisp ? You can select "Leader" 

 

(defun c:wow ( / ss le x pt oldsnap leent co-ord)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setq sc (getreal "\nEnter scale value "))
(setq ss (ssget '((0 . "*LEADER"))))
(repeat (setq x (sslength ss))
(setq le (ssname ss (setq x (1- x))))
(setq leent (entget le))
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) leent)))
(setq pt (caddr co-ord))
(command "scale" le "" pt sc)
)
(setvar 'osmode oldsnap)
(princ)
)

 

I do not know how to create what you just created but I do know how to save it, load it and use it. Thank you!!

 

With that said, when I do use it in the original file it work flawlessly.

 

I then scaled the drawing to be 1:1 and now the leaders move to a different location after using your lisp.

Another thing that happens is that all my osnap settings get cleared.

 

 

 

Posted

If its crashing out then it is not running the last line (setvar 'osmode oldsnap) which resets the osnaps back to what they were. 

 

I stay away from annotative so dont get these problems.

 

Post the dwg again with the annotation scale reset, also I am metric scales much easier.

  • 2 weeks later...
Posted
On 12/14/2023 at 12:16 AM, BIGAL said:

If its crashing out then it is not running the last line (setvar 'osmode oldsnap) which resets the osnaps back to what they were. 

 

I stay away from annotative so dont get these problems.

 

Post the dwg again with the annotation scale reset, also I am metric scales much easier.

Here is the file again. Thanks for the help so far.

23-1906ATOPOSTRIP.dwg

Posted

The leader has a base point some 2900 in X direction similar Y that is why its not working I dont think its got anything to do with annotative. Some where inside the leader properties is an answer, also noticed the leader line is made up of 2 objects. The leaders have been created in some other way.

 

Sorry can not help any more. Some one else may have an idea.

  • 2 months later...
Posted
On 12/14/2023 at 8:16 AM, BIGAL said:

If its crashing out then it is not running the last line (setvar 'osmode oldsnap) which resets the osnaps back to what they were. 

 

(setvar "osmode" oldsnap)

It works...

Posted
On 12/14/2023 at 1:10 AM, BIGAL said:
(defun c:wow ( / ss le x pt oldsnap leent co-ord)

If you change the code a little bit:

;; changes the scale of all LEADERS that are included in the selection frame
;; MLEADERS keep the starting point
;; osmode returns the initial value
(defun c:wow1 ( / ss le x pt oldsnap leent co-ord)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setq sc (getreal "\nEnter scale value "))
(setq ss (ssget '((0 . "*LEADER"))))
(repeat (setq x (sslength ss))
(setq le (ssname ss (setq x (1- x))))
(setq leent (entget le))
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) leent)))
(setq pt (caddr co-ord))
(command "scale" le "" pt sc)
)
(setvar "osmode" oldsnap) ;; replacing this string (setvar 'osmode oldsnap)
(princ)
)

 

;; changes the scale of all LEADERS in the drawing without selection
;; MLEADERS keep the starting point
;; osmode returns the initial value
(defun c:wow2 ( / ss le x pt oldsnap leent co-ord)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setq sc (getreal "\nEnter scale value "))
(setq ss (ssget "_X" '((0 . "*LEADER")))) ;; replacing this string(setq ss (ssget '((0 . "*LEADER"))))
(repeat (setq x (sslength ss))
(setq le (ssname ss (setq x (1- x))))
(setq leent (entget le))
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) leent)))
(setq pt (caddr co-ord))
(command "scale" le "" pt sc)
)
setvar "osmode" oldsnap) ;; replacing this string (setvar 'osmode oldsnap)
(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...