Search the Community
Showing results for tags 'break'.
-
Hi guys, Im new here and i've been searching and even asking chatgpt to help me out but it doesnt seem to work properly. Im working on a SLD (Single Line Diagram) for an electrical project and when wires cross on the diagram, it needs to have a gap on one of the 2 lines. I've tried this lisp command that ChatGPT gave me but with little to no success; (defun c:BreakAndShorten ( / pt line break_length startpt1 endpt1 startpt2 endpt2) (setq break_length 2.5) ; Set your desired shorten length here (2.5 mm in this case) (setq line (car (entsel "\nSelect the line to break: "))) (setq pt (getpoint "\nSelect the break point: ")) (if (and line pt) (progn (setq startpt1 (polar pt (angle pt (vlax-curve-getStartPoint line)) (- break_length))) (setq endpt1 pt) (setq startpt2 pt) (setq endpt2 (polar pt (angle pt (vlax-curve-getEndPoint line)) break_length)) (command "BREAK" line startpt1 endpt2) (setq line1 (car (entsel "\nSelect the first segment to shorten: "))) (setq line2 (car (entsel "\nSelect the second segment to shorten: "))) (if line1 (command "LENGTHEN" "DE" (- break_length) line1)) (if line2 (command "LENGTHEN" "DE" (- break_length) line2)) ) (alert "You must select a line and a break point.") ) (princ) ) In sum, I want to break one line at a point and then shorten the 2 segments by 2.5mm so it has a 5mm gap without using multiple command everytime
-
Suppose you have a list called ptlist that consists of points (i.e. (x, y, z) coordinates), and a polyline entity called pline. Not assuming that all these points are on the pline, can you recursively try to (command "break" pline) and subsequent resulting entities. I'm trying out the logic of this exercise, but I can't seem to correct my logic. Currently I have my code looking like this. ;; pline - polyline entity ;; pt - [LIST] (e.g. ((x1, y1, z1) (x3, y3, z3) (x2, y2, z3))) (setq plinelist nil) (foreach pt (MA:ptlist ss) ;; generates my list of points from a function that takes a selection set (setq plinelist (append pline plinelist)) ;; appends the polyline list with current pline (could be original, could be subsequent) ;; ensures the last on the list is the original pline (if (command "break" pline pt pt) ;; test to see if polyline can break with first point (setq pline (entlast)) ;; subsequent resulting pline to be added on plinelist on next iteration (progn ;; else if polyline can't break at pt (if (command "break" (last plinelist) pt pt) ;; tests the last pline (setq p1 (car plinelist) ;; placeholder of previous pline entity pline (entlast)) ;; new pline to append in the next iteration (if (command "break p1 pt pt) ;; else ;; p1 = nil empty if the first plinelist length is 1 (setq pline (entlast)) ) ) ) ) ) I know there's a simpler way of doing this but I can't seem to find it. If you fellas can help, that would be a great learning experience.
-
Break Lines at multiple locations & then insert footage of line
ORgrown posted a topic in AutoLISP, Visual LISP & DCL
AutoCAD Map5 Hoping for a routine (or two or three) that will: 1. Convert all Lines/LWPOLYLINES/etc to Plines (no object data on the layers I need converted) 2. BREAK each Pline at the Insertion points of EVERY instance of two different blocks that are inserted along the lines. 3. Insert TEXT or MText (ROMANS 8' on layer FTGS) for each PLINE (actual footage) - ROTATED parallel to line & ~7' to one side of the line (at this point I can see I'll have to edit to move a number of footages to the opposite side of a line, but better than a prompt to place each footage when I have over 2500 instances). Ultimately, I need exact footages captured between each of the different blocks (S-Vaults & S-Handholes only - NOT S-UGTic). Many of the lines run through these blocks without breaking. Lines should not break at S-UGTic blocks. Sample DWG attached. My sample will already show footages, but I'm finding they are not always accurate - being as little as 1' off to over 100' off. Because not all the lines are broken, I don't know how the footages were determined... Drawing2.dwg Please let me know if you have any other ideas, suggestions, reality checks...My deepest appreciation for what you guys do with LiSP!- 7 replies
-
- break lines
- break
-
(and 2 more)
Tagged with:
-
lisp for trimming/ breaking a polyline or line
piterfun7777 posted a topic in AutoLISP, Visual LISP & DCL
Hi guys, just new to the autolisp world and would like to ask your assistance in making a lisp so it can be a basis for my future lisp programs. Here is the flow of the lisp. Overview: the lisp trims or break a polyline or a line a the point (midpoint) indicated by the user by a value specified by a user. The distance value indicated should be followed even if the polyline or line is angled. First: the user is asked of how much the value of the trim/ break to be done on the polyline or line. 2nd : the user is asked to chose the point where the trim / break will be done. 3rd: click the next point on the line or polyline or press esc to exit. Sample, I inputted 1000mm for the value and click at the midpoint of the polyline, the trim should be 500mm on both side of the polyline. As long as I don’t cancel, I will just continue to choose the next point to trim/ break. Thank you in advance and more power -
As posted over at theSwamp, I thought I'd share it with you nice folks too I've seen quite a few of these kind of programs knocking around, so I thought I'd give it a go at writing my own - using a slightly different approach. Give it a go and let me know what you think Full Description of the program & Latest Version can be found here. Enjoy! Lee AutoBlockBreakV1-7.lsp
-
Very Basic question ! How to break a line into smaller parts?
Atul Kelkar posted a topic in AutoCAD Beginners' Area
I use Autocad 2010 for Arechitectural applications and have a very basic question. Once I have drawn a line & I want to split it into smaller parts, how do I do it? -
Does anyone know any routine that allows, automatically, the break function, but with the points to be defined by endpoints? I need to make the break in overlapping lines. I know and I use the excellent routine authored by CAB, "Breakall.lsp" but only works for intersections.
-
User input: Getpoint OR real at the same time. Its possible?
Blur314 posted a topic in AutoLISP, Visual LISP & DCL
Hi everybody, First thing I want to apologize if something that I wrote sounds strange. Im spanish and my english is not as good as it should be=P. Im learling little by little autolisp things, mostly strugling through examples, codes, etc... many of them from this forum so I thank you a lot ^_^. At this moment I'm developing a routine that breaks/trims walls in order to insert doors or windows, and, after looking for it a few days, I would like to know if there's a way to use a number that users input on the command line (in a getpoint) without getting an error.,... wich is that happends everytime =/. ;; HOLE-O-MaTIC 2000 ;; by Arturo Blanco Ureña. 2013 ;; Breaks "walls" in order to insert windows or doors ;; Based initialy on code from Pavel Chour http://klobouk.fsv.cvut.cz/~chour/Lisp/Chapter%206.htm (defun error1 (errmsg) (command "_undo" "_end") (setvar "CMDECHO" 1) (setvar "OSMODE" osmodevar) (setq *error* temperr) (prompt "\nAchtung!!! Verboten!!! Error!!!\n") (princ) ) (defun c:holes(/ );P1a P2a P1 P2 P3 P4 A1 A2) (setq osmodevar (getvar 'OSMODE) temperr *error* *error* error1 ) (if (not ancho) (setq ancho 1.50)) (setq Tancho (rtos ancho) P1 "Width" ) (setvar "CMDECHO" 0) (command "_undo" "_begin") (setvar "osmode" 512) ;I'm using this structure in order to go back to the menu so I can change my mind several times. ;Don't know if there's a better way =P. ;--- (while (= P1 "Width") (initget 128) (setq P1 (getpoint (strcat "\nSelect Point or [Center/Width]<" Tancho ">:"))) (cond ((numberp P1) (setq ancho P1) ;trying to recognice P1 as a number but always goes on error =/ (setq Tancho (rtos ancho)) );cond1 ((= P1 "Width")(setvar "osmode" 35) (setq ancho (getdist "\nWidth of the Door/window?:")) (setq Tancho (rtos ancho)) );cond2 );end cond );end while ;--- (cond ((= P1 "Center") (setvar "OSMODE" 518) ;If the user want to break from the center of the window. (setq P1a (getpoint (strcat "\nSelect center <" Tancho ">:"))) (setvar "OSMODE" 128) (setq P2a (getpoint P1a "\nSelect the other side of the wall:") A1 (angle P1a P2a) A2 (+ (* pi 1.5) A1) P1 (polar P1a A2 (* ancho 0.5)) P3 (polar P1a A2 (* ancho -0.5)) P2 (polar P2a A2 (* ancho 0.5)) P4 (polar P2a A2 (* ancho -0.5)) ) );end cond1 (T (setvar "osmode" 128) ;if he/she wants to start from one side (setq P2 (getpoint P1 "\nSelect the other side of the wall:")) (setvar "osmode" 512) (setq A1 (angle P1 P2) A2 (+ (* pi 1.5) A1) P3 (polar P1 A2 ancho) P4 (polar P2 A2 ancho) P1a (polar P1 A2 (* ancho 0.5)) P2a (polar P2 A2 (* ancho 0.5)) ) );end else );end cond (setvar "osmode" 512) (command "_break" P1 P3 "_break" P2 P4 "_line" P1 P2 "") (setq L1 (entlast)) (command "_line" P3 P4 "") (setq L2 (entlast)) ;I add this in order to trim extra lines in the middle of the wall. (command "_trim" L1 L2 "" "B" P1a P2a "" "") (command "_undo" "_end") (setvar "CMDECHO" 1) (setvar "OSMODE" osmodevar) (setq *error* temperr) (princ) );end As you see You can enter the "Width" to give it, but I would like to simply write down a number when asking for a point, recognize that is a number and use it as the value of the variant. If a point is entered, then continue normally. Im a bit shy and its the first time i post a code. I have used several pieces of code from others to arrange the error handling/undo and its originally based on one tutorial from Pavel Chour, so I dont know if its right that I give permission or not to use it, or even its worth it (the trim still fails and i dont really get why ) but If anyone want to use it feel free. Any tips critics and opinions are welcome also -
Hi all and I hope I can put this over properly. Is this possible, as a for instance in Autocad 2011 If I had an heptagan (7 sides) (had to look this up LOL) which was equal sides and I deleted one line, would I be able to move the two end lines together so it is then a Hextegon (6 sides) and they are all still equal??? Or move one of the end lines to close the gap, and all the other lines move with it to keep it in proportion. I have the BIG Autocad Bible but not knowing what the name of this process is, makes it hard for me to look it up. I can select all the lines and move them but not close the gap. Hope this all make sense. Thank you in advance.
-
Hi all, who knows a way to cancell a command via reactors Here is my code of traping event of starting commands. I want to prevent AutoCAD of continuing some commands, with no success: (VLR-Command-Reactor nil (list (cons :VLR-commandWillStart 'Reactor:commandWillStart ) ) ) (defun Reactor:commandWillStart (-calling-reactor- -info- / *cmdname*) (setq *cmdname* (read (car -info-))) (cond ((member *cmdname* '(STYLE DIMSTYLE DDIM )) [color=red][b](command); it doesn't work [/b][/color] ) (T (mapcar 'princ (list *cmdname* " will start."))) ) ) Any suggestion will be greatly appreciated
-
-
I have an Acad2011 drawing with objects linked to a MS Access 2010 BOM database table via dbconnect. I have created my links successfully. However, I occasionally need to break a single object's link to its corresponding record either due to an error or change. A database record may sometimes link to multiple objects. How do I break just the one link while leaving the other objects' links intact.
-
I have a lisp that is supposed to create a Polyline box around selected text, trim lines within the box, and then delete the box. I am, however, having some issues getting it to run properly. Everytime I run it, I select the text that I want to use, but I get an error Select Text; error: bad DXF group: (-1 (13.3618 5.59898 0.0)) I am hoping that someone can help me out with this. ;;; This lisp routine creates a box around selected text, trims all entities within the box, and then deletes the box. (defun C:TTR (/ TEXTENT TRIMFACT TB GAP FGAP LL UR PTB1 PTB2 PTB3 PTB4 PTF1 PTF2 PTF3 PTF4 BX) (setq TEXTENT (entsel "\nSelect Text")) (setq TRIMFACT 2.0) ;Set trim gap and text height ratio HERE (command "ucs" "Entity" TEXTENT) (setq TB (textbox (list (cons -1 TEXTENT))) LL (car TB) UR (cadr TB) ) (setq GAP (* *TXTH TRIMFACT)) (setq FGAP (* GAP 0.5)) (setq PTB1 (list (- (car LL) GAP) (- (cadr LL) GAP)) PTB3 (list (+ (car UR) GAP) (+ (cadr UR) GAP)) PTB2 (list (car PTB3) (cadr PTB1)) PTB4 (list (car PTB1) (cadr PTB3)) PTF1 (list (- (car LL) FGAP) (- (cadr LL) FGAP)) PTF3 (list (+ (car UR) FGAP) (+ (cadr UR) FGAP)) PTF2 (list (car PTF3) (cadr PTF1)) PTF4 (list (car PTF1) (cadr PTF3)) ) (command "pline" PTB1 PTB2 PTB3 PTB4 "c") (setq BX (entlast)) (command "trim" BX "" "f" PTF1 PTF3 PTF4 PTF1 "" "") (entdel BX) (redraw TEXTENT) (command "ucs" "p") (princ) ) ;end trimbox (princ "\nType TTR to start") (princ); end TEXT TRIM.lsp Thank you in advance for your help