Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/26/2024 in all areas

  1. I take a different approach to this task. I autoload multi radio buttons and Breakall.lsp then do the cond and call the correct sub defun. (defun c:wow ( / ans) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (not break_with)(load "Breakall.lsp")) (setq ans (atof (ah:butts 1 "v" (list "Please choose" "Breakall" "BreakObject" "BreakwObjects" "BreakWith" "BreakTouching" "BreakSelected")))) (cond ((= ans "BreakAll")(c:breakall)) ((= ans "BreakwObjects")(c:breakwobjects)) ((= ans "BreakObject")(c:BreakObject)) ((= ans "BreakWith")(c:BreakWith)) ((= ans "BreakTouching")(c:BreakTouching)) ((= ans "BreakSelected")(c:BreakSelected)) ) (princ) ) (c:wow)
    1 point
  2. ^^^^ Nice expression. I like it! ^^^^
    1 point
  3. Here is my... text roulette. (defun c:pp() (setq tx (list "text0" "text1" "text2" "text3" )) (setq i -1 el (entget (car (entsel "select text"))) next T) (while next (setq i (rem (1+ i) (length tx)) el (subst (cons 1 (nth i tx)) (assoc 1 el) el) el (entmod el) st (getstring) next (= "" st)) ) (setq el (if (> (strlen st) 0) (subst (cons 1 st) (assoc 1 el) el) el) el (entmod el)) (princ) ) Start the program, select a text and press the space bar to cycle the text through the predefined values. Press ESC to break the cycle. Or start the program, select a text and enter your own text from the keyboard -but this text can't contain spaces. At the beginning of the program, replace those "text0..." strings with the desired ones, you are not limited to 4 lines.
    1 point
  4. Hi, Try this, you can select muliples polylines for export result to Excel (I have add the handle of entitie in Excel for find in drawing) (vl-load-com) (defun WriteExcel (data / xlApp wBook cells i j) (setq xlApp (vlax-create-object "Excel.Application") wBook (vlax-invoke-method (vlax-get-property xlapp 'WorkBooks) 'Add) cells (vlax-get-property xlApp 'Cells) i 0 ) (foreach row data (setq i (1+ i) j 0) (foreach val row (setq j (1+ j) cell (vlax-variant-value (vlax-get-property cells 'Item i j)) ) (vlax-put-property cell 'Value2 val) ) ) (vlax-invoke-method (vlax-get-property (vlax-get-property xlApp 'ActiveSheet) 'Columns ) 'AutoFit ) (vlax-put-Property xlApp 'Visible :vlax-true) ) (defun c:Pline_Level ( / ss n ename dxf_ent hndl pr flag e_line dxf_10 dxf_11 ptdef_z ss_t z_text pt_start pt_end seg_len dlt_z pt_z data) (princ "\nSelect polylines.") (while (null (setq ss (ssget '((0 . "LWPOLYLINE"))))) (princ "\nSelection is empty, or aren't POLYLINES!") ) (repeat (setq n (sslength ss)) (setq ename (ssname ss (setq n (1- n))) dxf_ent (entget ename) hndl (cdr (assoc 5 dxf_ent)) pr -1 flag T ) (redraw ename 3) (while flag (while (not (setq e_line (entsel "\nSelect line for reference for highlight polyline: ")))) (cond ((eq (cdr (assoc 0 (entget (car e_line)))) "LINE") (setq dxf_10 (cdr (assoc 10 (entget (car e_line)))) dxf_11 (cdr (assoc 11 (entget (car e_line)))) ) (if (equal (cadr dxf_10) (cadr dxf_11) 1E-13) (setq flag nil ptdef_z (cadr dxf_10)) (progn (princ "\nThe line is not horizontal") (setq flag T)) ) ) (T (princ "\nIsn't a line") (setq flag T)) ) ) (princ "\nSelect Text/MText") (while (not (setq ss_t (ssget "_+.:E:S" '((0 . "*TEXT")))))) (setq z_text (atof (cdr (assoc 1 (entget (ssname ss_t 0))))) seg_len 0.0 ) (repeat (fix (vlax-curve-getEndParam ename)) (setq pt_start (vlax-curve-GetPointAtParam ename (setq pr (1+ pr))) pt_end (vlax-curve-GetPointAtParam ename (1+ pr)) dlt_z (- (cadr pt_start) ptdef_z) pt_z (+ z_text dlt_z) data (cons (list hndl (atof (rtos seg_len 2 4)) (atof (rtos pt_z 2 2))) data) seg_len (abs (- (car pt_end) (car pt_start))) ) ) (setq dlt_z (- (cadr pt_end) ptdef_z) pt_z (+ z_text dlt_z) data (cons (list hndl (atof (rtos seg_len 2 4)) (atof (rtos pt_z 2 2))) data) ) (redraw ename 4) ) (if data (WriteExcel (cons (list "HANDLE" "LENGTH" "ELEV") (reverse data) ) ) ) (prin1) )
    1 point
  5. Thanks for your help! And sorry next time I'll post in the correct spot!
    1 point
  6. @smitaranjan This is how TBA lisp works. See the attached video. You don't need to manually copy and paste TEXT or MTEXT inside of block! After selection set is finished you just need to pick a point where to insert block one by one. If this fit for your needs, use it. Best regards. TBA.mp4
    1 point
  7. Is this suitable? Located here - MyPropertiesCAD
    1 point
×
×
  • Create New...