Jump to content

Splitting Line


StevenMc

Recommended Posts

hi all,

 

could anyone tell me if there is a command to split a line into segments?

i know there is the divide command but that does not physically split the line, it just gives it points. i need the line to be seperate segments without the gap like the break command gives.

sorry if i'm not too clear on this, its hard to put into words :wink:

 

cheers

Steven

Link to comment
Share on other sites

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • rkmcswain

    2

  • StevenMc

    2

  • jamesp1426

    2

  • kodama

    2

Top Posters In This Topic

Posted Images

Didn't someone (Lee Mac?) write a lisp routine that did something similar to this? Sorry, just can't recall for sure. Check around.

Link to comment
Share on other sites

Didn't someone (Lee Mac?) write a lisp routine that did something similar to this? Sorry, just can't recall for sure. Check around.

 

thanks ReMark, i have had a search but but cant seem to find it. i'll ask Lee if he has done this previously or maybe he can help me out if he hasnt. o:)

Link to comment
Share on other sites

hi all,

 

could anyone tell me if there is a command to split a line into segments?

i know there is the divide command but that does not physically split the line, it just gives it points. i need the line to be seperate segments without the gap like the break command gives.

 

The ._BREAK command doesn't leave a gap if you break it at a single point. Use the "@" character to specify the second point.

 

Command: ._BREAK

Select object:

Specify second break point or [First point]: _F

Specify first break point:

Specify second break point: @

Command:

Link to comment
Share on other sites

hi all,

 

could anyone tell me if there is a command to split a line into segments?

i know there is the divide command but that does not physically split the line, it just gives it points. i need the line to be seperate segments without the gap like the break command gives.

sorry if i'm not too clear on this, its hard to put into words :wink:

 

cheers

Steven

 

The attached may work for what you want. Open the lisp file to see all the various commands available to you. In each case there have to be lines on or crossing the object to use for break points.

 

Not one I wrote, author is noted in lisp file.

BreakObjects18.LSP

Link to comment
Share on other sites

  • 1 year later...

Also brillance by Lee Mac

 

;;------------------------=={ Segs }==------------------------;;
;;                                                            ;;
;;  Divides selected objects into an LWPolyline with a        ;;
;;  specified number of segments                              ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
(defun c:Segs ( / *error* _StartUndo _EndUndo doc ss )
 (vl-load-com)
 ;; © Lee Mac 2010
 (defun *error* ( msg ) (and doc (_EndUndo doc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
 )
 (defun _StartUndo ( doc ) (_EndUndo doc)
   (vla-StartUndoMark doc)
 )
 (defun _EndUndo ( doc )
   (if (= 8 (logand 8 (getvar 'UNDOCTL)))
     (vla-EndUndoMark doc)
   )
 )
 (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) *segs (cond ( *segs ) ( 10 )))
 (if
   (and
     (setq ss (ssget "_:L" '((0 . "ARC,CIRCLE,LWPOLYLINE,SPLINE,LINE,ELLIPSE"))))
     (progn (initget 6)
       (setq *segs (cond ((getint (strcat "\nSpecify Number of Segments <" (itoa *segs) "> : "))) ( *segs )))
     )
   )
   (
     (lambda ( j / e inc i pts ) (_StartUndo doc)
       
       (while (setq e (ssname ss (setq j (1+ j))))
         (
           (lambda ( inc i / pts )
             
             (repeat (1+ *segs)
               (setq pts (cons (trans (vlax-curve-getPointatDist e (* (setq i (1+ i)) inc)) 0 e) pts))
             )
             (if
               (entmake
                 (append
                   (list
                     (cons 0   "LWPOLYLINE")
                     (cons 100 "AcDbEntity")
                     (cons 100 "AcDbPolyline")
                     (cons 90 (length pts))
                     (cons 38 (caddar pts))
                     (cons 70 0)
                   )
                   (vl-remove-if 'null
                     (mapcar
                       (function (lambda ( d ) (assoc d (entget e)))) '(6 8 39 48 210)
                     )
                   )
                   (mapcar (function (lambda ( a ) (cons 10 a))) pts)
                 )
               )
               (entdel e)
             )
           )
           (/ (vlax-curve-getDistatParam e (vlax-curve-getEndParam e)) (float *segs)) -1
         )
       )
       (_EndUndo doc)
     )
     -1
   )
 )
 (princ)
)

Link to comment
Share on other sites

  • 1 year later...
The attached may work for what you want. Open the lisp file to see all the various commands available to you. In each case there have to be lines on or crossing the object to use for break points.

 

Not one I wrote, author is noted in lisp file.

 

This is exactly what I was looking for. This works fine although I am wondering if there is a built in function in AutoCad 2012 or Civil 3D 2012 that does this yet?

Link to comment
Share on other sites

This works fine although I am wondering if there is a built in function in AutoCad 2012 or Civil 3D 2012 that does this yet?[/QUOTe]

 

I don't know about AutoCAD 2012 or Civil 3D, but in Autodesk Inventor the command for splitting a line is called, well, Split....

Split.png

Link to comment
Share on other sites

  • 1 year later...
Since at least AutoCAD 2011 there is a Ribbon button for Break at Point.

 

 

But unfortunately the "@" option does seem to work on the command line since the same time :(

 

dJE

Link to comment
Share on other sites

But unfortunately the "@" option does seem to work on the command line since the same time :(

 

dJE

Actually that "break at point" button is nothing more than taking RK's answer and implementing it inside the CUI as a macro:
^C^C_break \_f \@ 

Link to comment
Share on other sites

Actually that "break at point" button is nothing more than taking RK's answer and implementing it inside the CUI as a macro:
^C^C_break \_f \@ 

 

Yea, I think that has been in the "menu" for years and years.

Along with a few other "commands", that are actually macros to do more than the command by itself.

Link to comment
Share on other sites

  • 2 months later...

when a line or arc is divided after using DIVIDE how can you select the points/ nodes that are placed.

I would like to start drawing line from these but they seem impossible to select.

All help appreciated

Link to comment
Share on other sites

how can you select the points/ nodes that are placed.

I would like to start drawing line from these but they seem impossible to select.

 

Use the NODE Osnap.

 

Here are 3 methods.

 

1) Start the LINE command, then when prompted for a start point, type NODE

2) Start the LINE command, then when prompted for a start point SHIFT-Right click and select NODE from the Osnap menu

3) Right-Click on the OSnap button on the Status bar and make NODE a running Osnap

 

Hint, you may want to change the node style to make the points easier to detect. Type DDPTYPE at the command line to see the options.

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...