+ Reply to Thread
Results 1 to 6 of 6

Thread: offset polyline

  1. #1
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Apr 2008
    Posts
    258

    Default offset polyline

    Registered forum members do not see this ad.

    how can i offset apolyline in attachment lisp note that i want offset inside the shape?
    Attached Files

  2. #2
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Sep 2008
    Location
    Queensland, Australia
    Posts
    39

    Default

    try adding a (setq d1) line for a distance then run the offset command in the lisp right after you have drawn the polyline.
    (command "offset" (entlast) d1).

    Maybe try something like that. You may still need to click on the inside of the object. Im still new to all this coding but try that.

  3. #3
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Apr 2008
    Posts
    258

    Default

    thanks matthewrussell for your advise BUT it doesn't work for me


    any help

  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,915

    Default

    An example of an offset:

    (in the words of lpseifert)

    *Quick and Dirty*

    Code:
    (defun c:off (/ lin ent len pt pt1 pt2 dist ang)
        (setvar "cmdecho" 0)
        (princ "\nConstruct Line to Offset...")
        (command "_line" pause pause "")
        (setq lin (entlast))
        (setq ent (entget lin))
        (setq len (distance (setq pt1 (cdr (assoc 10 ent))) (setq pt2 (cdr (assoc 11 ent)))))
        (setq pt (polar pt1 (setq ang (angle pt1 pt2)) (/ len 2)))
        (setq dist (getreal "Specify Offset Distance: "))
        (command "_offset" dist lin (polar pt (+ ang (/ pi 2)) 0.01) "")
        (setvar "cmdecho" 1)
        (princ)
    ) ;_  end defun
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,915

    Default

    In the above LISP, the constructed line is assigned to a variable using the entlast function, then the midpoint of the line is extracted - although to be honest this point can be any point on the line. - I just chose the midpoint.

    Then the angle of the line is extracted and a point perpendicular to the line, and some distance (0.01 in this case) away from the line to one side is assigned to a variable.

    The offset distance is retrieved using the getreal function, and then, the line variable, offset distance and perpendicular point are used in the normal ACAD offset function to offset the line.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  6. #6
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Apr 2008
    Posts
    258

    Default

    Registered forum members do not see this ad.

    DEAR Lee Mac THANKS ALOT FOR YOUR HELP IT WORK WITH LINES BUT IT DOESN'T WORK FOR PLINES I TRY USE _PLINE COMMAND BUT IT DOESN'T WORK ALSO MY PROBLEM IS OFFSET PLINE AS SHOWN IN MY LISP



    THANKS AGAIN.

Similar Threads

  1. How do I offset 3d Polyline
    By free2fly in forum AutoCAD General
    Replies: 24
    Last Post: 7th Jan 2011, 10:50 am
  2. Full outline offset of polyline with LISP possible?
    By t.freriks in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 24th Sep 2009, 08:17 pm
  3. Offset
    By elliot pye in forum AutoCAD 3D Modelling & Rendering
    Replies: 1
    Last Post: 10th Jul 2008, 11:22 am
  4. Offset <through>
    By Melinda Choppa in forum AutoCAD General
    Replies: 2
    Last Post: 6th Oct 2005, 12:33 am
  5. offset
    By joiner in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 5th Apr 2005, 04:44 pm

Bookmarks

Posting Permissions

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