LISP Routine for breaking polylines where I click.

marcus_bogner
Observer
Observer

LISP Routine for breaking polylines where I click.

marcus_bogner
Observer
Observer

Afternoon,

 

I've been trying to look for or create a LISP Routine that'll go and break a polyline at either a specific point on a polyline that isn't closed, or to go and select two points on a closed polyline to go and leaving me the original polyline and a new polyline that was cut out of the original. I need it to be able to go and be able let me click at endpoints, mid-points or anywhere along the polyline where I need it to be. I've been using the code provided below as a reference. The issue I have with it, is that when the polyline is closed, it wants to go and break the polyline at the point I clicked it at and make that new polyline go back to the first vertex. If y'all have the solution, I would appreciate the help.

 

(defun c:breakpoint (/ object points) ;Breaks object at points;
(setq object (entsel)) ;Set the first variable;
(princ "Specify Break Point: ") ;Set the request that you want on screen;
(setq point (getpoint)) ;Set the second variable;
(command "_break" object "f" point point)) ;insert the command that you are working with;

Reply
556 Views
6 Replies
Replies (6)

pendean
Community Legend
Community Legend

@marcus_bogner wrote:

....If y'all have the solution, I would appreciate the help.

 

(defun c:breakpoint...


Unless you are running a very old year-version of C3D, there is a command for that:

https://help.autodesk.com/view/ACD/2021/ENU/?guid=GUID-E0439DE0-B2C3-4233-BB4D-5A574A00694B

pendean_0-1719945111778.png

 

https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-E0439DE0-B2C3-4233-BB4D-5A574A00694B 

pendean_1-1719945134480.png

 

0 Likes

marcus_bogner
Observer
Observer

I use 2019 civil 3d.

0 Likes

NateSarles
Advocate
Advocate

I do not have 2019 so I cannot confirm that the options listed here work. But there seems to be a possible solution in the forum post here: 

https://forums.autodesk.com/t5/autocad-forum/quot-break-at-point-quot-command-shortcut/m-p/8085887#M... 

C3D 2022
Experienced Civil Site Designer/Drafter
Windows 11, 64 GB RAM
13th Gen Intel(R) Core(TM) i7-13850HX
0 Likes

pendean
Community Legend
Community Legend

@marcus_bogner wrote:

I use 2019 civil 3d.


Have you had a chance to test what is available yet? From this post for example

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/special-polyline-break-only-at-the-p...

 

or just something like

(defun C:BreakAtPoint()
    (command "._break" "f" "@")
);end
0 Likes

lim.wendy
Community Manager
Community Manager

Hi Marcus,

Welcome to the forum!

Here are a few suggestions from our experts that might help:

Forum Solutions: As @NateSarles mentioned, a possible solution is discussed here.

Custom LISP: If you prefer sticking to a custom LISP routine, you might want to try the following snippet shared by @pendean:

 

(defun C:BreakAtPoint()
    (command "._break" "f" "@")
);end

 

 

This might help achieve the break at the exact point you click without reverting to the first vertex.

Feel free to try these suggestions and let us know how it goes.

 



Wendy Lim

Data Nerd | Community Advocate | AEC Industry


facebook twitter twitter blogs pm


Join the new online Rail Community


Rails Summit




0 Likes

tcorey
Mentor
Mentor

That's how Break command works. Break, select the item and where you select also becomes the first break point. If you are trying to break the item in two at that point, simply type @ when asked for second point. Also, _Breakatpoint is now a native AutoCAD command. This has you select an item to break and then asks for a break point. No gap is created.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes