Results 1 to 7 of 7

Thread: Offset Multiple lines in two directions

  1. #1
    Member mhibbitt's Avatar
    Join Date
    2009-11
    Location
    Dallas, TX
    Posts
    32

    Default Offset Multiple lines in two directions

    I have created a LISP that will offset a line in both directions. This is very useful when offseting lot lines to create build lines. Let me rephrase that it would be very usefule when creating build lines. If It could do the following:

    Select upto if not more than 500 lines and offset each one a given distance (by the user) both directions. I am assuminig that all I need to do is wrap my existing code in a loop, but I am not very good at loops. I get lost once I start trying to write a loop.

    Any and all help would be appreciated.

    (defun c:mOffset ()
    (startErrorTrap)
    (setvar "cmdecho" 0)


    (setq xLine (entsel "\nSelect Line: "))
    (setq ent (entlast))
    (setq entdata (entget ent))
    (setq stpt (cdr (assoc 10 entdata)))
    (setq endpt (cdr (assoc 11 entdata)))

    (initget 7)
    (setq dist (getdist "\nEnter Distance Between Lines: "))

    (setq ang (angle stpt endpt))
    (setq r90 (* pi 0.5))
    (setq r270 (* pi 1.5))
    (setq hdist (/ dist 1.0))

    (setq usp (polar stpt (+ ang r90) hdist))
    (setq uep (polar endpt (+ ang r90) hdist))

    (setq lsp (polar stpt (- ang r90) hdist))
    (setq lep (polar endpt (- ang r90) hdist))

    (command "Line" usp uep "" "Line" lsp lep "")


    (EndErrorTrap)
    (princ)
    );defun

  2. #2
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Hartford, Michigan
    Posts
    3,086

    Default Re: Offset Multiple lines in two directions

    If you want to select more than one object at a time, you'll need to use ssget instead of entsel, then create a loop that will cycle through each object in the selection set and apply the specified changes.
    Christopher T. Cowgill, P.E.
    WIGHTMAN & ASSOCIATES, INC.
    ENGINEERING <> SURVEYING <> ARCHITECTURE
    AutoDesk Infrastructure Design Suite Premium 2013 x64
    Windows 7 Pro x64

  3. #3
    Member mhibbitt's Avatar
    Join Date
    2009-11
    Location
    Dallas, TX
    Posts
    32

    Default Re: Offset Multiple lines in two directions

    I used the ssget instead of entsel and the following is what I received on the command line.

    Command: (setq xxx (ssget "\nSelect Lines: "))
    *Cancel*
    bad point argument

  4. #4
    AUGI Addict alanjt's Avatar
    Join Date
    2008-02
    Posts
    1,073

    Default Re: Offset Multiple lines in two directions

    Here's one I wrote a while back...
    Attached Files Attached Files
    Civil 3D 2011|2012 ~ Windohz 7
    Dropbox | finding the light…

  5. #5
    Member mhibbitt's Avatar
    Join Date
    2009-11
    Location
    Dallas, TX
    Posts
    32

    Default Re: Offset Multiple lines in two directions

    Thanks alanjt. . . That works great!!!

  6. #6
    AUGI Addict alanjt's Avatar
    Join Date
    2008-02
    Posts
    1,073

    Default Re: Offset Multiple lines in two directions

    Quote Originally Posted by mhibbitt View Post
    Thanks alanjt. . . That works great!!!
    You're welcome.
    Civil 3D 2011|2012 ~ Windohz 7
    Dropbox | finding the light…

  7. #7
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Hartford, Michigan
    Posts
    3,086

    Default Re: Offset Multiple lines in two directions

    Quote Originally Posted by mhibbitt View Post
    I used the ssget instead of entsel and the following is what I received on the command line.

    Command: (setq xxx (ssget "\nSelect Lines: "))
    *Cancel*
    bad point argument
    The reason the above code doesnt work is that you cant have a prompt within the ssget function. When I was stating to use ssget instead of entsel, I was referring to replacing the entire function, not just the word. If you want to understand the differences between the two functions, take a look at the help file.
    Christopher T. Cowgill, P.E.
    WIGHTMAN & ASSOCIATES, INC.
    ENGINEERING <> SURVEYING <> ARCHITECTURE
    AutoDesk Infrastructure Design Suite Premium 2013 x64
    Windows 7 Pro x64

Similar Threads

  1. 2004: multiple values for offset
    By rickcormier54 in forum AutoCAD General
    Replies: 1
    Last Post: 2012-03-20, 06:45 PM
  2. Multiple offset
    By sandeep_koodal in forum AutoCAD Tips & Tricks
    Replies: 8
    Last Post: 2010-01-13, 01:01 PM
  3. lines with inaccurate directions
    By andrew.106604 in forum Revit Architecture - General
    Replies: 1
    Last Post: 2006-03-11, 12:34 AM

Posting Permissions

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