Offset Angles 90 and 270

Discussion in 'AutoCAD' started by Dommy2Hotty, Jan 28, 2004.

  1. Dommy2Hotty

    Dommy2Hotty Guest

    Here's part of my lisp to offest a line created...what do I replace the ? with to offset the line 90 or 270 degrees? Is this something I need to set during the lisp, something like (setq angup (....))? I want to avoid picking a point above or below the line, but I don't know how to input angles into a lisp command.


    (setq L1 (entlast))

    (command "offset" "8.0" L1 ? "")
     
    Dommy2Hotty, Jan 28, 2004
    #1
  2. Dommy2Hotty

    BillZ Guest

    Look into the polar function:

    You would need to determine an angle ahead of time.
    You could use the angle of the line:
    (setq pt1(cdr (assoc 10 (entget l1)))
    pt2 (cdr (assoc 11 (entget l1)))
    angle_in_radians (+ (angle pt1 pt2)(* pi 0.5)) ;minus is other direction.
    )
    (command "offset" "8.0" L1 (polar (getvar "lastpoint") angle_in_radians distance) "")

    HTH

    Bill
     
    BillZ, Jan 28, 2004
    #2
  3. Dommy2Hotty

    TCEBob Guest

    I believe the 8.0 should not have quotes.

    rs
     
    TCEBob, Jan 28, 2004
    #3
  4. Dommy2Hotty

    Dommy2Hotty Guest

    Okay, all lines will be horizontal, so the angles offset will always be 90 and 270. Here's what I got so far, but don't know if I need to change anything in the part that you gave me...

    (defun c:eek:fftest()

    (command "line" pause pause "")

    (setq L1 (entlast))

    (setq pt1(cdr (assoc 10 (entget L1)))
    (setq pt2(cdr (assoc 11 (entget L1)))
    (+ (angle pt1 pt2)(* pi 0.5)))

    (command "offset" "8.0" L1 (polar (getvar "lastpoint") angle_in_radians distance) "")

    (princ)

    )
    (princ)
     
    Dommy2Hotty, Jan 28, 2004
    #4
  5. Dommy2Hotty

    Dommy2Hotty Guest

    no, the 8.0 is ok in quotes, I mean, the lisp works great, but I'd like to take the these two steps out:

    (setq DN (getpoint "\nSelect Point BELOW Foundation : " ))

    (setq UP (getpoint "\nSelect Point ABOVE Second Floor : " ))

    I use them to establish points to offset to, but that's two extra steps I have to do when running the lisp. I want to replace them with 90 for UP and 270 degrees for DN so they are set automatically when the lisp starts.
     
    Dommy2Hotty, Jan 28, 2004
    #5
  6. Dommy2Hotty

    Jeff Mishler Guest

    if the points will ALWAYS be either in the +y or -y direction ,relative to
    the line, why not just use incredibly large numbers for the pick point?
    (setq dn '(0 -100000000)
    up '(0 100000000)
    )

    Jeff

    have to do when running the lisp. I want to replace them with 90 for UP and
    270 degrees for DN so they are set automatically when the lisp starts.
     
    Jeff Mishler, Jan 28, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.