+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15
  1. #11
    Forum Deity
    Using
    AutoCAD 2002
    Join Date
    Sep 2006
    Location
    East Sussex, U.K.
    Posts
    4,039

    Default

    Registered forum members do not see this ad.

    If you run Overkill first, then Extrim will work. But it will only trim the lines crossing the rectangle. It will not delete everything outside.

  2. #12
    Senior Member
    Computer Details
    ttray33y's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T3500
    CPU:
    XEON W3503
    RAM:
    16GB
    Graphics:
    Quadro 2000
    Primary Storage:
    1TB
    Monitor:
    Dell 21" LED (DUAL)
    Discipline
    P&ID
    ttray33y's Discipline Details
    Occupation
    Process & Instrumentation Designer
    Discipline
    P&ID
    Details
    Design and check process diagram for consistency in accordance to PIP and company standard
    Using
    P&ID 2014
    Join Date
    Jun 2013
    Location
    Inside my head.
    Posts
    123

    Default

    Quote Originally Posted by eldon View Post
    If you run Overkill first, then Extrim will work. But it will only trim the lines crossing the rectangle. It will not delete everything outside.
    of course it will, but he will need to edit the system variable Peditaccept to 0 then run overkill.
    writing some noob code for him right now.

    edit:

    No need for code , just.
    1. change the peditaccept value to 0
    2. user Overkill command, select all (in my case, just to clean the entire drawing)
    3. properly place your rectangle because it seems that there are 2 of them in the drawing. join them perhaps.
    4. Use EXTRIM command.
    5. Some clean-up
    6. Done.

  3. #13
    Forum Deity
    Using
    AutoCAD 2002
    Join Date
    Sep 2006
    Location
    East Sussex, U.K.
    Posts
    4,039

    Default

    Quote Originally Posted by ttray33y View Post
    ...... but he will need to edit the system variable Peditaccept to 0 then run overkill.
    I have not got the system variable Peditaccept, and Overkill ran perfectly on the existing polylines.

    But don't let me stop you in your kindly lisp.

  4. #14
    Super Member
    Computer Details
    tombu's Computer Details
    Operating System:
    Windows 7 64-bit
    Computer:
    Dell
    Discipline
    Civil
    tombu's Discipline Details
    Occupation
    Design Analyst
    Discipline
    Civil
    Details
    Small Street & Stormwater projects. Traffic Calming and other issues.
    Using
    Civil 3D 2018
    Join Date
    Dec 2010
    Location
    Tallahassee, FL USA
    Posts
    717

    Default

    I used SSX to select all objects on the layer "SURVEY NO BOUNDARY". As long as "Optimize segments within polylines" is checked Overkill will fix the existing polylines. As Eldon said "If you run Overkill first, then Extrim will work. But it will only trim the lines crossing the rectangle." It's a routine for trimming not erasing. I use EraseOutsideBoundary to both trim & erase outside:
    Code:
     ;| Function to trim objects inside selected boundaries (allows for multiple boundaries)
        Boundaries can be "Circle, Ellipse, LWPolyline and Polyline" Entities
        Written By: Peter Jamtgaard Copyright 2015 All Rights Reserved
        ^C^C^P(or C:BoundaryTrim (load "BoundaryTrim.lsp"));BoundaryTrim
        EraseOutsideBoundary added by Tom Beauford
        ^C^C^P(or C:EraseOutsideBoundary (load "BoundaryTrim.lsp"));EraseOutsideBoundary
    ==============================================================================|;
    ;(defun C:BT ()(c:BoundaryTrim))
    (defun C:BoundaryTrim (/ acDoc intCount ssBoundaries)
        (if (setq ssBoundaries    (ssget (list (cons 0 "Circle,Ellipse,LWPolyline,Polyline"))))
          (progn
    	  (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))))
    	  (repeat (setq intCount (sslength ssBoundaries))
    	   (setq intCount     (1- intCount))
    	   (BoundaryTrim        (ssname ssBoundaries intCount))
    	   (BoundaryWindowErase (ssname ssBoundaries intCount)); <-Erase objects inside boundary optional
    	  )
          )
        )
      (if	acDoc (vla-endundomark acDoc))
    )
    
    ; Command line function to select objects that are windowed by a selected circle.
    (defun C:BoundarySelect (/ lstPoints objBoundary ssBoundary)
      (if (and
    	(setq ssBoundary  (ssget ":E:S" (list (cons 0 "Circle,Ellipse,LWPolyline,Polyline"))))
    	(setq objBoundary (vlax-ename->vla-object (ssname ssBoundary 0)))
    	(setq lstPoints   (SegmentPoints objBoundary 360))
           )
        (and
         (setq ssSelections (ssget "_WP" lstPoints))
        )
      )
    )
    
    ; Function to trim linework inside a boundary entity
    (defun BoundaryTrim (entBoundary1 / lstPoints entBoundary1 entBoundary2 lstCenter
                         lstPoints1 lstPoints2 objBoundary1 objBoundary2 ssBoundary *Error*)
      (defun *Error* ()
        (setvar "cmdecho" intCMDEcho)
      )
      (setq intCMDEcho (getvar "cmdecho"))
      (setvar "cmdecho" 0)
      (if (and
    	(setq objBoundary1  (vlax-ename->vla-object entBoundary1))
    	(setq lstPoints1    (SegmentPoints objBoundary1 360))
    	(setq lstCenter     (mapcar '(lambda (X)(/ (apply '+ X) (length lstPoints1)))(transposematrix lstPoints1)))
    	(vl-cmdf "offset"   (/ (distance (car lstPoints1) lstCenter) 36.0) entBoundary1 lstCenter "")
    	(setq entBoundary2  (entlast))
    	(setq objBoundary2  (vlax-ename->vla-object entBoundary2))
    	(setq lstPoints2   (SegmentPoints objBoundary2 360))
           )
        (progn
         (vl-cmdf "trim" entBoundary1 "" "f")
         (foreach lstPoint lstPoints2 (vl-cmdf lstPoint))
         (vl-cmdf "" "")
         (entdel entBoundary2)
         (vl-cmdf "redraw")
         (setvar "cmdecho" intCMDEcho)
        )
      )
    )
    
    ; Function to trim linework outside a boundary entity
    (defun TrimOutsideBoundary (entBoundary1 / lstPoints entBoundary1 entBoundary2 lstCenter
                         maxpt lstPoints1 lstPoints2 objBoundary1 objBoundary2 ssBoundary *Error*)
      (defun *Error* ()
        (setvar "cmdecho" intCMDEcho)
      )
      (setq intCMDEcho (getvar "cmdecho"))
      (setvar "cmdecho" 0)
      (if (and
    	(setq objBoundary1  (vlax-ename->vla-object entBoundary1))
    	(setq lstPoints1    (SegmentPoints objBoundary1 360))
    	(setq lstCenter     (mapcar '(lambda (X)(/ (apply '+ X) (length lstPoints1)))(transposematrix lstPoints1)))
    	(setq maxpt (list (1+ (car (getvar 'extmax)))(1+ (cadr (getvar 'extmax)))(1+ (caddr (getvar 'extmax)))))
    	(vl-cmdf "offset"   (/ (distance (car lstPoints1) lstCenter) 200.0) entBoundary1 maxpt "")
    	(setq entBoundary2  (entlast))
    	(setq objBoundary2  (vlax-ename->vla-object entBoundary2))
    	(setq lstPoints2   (SegmentPoints objBoundary2 360))
           )
        (progn
         (vl-cmdf "trim" entBoundary1 "" "f")
         (foreach lstPoint lstPoints2 (vl-cmdf lstPoint))
         (vl-cmdf "" "")
         (entdel entBoundary2)
         (vl-cmdf "redraw")
         (setvar "cmdecho" intCMDEcho)
        )
      )
    )
    
    ; Function to erase linework inside a boundary entity
    (defun BoundaryWindowErase (entBoundary / lstPoints objBoundary ssSelections)
      (if (and
    	(setq objBoundary  (vlax-ename->vla-object entBoundary))
    	(setq lstPoints    (SegmentPoints objBoundary 360))
    	(setq ssSelections (ssget "_WP" lstPoints))
           )
        (and
         (setq ssSelections (ssget "_WP" lstPoints))
         (vl-cmdf "erase" ssSelections "")
        )
      )
    )
    
    ; Function to determine the points along a curve dividing it intSegments number of times
    (defun SegmentPoints (objCurve intSegments /  sngSegment intCount lstPoint lstPoints sngLength sngSegment)
      (if (and
    	(setq sngLength   (vlax-curve-getdistatparam objCurve (vlax-curve-getendparam objCurve)))
    	(setq sngSegment  (/ sngLength intSegments))
    	(setq intCount    0)
           )
        (progn
         (repeat (1+ intSegments)
          (setq lstPoint   (vlax-curve-getpointatdist objCurve (* intCount sngSegment)))
          (setq lstPoints  (cons lstPoint lstPoints))
          (setq intCount   (1+ intCount))
         )
         lstPoints
        )
      )
    )
    
    ; Function to Transpose a matrix
    (defun TransposeMatrix (lstMatrix)
      (if (car lstMatrix)
        (cons (mapcar 'car lstMatrix)
    	  (TransposeMatrix (mapcar 'cdr lstMatrix))
       )
      )
    )
    
    ; Function to erase linework outside a boundary entity
    (defun C:EraseOutsideBoundary ( / ss1 n ssBoundary objBoundary lstPoints ssSelections entSelection)
      (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))))
      (setq ss1 (ssget "_X" '((67 . 0)))  n   -1)
      (if (and
    	(setq ssBoundary  (ssget ":E:S" (list (cons 0 "Circle,Ellipse,LWPolyline,Polyline"))))
    	(setq entBoundary  (ssname ssBoundary 0))
    	(ssdel entBoundary ss1)
    	(TrimOutsideBoundary entBoundary)
    	(setq objBoundary (vlax-ename->vla-object entBoundary))
    	(setq lstPoints   (SegmentPoints objBoundary 360))
           )
        (and
         (setq ssSelections (ssget "_CP" lstPoints))
         (repeat (sslength ssSelections)
           (setq entSelection (ssname ssSelections (setq n (1+ n))))
           (if(ssmemb entSelection ssSelections)(ssdel entSelection ss1))
         )
         (command "erase" ss1 "")
        )
      )
      (if	acDoc (vla-endundomark acDoc))
    )
    Last edited by tombu; 11th Jun 2015 at 12:27 pm. Reason: Specified "EraseOutsideBoundary" as function

  5. #15
    Senior Member
    Computer Details
    VVA's Computer Details
    Operating System:
    Windows 7
    CPU:
    Intel Core i5-2400
    RAM:
    8 Gb
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    Seagate 500 GB + WD 750 GB
    Monitor:
    Philips 27"
    Using
    AutoCAD 2013
    Join Date
    Dec 2006
    Location
    Minsk, Belarus
    Posts
    447

    Default

    Registered forum members do not see this ad.


Similar Threads

  1. replace an object (rectangle) with a named block and keep the hyperlink
    By Jaap Marchal in forum AutoLISP, Visual LISP & DCL
    Replies: 18
    Last Post: 15th Mar 2017, 05:17 pm
  2. How do you trim a 3d object at a 45 Degree angle?
    By dlggnation in forum AutoCAD 3D Modelling & Rendering
    Replies: 13
    Last Post: 6th Jul 2015, 01:11 am
  3. Draw temporary object (Rectangle)
    By Luís Augusto in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 6th Aug 2013, 03:45 am
  4. Rectangle around an object
    By glazier in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 2
    Last Post: 10th Apr 2012, 11:11 am
  5. How to trim a Loft object?
    By dreamer in forum AutoCAD 3D Modelling & Rendering
    Replies: 5
    Last Post: 10th Jul 2010, 03:55 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