+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Nov 2008
    Posts
    34

    Default Help With Offset Code

    Registered forum members do not see this ad.

    I am trying to offset a line and have the layer of the new line to be something different. I found this code below but it defaults to 3/4" offset and I need to be able to user input the offset distance, because it will constantly be different. Can anyone please help .


    ;; Offset 0.75 to layer "0"
    (defun c:ce (/ ent pt)
    (while (and
    (setq ent (car (entsel "\nSelect object to offset 3/4 or <exit>:")))
    (setq pt (getpoint "\nSpecify point on side to offset:"))
    )
    (command "._offset" 0.75 ent "_non" pt "")
    (command "._change" (entlast) "" "_P" "_LA" "0" "")
    )
    (princ)
    )

  2. #2
    Forum Deity
    Using
    Civil 3D 2008
    Join Date
    Sep 2006
    Location
    Pittsburgh, PA, USA
    Posts
    3,581

    Default

    Registered forum members do not see this ad.

    look and learn...
    Code:
    (defun c:ce (/ od ent pt)
    (setq od (getdist "Enter offset distance: "))
    (while (and
    (setq ent (car (entsel "\nSelect object to offset or <exit>:")))
    (setq pt (getpoint "\nSpecify point on side to offset:"))
    )
    (command "._offset" od ent "_non" pt "")
    (command "._change" (entlast) "" "_P" "_LA" "0" "")
    )
    (princ)
    )
    You know the OOTB offset command in 2008 has an option for putting the offset line on a different layer than original.

Similar Threads

  1. Ability to write code? or ability to see need for code?
    By feargt in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 5th Oct 2008, 09:04 pm
  2. Dim offset?
    By RFRUSSO in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 26th Jul 2007, 12:08 am
  3. Offset <through>
    By Melinda Choppa in forum AutoCAD General
    Replies: 2
    Last Post: 6th Oct 2005, 12:33 am
  4. 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