+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Senior Member CafeJr's Avatar
    Using
    AutoCAD 2010
    Join Date
    Oct 2013
    Location
    Brazil, São Paulo, Sorocaba
    Posts
    216

    Default Multiple Offset, how to fix it?

    Registered forum members do not see this ad.

    Guys,

    I got this code, to do a multiple offset, it works good, but I need to do one complementation in that, the direction of final objects, the code doesn't allow you choose it, every time the code draw the offset line above of objects, It's possible fix it? Indicating the direction of end offset lines...

    Thanks in advance...

    Code:
    (defun c:mo (/ plines ; selection set of polylines
           ext ; extrnal point
           dist ; distance to offset
           poly ; a polyline from plines
           plist ; the list of poly
           del ; polyline to delete
           int ; internal point
           i
           layer)  
      (command "undo" "begin")
      (princ "select polylines")
      (setq plines (ssget)
     i      0
     ext    (getvar "limmax")
     dist   (getdist "distance = ")
      )
      (repeat (sslength plines)
        (setq poly (ssname plines i))
        (setq plist (entget poly))
        (command "offset" dist poly ext "")
        ;(setq del (entlast)
        ;int (polar
        ;(cdr (assoc 10 (entget del)))
        ;(angle
        ;(cdr (assoc 10 (entget del)))
        ;(cdr (assoc 10 plist)))
        ;(* 2 (distance (cdr (assoc 10 plist))
        ;(cdr (assoc 10 (entget del)))))))
        ;(command "offset" dist poly int "")
        ;(entdel del)
        (setq i (1+ i))
      )
      (command "undo" "end")
      (if (= "Y"
      (strcase (getstring "\ndelete initial polylines? (Y/N) = "))
          )
        (command "erase" plines "")
      )
    )

  2. #2
    Senior Member
    Using
    AutoCAD 2011
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    115

    Default

    Untested, but should fix the issue. I changed "ext" (added getpoint) and "dist" (added \n)

    Code:
    (defun c:mo (/ plines ; selection set of polylines
           ext ; extrnal point
           dist ; distance to offset
           poly ; a polyline from plines
           plist ; the list of poly
           del ; polyline to delete
           int ; internal point
           i
           layer)  
      (command "undo" "begin")
      (princ "select polylines")
      (setq plines (ssget)
     i      0
     ext    (getpoint "\nSelect the offset direction")
     dist   (getdist "\ndistance = ")
      )
      (repeat (sslength plines)
        (setq poly (ssname plines i))
        (setq plist (entget poly))
        (command "offset" dist poly ext "")
        ;(setq del (entlast)
        ;int (polar
        ;(cdr (assoc 10 (entget del)))
        ;(angle
        ;(cdr (assoc 10 (entget del)))
        ;(cdr (assoc 10 plist)))
        ;(* 2 (distance (cdr (assoc 10 plist))
        ;(cdr (assoc 10 (entget del)))))))
        ;(command "offset" dist poly int "")
        ;(entdel del)
        (setq i (1+ i))
      )
      (command "undo" "end")
      (if (= "Y"
      (strcase (getstring "\ndelete initial polylines? (Y/N) = "))
          )
        (command "erase" plines "")
      )
    )

  3. #3
    Senior Member CafeJr's Avatar
    Using
    AutoCAD 2010
    Join Date
    Oct 2013
    Location
    Brazil, São Paulo, Sorocaba
    Posts
    216

    Default

    Quote Originally Posted by CheSyn View Post
    Untested, but should fix the issue. I changed "ext" (added getpoint) and "dist" (added \n)
    Tested!... Thanks CheSyn!... Works well!!!...

  4. #4
    Forum Newbie
    Using
    AutoCAD 2012
    Join Date
    Jul 2013
    Posts
    2

    Default

    HI to all!
    Is there a way to add to the above code the ability to change the layer also of the offset objects??
    Thanks in advance!

  5. #5
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    To change the layer of newly created polylines (adjust part in blue to suit your case):
    Code:
    ...
        (setq plist (entget poly))
        (command "offset" dist poly ext "")
        (command "_CHPROP" (entlast) "" "_LA" "NameOfTargetLayer" "")
    ...
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  6. #6
    Forum Newbie
    Using
    AutoCAD 2012
    Join Date
    Jul 2013
    Posts
    2

    Default

    Quote Originally Posted by MSasu View Post
    To change the layer of newly created polylines (adjust part in blue to suit your case):
    Code:
    ...
        (setq plist (entget poly))
        (command "offset" dist poly ext "")
        (command "_CHPROP" (entlast) "" "_LA" "NameOfTargetLayer" "")
    ...
    Wow thank you so much! Really appreciate your help! Works exactly as needed!

  7. #7
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    Registered forum members do not see this ad.

    You're entirely welcome!
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

Similar Threads

  1. Multiple Offset
    By daiharv in forum AutoCAD Drawing Management & Output
    Replies: 19
    Last Post: 10th Dec 2015, 10:54 am
  2. multiple offset
    By anishtain4 in forum AutoLISP, Visual LISP & DCL
    Replies: 43
    Last Post: 20th Feb 2012, 09:40 am
  3. offset multiple objects
    By dimekus in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 2nd Jun 2011, 07:15 pm
  4. multiple offset lisp
    By OMEGA-ThundeR in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 5
    Last Post: 25th Sep 2009, 02:41 pm
  5. Multiple offset?
    By James in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 27th Nov 2006, 01:50 pm

Tags for this Thread

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