Results 1 to 6 of 6

Thread: Reduced Scale LISP routine

  1. #1
    100 Club
    Join Date
    2011-08
    Location
    Vadodara, India
    Posts
    147
    Login to Give a bone
    0

    Default Reduced Scale LISP routine

    Hi!

    I have required to reduced scale from actual scale with some restrictions as per attached CAD drawing.

    Thanks,

    Avinash
    Attached Files Attached Files

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Reduced Scale LISP routine

    You need to do something like get all circles, sort the centroids as they may not have been selected in drawn order. Then using x & Y values do the new dimensioning.

  3. #3
    100 Club
    Join Date
    2011-08
    Location
    Vadodara, India
    Posts
    147
    Login to Give a bone
    0

    Default Re: Reduced Scale LISP routine

    Thanks for reply,

    It is already sorted by X and Y but I required to be fitted in 230mm. length all dimensions. it is reduced from actual length. any solution.

    Thanks,

    Avinash

  4. #4
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Reduced Scale LISP routine

    I have ran out of time for now, but almost there. I am using a pline and points for testing. I have found that the dwg is very sloppy in that dwg circles are not done well hence I put a "fix" in the code otherwise got all sorts of answers like 39.987654 instead of 40. Need to take more care and use ortho F8 and copy/move with fixed offsets to maintain accuracy. I am more inclined to do a distance from the start end so 25 65 105 and so on with y offset the way you would lay a tape on a beam.

    Code:
    (defun c:test ( / pt1 pt2 lst J x y )
    (SETQ OLDSNAP (GETVAR 'OSMODE))
    (setq pt1 (getpoint "Pick lower left corner of existing"))
    ;(setq pt1a (getpoint "Pick lower right corner of existing"))
    
    (setq ss (ssget (list (cons 0 "Circle"))))
    (setq pt2 (Getpoint "Pick pt2 for new location"))
    
    (setq lst '())
    (repeat (setq J (sslength ss))
    (setq pt  (assoc 10 (entget (ssname ss (setq J (- J 1))))))
    (setq lst (cons (list (nth 1 pt)(nth 2 pt)) lst ))
    )
    (setq lst (VL-SORT lst '(lambda (a b) (> (car a) (car b)))))
    ;(setq lst (reverse lst))
    
    (SETVAR 'OSMODE 0)!
    (command "_pline")
    (while (= (getvar "cmdactive") 1 ) 
    (repeat (setq J (length lst))
    (command (nth (setq J (- J 1)) lst))
    )
    (command "")
    )
    
    (setq offs 5)
    (setq top 15)
    (setq len (+ 10  (* (sslength ss) 5)))
    (setq pt3 (polar (polar pt2 0.0  len) (/ pi 2.0) 15))
    (command "rectang" pt2 pt3)
    
     ; x value starts 5 Jn 
    (setq x (+ 5 (car pt2)))
    (setq lst2 '())
    (repeat (setq J (sslength ss))
    (setq ptxy (nth (setq J (- J 1)) lst))
    (setq y (* 0.075 (- (cadr ptxy)( cadr pt1))))
    (setq y (+ y (cadr pt2)))
    (setq x (+ x 5))
    (setq lst2 (cons (list x y) lst2))
    )
    
    (repeat (setq x (length lst2))
    (command "point" (nth (setq x (- x 1)) lst2))
    )
    
    (setq lst2 (cons pt2 lst2))
    (setq lst2 (cons  pt3 lst2))
    (setq lst2 (VL-SORT lst2 '(lambda (a b) (> (car a) (car b)))))
    
    (setq dims '())
    (setq J (length lst))
    (repeat (- J 1)
    (setq dimx (fix (-  (car (nth (- J 2) lst))(car (nth (- J 1) lst)))))
    (setq dims (cons dimx dims))
    (setq J (- J 1))
    )
    
    (setq y (length dims))
    (repeat (setq x (length lst2))
    (setq pt1d  (nth (setq x (- x 1)) lst2))
    (setq pt2d  (nth x lst2))
    (setq dimval (nth y dims))
    (command  "dim" "hor" pt1d pt2d pt4 dimval "exit")
    (setq y (- y 1))
    
    (setvar 'osmode oldsnap)
    )
    
    (c:test)
    Last edited by BIG-AL; 2017-08-22 at 07:02 AM.

  5. #5
    100 Club
    Join Date
    2011-08
    Location
    Vadodara, India
    Posts
    147
    Login to Give a bone
    0

    Default Re: Reduced Scale LISP routine

    Hi!

    Thanks for your reply, I ran your routine thanks for that I want to correction on it. you have divided by 5mm. all the dimensions but I want it is reduced by its length. if it is converted in to reduced scale if value comes less than 5mm. it takes minimum 5mm. but if scale more than 5mm. (say 10, 12, 15 or any) it should take this value not 5mm.

    Thanks,

    Avinash

  6. #6
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Reduced Scale LISP routine

    I matched your sample dwg, as the code basicly works feel free to having a go to make it exactly as you want. I do not understand your scaling request.

Similar Threads

  1. Help with a lisp routine to add a 12" line to this routine
    By Orbytal.edge341183 in forum AutoLISP
    Replies: 3
    Last Post: 2012-11-14, 10:33 PM
  2. Replies: 2
    Last Post: 2008-11-04, 08:03 AM
  3. LISP routine to Scale in X,Y,Z, independently
    By tim.grud in forum AutoLISP
    Replies: 1
    Last Post: 2006-06-01, 02:31 PM
  4. display an alternative scale for reduced plot size
    By Martin P in forum Revit Architecture - Wish List
    Replies: 2
    Last Post: 2005-03-08, 07:22 PM
  5. Replies: 6
    Last Post: 2004-06-30, 08:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •