+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    Mechanical 2013
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    102

    Default Change chamfer results to the current layer?

    Registered forum members do not see this ad.

    Hi All

    Does any one have a Lisp routine to turn the diagonal line that chamfer creates to the current layer instead of the original layer of the lines? I would appreciate any help.


    Thanks
    Brian

  2. #2
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,137

    Default

    Is your stated version (2000i) an older LT version? Is it LISP capable?
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  3. #3
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    Mechanical 2013
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    102

    Default

    We use 2000i and 2012

  4. #4
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,137

    Default

    Code:
    (defun c:Chamfer2 (/ ent)
      (setq ent (entlast))
      (command "_.chamfer")
      (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (command PAUSE))
      (if (not (equal ent (setq ent (entlast))))
        (entmod (list (cons 8 (getvar 'CLAYER)) (cons -1 ent)))
      )
      (princ)
    )
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  5. #5
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    Mechanical 2013
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    102

    Default

    Thanks that is exactly what i was looking for...

  6. #6
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,137

    Default

    You're welcome.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  7. #7
    Senior Member Ahankhah's Avatar
    Computer Details
    Ahankhah's Computer Details
    Operating System:
    Windows XP
    Using
    AutoCAD 2012
    Join Date
    Jun 2010
    Location
    Tehran, Iran
    Posts
    430

    Default

    But when chamfering a Polyline object while Trimmode variable is set to zero, there may be more than one object as the result of CHAMFER.
    For this case alanjt's nice code can be edited to:

    Code:
    (defun c:Chamfer2 (/ ent)
     (setq ent (entlast))
     (command "_.chamfer")
     (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (command PAUSE))
     (while (setq ent (entnext ent))
      (entmod (list (cons 8 (getvar 'CLAYER)) (cons -1 ent)))
     )
     (princ)
    )
    Mehrdad Ahankhah مهرداد آهن خواه
    www.IranCAD.com

  8. #8
    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,601

    Default

    Be careful when 'entlast' is an Attribute Block or Polyline.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  9. #9
    Senior Member Ahankhah's Avatar
    Computer Details
    Ahankhah's Computer Details
    Operating System:
    Windows XP
    Using
    AutoCAD 2012
    Join Date
    Jun 2010
    Location
    Tehran, Iran
    Posts
    430

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Lee Mac View Post
    Be careful when 'entlast' is an Attribute Block or Polyline.
    I checked Polyline and it doesn't cause any error on VERTEX and SEQUEND objects, but changes ATTRIB objects. So the code can be edited to this one:
    Code:
    (defun c:Chamfer2 (/ ent)
     (setq ent (entlast))
     (command "_.chamfer")
     (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (command PAUSE))
     (while (setq ent (entnext ent))
      (or
       (member (cdr (assoc 0 (entget ent))) '("ATTRIB" "VERTEX" "SEQUEND"))
       (entmod (list (cons 8 (getvar 'CLAYER)) (cons -1 ent)))
      ) 
     )
     (princ)
    )
    Mehrdad Ahankhah مهرداد آهن خواه
    www.IranCAD.com

Similar Threads

  1. Change current layer and selection set to layer 0..
    By hardwired in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 19th Sep 2013, 11:42 pm
  2. chamfer command giving two different results
    By gargoyle27 in forum Autodesk Inventor
    Replies: 4
    Last Post: 21st Oct 2010, 04:27 pm
  3. current layer change
    By hokie555 in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 14th Oct 2009, 09:40 pm
  4. AUGI Board of Directors Election Results - No Change
    By Between the Lines in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 29th Dec 2008, 07:00 pm
  5. Change the angle in a chamfer (3d cylinder)
    By ShawnPeter in forum AutoCAD 3D Modelling & Rendering
    Replies: 16
    Last Post: 30th Jan 2008, 11:19 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