Jump to content

Recommended Posts

Posted

I thought I remember someone once writing a lisp routing to allow you to dynamically change your LTSCALE until the linetype dashes appear?

 

All I could find was this:

http://www.cadtutor.net/forum/showthread.php?42389-LTSCALE-Auto-shrink-until-pattern-appears&highlight=ltscale

 

Specifically when I have little line fragments that are too short to display at the current LTSCALE I'd like to removed the guess, enter, guess again, enter, guess again to doing this if it is at all possible? :wink:

 

Please advise...

 

THX!

Posted
(defun c:LTS (/ _draw ss gr)
 ;; Dynamically change LTScale of selected object(s)
 ;; Requried subroutines: AT:SS->List
 ;; Alan J. Thompson, 07.06.10

 (defun _draw (p1 p2) (redraw) (grdraw p1 p2 3 1) (/ (distance p1 p2) 100.))

 (if (setq ss (AT:SS->List (ssget "_:L" '((0 . "ARC,ELLIPSE,CIRCLE,*LINE"))) T))
   (while (and (eq 5 (car (setq gr (grread T 15 1)))) (vl-consp (cadr gr)))
     (foreach x ss
       (vl-catch-all-apply
         (function vla-put-linetypescale)
         (list
           x
           (_draw
             (trans (vlax-curve-getClosestPointTo
                      (car
                        (vl-sort
                          ss
                          (function
                            (lambda (a b / pt)
                              (< (distance
                                   (vlax-curve-getClosestPointTo a (setq pt (trans (cadr gr) 1 0)))
                                   pt
                                 )
                                 (distance (vlax-curve-getClosestPointTo b pt) pt)
                              )
                            )
                          )
                        )
                      )
                      (trans (cadr gr) 1 0)
                    )
                    0
                    1
             )
             (cadr gr)
           )
         )
       )
     )
   )
 )
 (redraw)
 (princ)
)

(defun AT:SS->List (SS VLA)
 ;; Convert selection set to list of ename or vla objects
 ;; SS - SSGET selection set
 ;; VLA - T for vla objects, nil for ename
 ;; Alan J. Thompson, 04.01.10
 (if (eq 'PICKSET (type SS))
   ((lambda (i / e l)
      (while (setq e (ssname SS (setq i (1+ i))))
        (cond (VLA (setq l (cons (vlax-ename->vla-object e) l)))
              ((setq l (cons e l)))
        )
      )
    )
     -1
   )
 )
)

Posted

Thank you!

This is awesome!!

I did have to modify one little thing for my particular instance..

 

 
(/ (distance p1 p2) 100.))

 

to

 

 
(/ (distance p1 p2) 0.25))

 

 

Thank you SO MUCH!!!!

 

VERY Appreciated!

Posted
Thank you!

This is awesome!!

I did have to modify one little thing for my particular instance..

 

 
(/ (distance p1 p2) 100.))

 

to

 

 
(/ (distance p1 p2) 0.25))

 

 

Thank you SO MUCH!!!!

 

VERY Appreciated!

Right on. Yeah, I wrote this when we were working with some client provided lintypes and the LTScales were retarded (as you can see).

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