+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 27
  1. #11
    Junior Member
    Using
    Architecture 2013
    Join Date
    Jul 2011
    Posts
    10

    Default

    Registered forum members do not see this ad.

    You're welcome.

    I did notice a couple of things that I missed when I posted the code.

    The first thing is to update this line:
    Code:
    (vl-cmdf "explode" (entlast) "")
    You shouldn't need the quote marks at the end of the line. Just delete them. Let me know if that doesn't work for you.

    The other thing you could do is add *error* to the local variables
    Code:
    (/ *error* CurLayer OffsetDist VlaObj sset num Ang Ptdist StartPt EndPt)
    Otherwise I hope that works for you.
    Last edited by SLW210; 23rd Feb 2012 at 10:26 pm. Reason: CODE TAGS!!!

  2. #12
    Super Member DANIEL's Avatar
    Discipline
    Mechanical
    DANIEL's Discipline Details
    Occupation
    Industrial
    Discipline
    Mechanical
    Using
    AutoCAD 2013
    Join Date
    May 2005
    Location
    Arlington Texas
    Posts
    1,005

    Default

    might want to read up on the code posting guidlines jsowinski
    If you would like to help my 2 year old niece Alaina in her battle against Leukemia you can donate blood at any Carter Blood Care and put SPON050875 on the donor form. Thank you so much for any contributions in this matter that you can make.

    Luminous beings are we, not this crude matter.

  3. #13
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    11,733
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  4. #14
    Junior Member
    Using
    Architecture 2013
    Join Date
    Jul 2011
    Posts
    10

    Default

    Thanks for letting me know.

  5. #15
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    AutoCAD 2017
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    158

    Default

    that worked the only thing i was wondering is can we explode the rectangle after it offsets?

  6. #16
    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
    19,322

    Default

    Quick one:

    Code:
    (defun c:MyOffset ( / ent obj )
        (if
            (setq *dist*
                (cond
                    (   (getdist
                            (strcat "\nSpecify Offset Distance"
                                (if *dist* (strcat " <" (rtos *dist*) ">: ") ": ")
                            )
                        )
                    )
                    (   *dist*   )
                )
            )
            (while
                (progn (setvar 'ERRNO 0) (setq ent (car (entsel "\nSelect LWPolyline: ")))
                    (cond
                        (   (= 7 (getvar 'ERRNO))
                            (princ "\nMissed, try again.")
                        )
                        (   (eq 'ENAME (type ent))
                            (cond
                                (   (= 4 (logand 4 (cdr (assoc 70 (tblsearch "LAYER" (cdr (assoc 8 (entget ent))))))))
                                    (princ "\nObject is on Locked Layer.")
                                )
                                (   (eq "LWPOLYLINE" (cdr (assoc 0 (entget ent))))
                                    (foreach obj (vlax-invoke (setq obj (vlax-ename->vla-object ent)) 'explode)
                                        (vla-offset obj *dist*)
                                    )
                                    (vla-delete obj)
                                    t
                                )
                                (   (princ "\nObject is not an LWPolyline.")   )
                            )
                        )
                    )
                )
            )
        )
        (princ)
    )
    (vl-load-com) (princ)
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  7. #17
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    AutoCAD 2017
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    158

    Default

    Thanks, Lee

  8. #18
    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
    19,322

    Default

    No worries, it should work for all LWPolylines, even those with Arc segments.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  9. #19
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    AutoCAD 2017
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    158

    Default

    I need some help, this routine was written by jsowinski i've added a a line to change the layer of rectangle and explode it but it leaves the original rectangle underneath the line new lines. i need the original rectangle to be exploded. any help would be appreciated.

    Code:
     
    (defun c:Offsetpline (/ *error* OffsetDist VlaObj sset num Ang Ptdist StartPt EndPt)
    (vl-load-com)
    (defun *error* (msg)
    (princ)
    ); _end defun
    (setq OffsetDist (getreal "\nEnter an offset distance: "))
    (while (setq VlaObj (vlax-ename->vla-object (car (entsel "Select a Rectangle: "))))
    (setq Startpt (vlax-curve-getPointAtParam VlaObj 1))
    (setq Ang (+ (angle (vlax-curve-getStartPoint VlaObj)(vlax-curve-getPointAtParam VlaObj 1))(* (/ pi 180) 90)))
    (setq PtDist (distance Startpt (vlax-curve-getPointAtParam VlaObj 2)))
    (vlax-put-property vlaobj 'layer "Router - Green-V groove")
    (vl-catch-all-apply 'vlax-invoke-method (list VlaObj 'explode))
    
    (if (equal (polar Startpt Ang PtDist)(vlax-curve-getPointAtParam VlaObj 2) 1.0)
    (vl-catch-all-apply 'vlax-invoke-method (list VlaObj 'Offset OffsetDist))
    (vl-catch-all-apply 'vlax-invoke-method (list VlaObj 'Offset (- OffsetDist)))
    ); _end if
    
    (setq VlaObj (vlax-ename->vla-object (entlast)))
    (vl-catch-all-apply 'vlax-put (list VlaObj 'Layer "Router - Blue - Cuts"))
    (vl-cmdf "explode" (entlast))
    (setq sset (ssget "_P"))
    (setq num -1)
    (repeat (sslength sset)
    (setq VlaObj (vlax-ename->vla-object (ssname sset (setq num (1+ num)))))
    (setq StartPt (polar (vlax-get VlaObj 'StartPoint)(vlax-get VlaObj 'Angle) OffsetDist))
    (vl-catch-all-apply 'vlax-put (list VlaObj 'StartPoint StartPt))
    (setq EndPt (polar (vlax-get VlaObj 'EndPoint)(- (vlax-get VlaObj 'Angle) pi) OffsetDist))
    (vl-catch-all-apply 'vlax-put (list VlaObj 'EndPoint EndPt))
    ); _end repeat
    ); _end while
    (princ)
    ); _end defun

  10. #20
    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
    19,322

    Default

    Registered forum members do not see this ad.

    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

Similar Threads

  1. Trimming Lines within a rectangle
    By Sundar in forum .NET, ObjectARX & VBA
    Replies: 20
    Last Post: 20th Jan 2012, 05:19 am
  2. finding distance between offset lines
    By fisher22 in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 6th Jul 2011, 06:40 pm
  3. automatic offset lines?
    By stephenward in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 10
    Last Post: 28th Jul 2009, 11:07 am
  4. offset 2 lines add dimensions and tag
    By gazzalp in forum AutoLISP, Visual LISP & DCL
    Replies: 15
    Last Post: 18th Dec 2008, 12:35 pm
  5. How to separate text into individual lines?
    By Chris333 in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 29th Oct 2007, 01:14 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