Jump to content

Is it possible to touch 2 or 3 points of a poly with more than 30 vertices, and have it draw a poly on top of the original poly?


duke

Recommended Posts

Hello, I'm going to explain myself.
I am attaching an image for easy reference.
The idea may be the one I give or something similar.
What I think is, touch 2 or 3 points as seen at the top of the image I attached, and that the routine will be able to create a new poly, but only from that yellow section, as shown in the part of below the attached image.
Thanks in advance for the help !!

aaaaaaaaaaaaaaaaaa.jpg

Link to comment
Share on other sites

Whipped this up real quick. but it has two problems, well I guess 3 but could be fixed easily enough. but its the weekend.

  • depending on if the polyline is clockwise or counter clockwise direction the start and end points could be reversed.
  • if the polyline has arcs would need to add a bulge function
  • if the polyline vertex 0 is inbetween points picked will draw the inverse (not the green but the purple section)
  • entsel could be a problem to in that you can select anything.
;;----------------------------------------------------------------------------;;
;; Draw Poly Segments between points picked on an existing polyline
(defun C:PS (/ pline pt1 pt2 spt ept cords ptlist i s end)
  (vl-load-com)
  (if (setq pline (car (entsel "\nPick Polyline:")) ;get entity name of polyline
            pt1 (getpoint "\nSelect start point: ") ;get point on polyline works best with nearest
            pt2 (getpoint "\nSelect end point: ")   ;same as above
      )
      (progn
        (setq cords (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget pline)))) ;Extracts the coordinates of the vertices of the selected polyline into a list
        (setq spt (1+ (fix (vlax-curve-getParamAtPoint Pline (vlax-curve-getClosestPointTo Pline pt1))))) ;finds the closet vertex number to pt1
        (setq ept (1+ (fix (vlax-curve-getParamAtPoint pline (vlax-curve-getClosestPointTo Pline pt2))))) ;same for pt2
        (if (< spt ept)  ;checks to see witch is bigger #
          (setq s spt end ept spt pt1 ept pt2) ;if spt is smaller then ept sets Everything they way it would work 
          (setq s ept end spt spt pt2 ept pt1) ;if spt is larger then ept revises the order so its still draw correctly
        )
        (setq ptlist (cons spt ptlist)) ;adds spt to a list
        (setq i s) ;sets i to the lower value of spt or ept
        (while (< i end) ;loops until i isn't less then end
          (setq ptlist (cons (nth i cords) ptlist)) ;keeps adding poitns to the list until while loops ends
          (setq i (1+ i)) ;used to step to the next point
        )
        (setq ptlist (cons ept ptlist)) ;adds the last point to the list
        (setq ptlist (reverse ptlist)) ;list is in revirse order so reverse it
        (entmake ;make a polyline with new ptlist
          (append 
            (list '(0 . "LWPOLYLINE")
                  '(100 . "AcDbEntity")
                  '(100 . "AcDbPolyline")
                   (cons 90 (length ptlist))
                  '(70 . 0)
            )
            (mapcar (function (lambda (p) (cons 10 p))) ptlist)
          )
        )
      )
      (prompt "Try again") ;if pline pt1 or pt2 isn't set will prompt user to try again
  )
  (princ)
)

 

--Edit

 

Edited by mhupp
Put comments in the code
  • Like 1
Link to comment
Share on other sites

1 hour ago, mhupp said:

Whipped this up real quick. but it has two problems, well I guess 3 but could be fixed easily enough. but its the weekend.

  • depending on if the polyline is clockwise or counter clockwise direction the start and end points could be reversed.
  • if the polyline has arcs would need to add a bulge function
  • if the polyline vertex 0 is inbetween points picked will draw the inverse (not the green but the purple section)
  • entsel could be a problem to in that you can select anything.
;;----------------------------------------------------------------------------;;
;; Draw Poly Segments between points picked on an existing polyline
(defun C:PolySegment (/ pline pt1 pt2 spt ept cords ptlist i)
  (vl-load-com)
  (if (setq pline (car (entsel "\nPick Polyline:"))
            pt1 (getpoint "\nSelect start point: ")
            pt2 (getpoint "\nSelect end point: ")
      )
      (progn
        (setq cords (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget pline))))
        (setq spt (1+ (fix (vlax-curve-getParamAtPoint Pline (vlax-curve-getClosestPointTo Pline pt1)))))
        (setq ept (1+ (fix (vlax-curve-getParamAtPoint pline (vlax-curve-getClosestPointTo Pline pt2)))))
        (setq ptlist (cons pt1 ptlist))
        (setq i spt)
        (while (< i ept)
          (setq ptlist (cons (nth i cords) ptlist))
          (setq i (1+ i))
        )
        (setq ptlist (cons pt2 ptlist))
        (setq ptlist (reverse ptlist))
        (entmake 
          (append 
            (list '(0 . "LWPOLYLINE")
                  '(100 . "AcDbEntity")
                  '(100 . "AcDbPolyline")
                   (cons 90 (length ptlist))
                  '(70 . 0)
            )
            (mapcar (function (lambda (p) (cons 10 p))) ptlist)
          )
        )
      )
      (prompt "\nTry Again")
  )
  (princ)
)

 

THANKSSSSSSSSSSSSSSSSSSS !!!!!
Absolutely GREAT!!!!
You deserve heaven my friend!!
Total perfection, just what I needed!!

Link to comment
Share on other sites

I've got something similar that trims a polyline between points, will find it out next week

  • Like 2
Link to comment
Share on other sites

Like Steven I would copy the pline say to right then trim ends, change layer etc, then move back so no problems with arcs in pline.

  • Like 2
Link to comment
Share on other sites

 

Try this 'test':

 

 

(defun LSTrimToPt ( MyLine TrimPt1 TrimPt2 / MyLineDef MyLineEndA MyLineEndB Pt1Dist Pt2Dist TempPt MyLineA MyLineB currentzoom)

  (defun LSZmObj  (ss / Minp Maxp lst) ; zooms to an object +area around the end points
    (foreach Obj  (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
      (vla-getBoundingBox Obj 'Minp 'Maxp)
      (setq lst (cons (mapcar 'vlax-safearray->list (list Minp Maxp)) lst)))
      (vla-ZoomWindow (vlax-get-acad-object)
      (vlax-3D-point (list (apply 'min (mapcar 'car (mapcar 'car lst))) (apply 'min (mapcar 'cadr (mapcar 'car lst)))  0.0))
      (vlax-3D-point (list (apply 'max (mapcar 'car (mapcar 'cadr lst)))(apply 'max (mapcar 'cadr (mapcar 'cadr lst))) 0.0))
    )
  )


  (setq currentzoom (list (getvar 'viewctr) (getvar 'viewsize)))    ;; record the current zoom
  (LSZmObj (ssadd MyLine))                                          ;; Zoom to show the full line
  (vla-ZoomScaled (vlax-get-acad-object) 0.95 acZoomScaledRelative) ;; Zoom out a bit
  (setq MyLineDef (entget MyLine))                                  ;; Get polyline entity definition
  (setq MyLineEndA (cdr (assoc 10 MyLineDef)))                      ;; Get the points of the line
  (if (= (cdr (assoc 0 MyLineDef)) "LINE")                          ;; Get end points of line / polyline
    (setq MyLineEndB (cdr (assoc 11 MyLineDef)))
    (setq MyLineEndB (cdr (assoc 10 (reverse MyLineDef))))
  )

;;sort trimpts according to distance from end A
  (setq Pt1Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt1) )
  (setq Pt2Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt2) )

  (if ( > Pt1Dist Pt2Dist) ; swap trim points over
    (progn
      (setq TempPt TrimPt1)
      (setq TrimPt1 TrimPt2)
      (setq TrimPt2 TempPt)
    ) ;end progn
    ()
  ) ;end if

  (command "breakatpoint" MyLine TrimPt1)  ;;"Too many objects for INTERSECT"
  (setq MyLineA (entlast))

  (if (equal MyLineA MyLine 0.0001)
    (progn ; if end A is trim point
      (command "breakatpoint" MyLine TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLine 0.0001) ; if end B is trim point
        ()
        (entdel MyLineB)
      )
    )
    (progn
      (entdel MyLine)
      (command "breakatpoint" MyLineA TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLineA 0.0001) ; if end B is trim point
        (progn
        )
        (progn
          (entdel MyLineB)
        )
      )
    )
  ) ; end if

  (vla-ZoomCenter (vlax-get-acad-object) (vlax-3d-point (car currentzoom)) (cadr currentzoom))
  MyLineA
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:test ( / Route TrimmedRoute PtA PtB)
  (setq Route (car (entsel "Select Line / PolyLine")))
  (setq PtA (getpoint "Select trim point 1"))
  (setq PtB (getpoint "Select trim point 2"))
  (setq TrimmedRoute (entmakex (entget Route))) ; Copy route
  (setq TrimmedRoute (LSTrimToPt TrimmedRoute PtA PtB))
)

 

Link to comment
Share on other sites

3 hours ago, Steven P said:

 

Try this 'test':

 

 

(defun LSTrimToPt ( MyLine TrimPt1 TrimPt2 / MyLineDef MyLineEndA MyLineEndB Pt1Dist Pt2Dist TempPt MyLineA MyLineB currentzoom)

  (defun LSZmObj  (ss / Minp Maxp lst) ; zooms to an object +area around the end points
    (foreach Obj  (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
      (vla-getBoundingBox Obj 'Minp 'Maxp)
      (setq lst (cons (mapcar 'vlax-safearray->list (list Minp Maxp)) lst)))
      (vla-ZoomWindow (vlax-get-acad-object)
      (vlax-3D-point (list (apply 'min (mapcar 'car (mapcar 'car lst))) (apply 'min (mapcar 'cadr (mapcar 'car lst)))  0.0))
      (vlax-3D-point (list (apply 'max (mapcar 'car (mapcar 'cadr lst)))(apply 'max (mapcar 'cadr (mapcar 'cadr lst))) 0.0))
    )
  )


  (setq currentzoom (list (getvar 'viewctr) (getvar 'viewsize)))    ;; record the current zoom
  (LSZmObj (ssadd MyLine))                                          ;; Zoom to show the full line
  (vla-ZoomScaled (vlax-get-acad-object) 0.95 acZoomScaledRelative) ;; Zoom out a bit
  (setq MyLineDef (entget MyLine))                                  ;; Get polyline entity definition
  (setq MyLineEndA (cdr (assoc 10 MyLineDef)))                      ;; Get the points of the line
  (if (= (cdr (assoc 0 MyLineDef)) "LINE")                          ;; Get end points of line / polyline
    (setq MyLineEndB (cdr (assoc 11 MyLineDef)))
    (setq MyLineEndB (cdr (assoc 10 (reverse MyLineDef))))
  )

;;sort trimpts according to distance from end A
  (setq Pt1Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt1) )
  (setq Pt2Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt2) )

  (if ( > Pt1Dist Pt2Dist) ; swap trim points over
    (progn
      (setq TempPt TrimPt1)
      (setq TrimPt1 TrimPt2)
      (setq TrimPt2 TempPt)
    ) ;end progn
    ()
  ) ;end if

  (command "breakatpoint" MyLine TrimPt1)  ;;"Too many objects for INTERSECT"
  (setq MyLineA (entlast))

  (if (equal MyLineA MyLine 0.0001)
    (progn ; if end A is trim point
      (command "breakatpoint" MyLine TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLine 0.0001) ; if end B is trim point
        ()
        (entdel MyLineB)
      )
    )
    (progn
      (entdel MyLine)
      (command "breakatpoint" MyLineA TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLineA 0.0001) ; if end B is trim point
        (progn
        )
        (progn
          (entdel MyLineB)
        )
      )
    )
  ) ; end if

  (vla-ZoomCenter (vlax-get-acad-object) (vlax-3d-point (car currentzoom)) (cadr currentzoom))
  MyLineA
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:test ( / Route TrimmedRoute PtA PtB)
  (setq Route (car (entsel "Select Line / PolyLine")))
  (setq PtA (getpoint "Select trim point 1"))
  (setq PtB (getpoint "Select trim point 2"))
  (setq TrimmedRoute (entmakex (entget Route))) ; Copy route
  (setq TrimmedRoute (LSTrimToPt TrimmedRoute PtA PtB))
)

 

hi bro thanks, i will go to test
thanks for your hard work !!!

Link to comment
Share on other sites

3 hours ago, Steven P said:

 

Try this 'test':

 

 

(defun LSTrimToPt ( MyLine TrimPt1 TrimPt2 / MyLineDef MyLineEndA MyLineEndB Pt1Dist Pt2Dist TempPt MyLineA MyLineB currentzoom)

  (defun LSZmObj  (ss / Minp Maxp lst) ; zooms to an object +area around the end points
    (foreach Obj  (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
      (vla-getBoundingBox Obj 'Minp 'Maxp)
      (setq lst (cons (mapcar 'vlax-safearray->list (list Minp Maxp)) lst)))
      (vla-ZoomWindow (vlax-get-acad-object)
      (vlax-3D-point (list (apply 'min (mapcar 'car (mapcar 'car lst))) (apply 'min (mapcar 'cadr (mapcar 'car lst)))  0.0))
      (vlax-3D-point (list (apply 'max (mapcar 'car (mapcar 'cadr lst)))(apply 'max (mapcar 'cadr (mapcar 'cadr lst))) 0.0))
    )
  )


  (setq currentzoom (list (getvar 'viewctr) (getvar 'viewsize)))    ;; record the current zoom
  (LSZmObj (ssadd MyLine))                                          ;; Zoom to show the full line
  (vla-ZoomScaled (vlax-get-acad-object) 0.95 acZoomScaledRelative) ;; Zoom out a bit
  (setq MyLineDef (entget MyLine))                                  ;; Get polyline entity definition
  (setq MyLineEndA (cdr (assoc 10 MyLineDef)))                      ;; Get the points of the line
  (if (= (cdr (assoc 0 MyLineDef)) "LINE")                          ;; Get end points of line / polyline
    (setq MyLineEndB (cdr (assoc 11 MyLineDef)))
    (setq MyLineEndB (cdr (assoc 10 (reverse MyLineDef))))
  )

;;sort trimpts according to distance from end A
  (setq Pt1Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt1) )
  (setq Pt2Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt2) )

  (if ( > Pt1Dist Pt2Dist) ; swap trim points over
    (progn
      (setq TempPt TrimPt1)
      (setq TrimPt1 TrimPt2)
      (setq TrimPt2 TempPt)
    ) ;end progn
    ()
  ) ;end if

  (command "breakatpoint" MyLine TrimPt1)  ;;"Too many objects for INTERSECT"
  (setq MyLineA (entlast))

  (if (equal MyLineA MyLine 0.0001)
    (progn ; if end A is trim point
      (command "breakatpoint" MyLine TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLine 0.0001) ; if end B is trim point
        ()
        (entdel MyLineB)
      )
    )
    (progn
      (entdel MyLine)
      (command "breakatpoint" MyLineA TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLineA 0.0001) ; if end B is trim point
        (progn
        )
        (progn
          (entdel MyLineB)
        )
      )
    )
  ) ; end if

  (vla-ZoomCenter (vlax-get-acad-object) (vlax-3d-point (car currentzoom)) (cadr currentzoom))
  MyLineA
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:test ( / Route TrimmedRoute PtA PtB)
  (setq Route (car (entsel "Select Line / PolyLine")))
  (setq PtA (getpoint "Select trim point 1"))
  (setq PtB (getpoint "Select trim point 2"))
  (setq TrimmedRoute (entmakex (entget Route))) ; Copy route
  (setq TrimmedRoute (LSTrimToPt TrimmedRoute PtA PtB))
)

 

Command: Unknown command "BREAKATPOINT".  Press F1 for help.
<Entity name: 334C7530>
What is the error?
i use Autocad 2020
(command "breakatpoint" MyLine TrimPt2)
 

Link to comment
Share on other sites

On 4/26/2024 at 8:22 PM, mhupp said:

Whipped this up real quick. but it has two problems, well I guess 3 but could be fixed easily enough. but its the weekend.

  • depending on if the polyline is clockwise or counter clockwise direction the start and end points could be reversed.
  • if the polyline has arcs would need to add a bulge function
  • if the polyline vertex 0 is inbetween points picked will draw the inverse (not the green but the purple section)
  • entsel could be a problem to in that you can select anything.
;;----------------------------------------------------------------------------;;
;; Draw Poly Segments between points picked on an existing polyline
(defun C:PS (/ pline pt1 pt2 spt ept cords ptlist i s end)
  (vl-load-com)
  (if (setq pline (car (entsel "\nPick Polyline:")) ;get entity name of polyline
            pt1 (getpoint "\nSelect start point: ") ;get point on polyline works best with nearest
            pt2 (getpoint "\nSelect end point: ")   ;same as above
      )
      (progn
        (setq cords (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget pline)))) ;Extracts the coordinates of the vertices of the selected polyline into a list
        (setq spt (1+ (fix (vlax-curve-getParamAtPoint Pline (vlax-curve-getClosestPointTo Pline pt1))))) ;finds the closet vertex number to pt1
        (setq ept (1+ (fix (vlax-curve-getParamAtPoint pline (vlax-curve-getClosestPointTo Pline pt2))))) ;same for pt2
        (if (< spt ept)  ;checks to see witch is bigger #
          (setq s spt end ept spt pt1 ept pt2) ;if spt is smaller then ept sets Everything they way it would work 
          (setq s ept end spt spt pt2 ept pt1) ;if spt is larger then ept revises the order so its still draw correctly
        )
        (setq ptlist (cons spt ptlist)) ;adds spt to a list
        (setq i s) ;sets i to the lower value of spt or ept
        (while (< i end) ;loops until i isn't less then end
          (setq ptlist (cons (nth i cords) ptlist)) ;keeps adding poitns to the list until while loops ends
          (setq i (1+ i)) ;used to step to the next point
        )
        (setq ptlist (cons ept ptlist)) ;adds the last point to the list
        (setq ptlist (reverse ptlist)) ;list is in revirse order so reverse it
        (entmake ;make a polyline with new ptlist
          (append 
            (list '(0 . "LWPOLYLINE")
                  '(100 . "AcDbEntity")
                  '(100 . "AcDbPolyline")
                   (cons 90 (length ptlist))
                  '(70 . 0)
            )
            (mapcar (function (lambda (p) (cons 10 p))) ptlist)
          )
        )
      )
      (prompt "Try again") ;if pline pt1 or pt2 isn't set will prompt user to try again
  )
  (princ)
)

 

--Edit

 

Hello friend, I have detected that when creating the new poly, at one of the 2 ends, it creates 2 points in the same place, and it does not allow me to extend the poly, so I must exploit the poly, paste it again, and so I can extend it.
Do you think that has a solution?
Thanks my friend !!

Link to comment
Share on other sites

Breakatpoint might have been added as a standard comment in AutoCAD 2022 - it was an express tool before then, though there are LISPs out there going way back that do the same thing - I'll see if I can think of a simple fix

Link to comment
Share on other sites

2 minutes ago, Steven P said:

Breakatpoint might have been added as a standard comment in AutoCAD 2022 - it was an express tool before then, though there are LISPs out there going way back that do the same thing - I'll see if I can think of a simple fix

Thank you Steven!!!!
I'll look forward to it !!!
Very kind!!

Link to comment
Share on other sites

4 hours ago, duke said:

Thank you Steven!!!!
I'll look forward to it !!!
Very kind!!

 

Try this:

 

(defun LSTrimToPt ( MyLine TrimPt1 TrimPt2 / MyLineDef MyLineEndA MyLineEndB Pt1Dist Pt2Dist TempPt MyLineA MyLineB currentzoom)

  (defun breakatpoint (MyEnt point /)
    (command "_.break" MyEnt "_non" point "_non" point)
  )

  (defun LSZmObj  (ss / Minp Maxp lst) ; zooms to an object +area around the end points
    (foreach Obj  (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
      (vla-getBoundingBox Obj 'Minp 'Maxp)
      (setq lst (cons (mapcar 'vlax-safearray->list (list Minp Maxp)) lst)))
      (vla-ZoomWindow (vlax-get-acad-object)
      (vlax-3D-point (list (apply 'min (mapcar 'car (mapcar 'car lst))) (apply 'min (mapcar 'cadr (mapcar 'car lst)))  0.0))
      (vlax-3D-point (list (apply 'max (mapcar 'car (mapcar 'cadr lst)))(apply 'max (mapcar 'cadr (mapcar 'cadr lst))) 0.0))
    )
  )


  (setq currentzoom (list (getvar 'viewctr) (getvar 'viewsize)))    ;; record the current zoom
  (LSZmObj (ssadd MyLine))                                          ;; Zoom to show the full line
  (vla-ZoomScaled (vlax-get-acad-object) 0.95 acZoomScaledRelative) ;; Zoom out a bit
  (setq MyLineDef (entget MyLine))                                  ;; Get polyline entity definition
  (setq MyLineEndA (cdr (assoc 10 MyLineDef)))                      ;; Get the points of the line
  (if (= (cdr (assoc 0 MyLineDef)) "LINE")                          ;; Get end points of line / polyline
    (setq MyLineEndB (cdr (assoc 11 MyLineDef)))
    (setq MyLineEndB (cdr (assoc 10 (reverse MyLineDef))))
  )

;;sort trimpts according to distance from end A
  (setq Pt1Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt1) )
  (setq Pt2Dist (vlax-curve-getdistatpoint (vlax-ename->vla-object MyLine) TrimPt2) )

  (if ( > Pt1Dist Pt2Dist) ; swap trim points over
    (progn
      (setq TempPt TrimPt1)
      (setq TrimPt1 TrimPt2)
      (setq TrimPt2 TempPt)
    ) ;end progn
    ()
  ) ;end if

  (breakatpoint MyLine TrimPt1)  ;;"Too many objects for INTERSECT"
  (setq MyLineA (entlast))

  (if (equal MyLineA MyLine 0.0001)
    (progn ; if end A is trim point
      (breakatpoint MyLine TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLine 0.0001) ; if end B is trim point
        ()
        (entdel MyLineB)
      )
    )
    (progn
      (entdel MyLine)
      (breakatpoint MyLineA TrimPt2)  ;;"Too many objects for INTERSECT"
      (setq MyLineB (entlast))
      (if (equal MyLineB MyLineA 0.0001) ; if end B is trim point
        (progn
        )
        (progn
          (entdel MyLineB)
        )
      )
    )
  ) ; end if

  (vla-ZoomCenter (vlax-get-acad-object) (vlax-3d-point (car currentzoom)) (cadr currentzoom))
  MyLineA
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:test ( / Route TrimmedRoute PtA PtB)
  (setq Route (car (entsel "Select Line / PolyLine")))
  (setq PtA (getpoint "Select trim point 1"))
  (setq PtB (getpoint "Select trim point 2"))
  (setq TrimmedRoute (entmakex (entget Route))) ; Copy route
  (setq TrimmedRoute (LSTrimToPt TrimmedRoute PtA PtB))
)

 

 

 

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...