Results 1 to 4 of 4

Thread: Help with a lisp routine to add a 12" line to this routine

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Login to Give a bone
    0

    Default Help with a lisp routine to add a 12" line to this routine

    Code:
    ;get points to locate centerline of header
             (prompt "\nSelect two points for Rim line: ")
             (command "_.line" pause pause "")
             (setq tmpPnt1 (cdr (assoc 10 (entget (entlast)))))
             (setq tmpPnt2 (cdr (assoc 11 (entget (entlast)))))
             (COMMAND "_.erase" "L" "")
             (setvar "osmode" 0)
    
             (command "_.line"
                      (polar tmpPnt1 (angle tmpPnt1 tmpPnt2) (* mtScaleFactor 1.25))
                      (polar tmpPnt2 (+ (angle tmpPnt1 tmpPnt2) PI) (* mtScaleFactor 1.25))
                      ""
    This part of the lisp draws a line then depending on the dimscale it retracts the 2 ends closer to the center. I was wondering if i could get some help making the lines extend 12" i've tried messing with the scale factors ( IE 1.25 - 1.00 -.25) I seem to be missing something to go in a positive direction versus negative.

    Thanks for the help in advance
    Last edited by Opie; 2012-11-14 at 03:40 PM. Reason: [code] tags added -Opie

  2. #2
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Help with a lisp routine to add a 12" line to this routine

    retracts the 2 end
    or
    making the lines extend
    which one? or option for both?

  3. #3
    Login to Give a bone
    0

    Default Re: Help with a lisp routine to add a 12" line to this routine

    Quote Originally Posted by pbejse View Post
    or


    which one? or option for both?
    Let me explain it a little better......The Lisp draws a line between 2 points and depending on the scale factor (typically dimscale 48 for example) it will stop the line 3" short on either end of the 2 points picked. (for dimscale 96 it will stop 1-1/2" short).

    What I am trying to achieve is to extend the line 12" past (at dimscale 4 the 2 points picked. The original "mtscale factor" was set at .0625 for the 3" variable. I adjusted it to 1.25 but it doesnt seem to work. It seems to be referencing the the "actual distance between the 2 points" and messes with the whole line offset. Sometimes it extends too far past the 2 points or stops short by a lot. I hope this explains things a little better. Thanks for the response. I am glad someone is looking

  4. #4
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    232
    Login to Give a bone
    0

    Default Re: Help with a lisp routine to add a 12" line to this routine

    Use the midpoint for extent or reduce length

    Code:
    (defun c:LenghtByFact ( / js n dxf_ent dxf_10 dxf_11 mid k dlt_10 dlt_11 nwdxf_10 nwdxf_11)
      (princ "\nSelect lines for reduce or extent length with a factor. ")
      (setq js (ssget '((0 . "LINE"))))
      (cond
        (js
          (initget 3)
          (setq k (getreal "\nGive the factor: "))
          (repeat (setq n (sslength js))
            (setq
              dxf_ent (entget (ssname js (setq n (1- n))))
              dxf_10 (cdr (assoc 10 dxf_ent))
              dxf_11 (cdr (assoc 11 dxf_ent))
              mid
              (mapcar '*
                (mapcar '+ dxf_10 dxf_11)
                '(0.5 0.5 0.5)
              )
              dlt_10 (mapcar '* (mapcar '- dxf_10 mid) (list k k k))
              dlt_11 (mapcar '* (mapcar '- dxf_11 mid) (list k k k))
              nwdxf_10 (mapcar '+ mid dlt_10)
              nwdxf_11 (mapcar '+ mid dlt_11)
              dxf_ent (subst (cons 10 nwdxf_10) (assoc 10 dxf_ent) dxf_ent)
              dxf_ent (subst (cons 11 nwdxf_11) (assoc 11 dxf_ent) dxf_ent)
            )
            (entmod dxf_ent)
          )
        )
      )
      (prin1)
    )

Similar Threads

  1. Replies: 14
    Last Post: 2015-08-21, 03:59 AM
  2. Add layer command line to a lisp routine
    By BrianTFC in forum AutoLISP
    Replies: 1
    Last Post: 2012-02-02, 07:47 AM
  3. Lisp routine to list line length and line ID
    By hlecates in forum AutoLISP
    Replies: 6
    Last Post: 2007-03-21, 04:03 PM
  4. Replies: 40
    Last Post: 2006-10-16, 05:02 PM
  5. Replies: 3
    Last Post: 2005-10-11, 06:59 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
  •