Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/04/2023 in all areas

  1. Lets do counting, I can do counting. Let's make it trickier and do binary counting, the first number in the list is the decimal equivalent. Dead handy if each character in a string has only 2 options. 1. 00000 2. 00001 3. 00010 4. 00011 5. 00100 6. 00101 7. 00110 8. 00111 9. 01000 10.01001 11.01010 12.01011 13.01100 14.01101 15.01110 16.01111 17.10000 18.10001 19.10010 20.10011 21.10100 22.10101 23.10110 24.10111 25.11000 26.11001 27.11010 28.11011 29.11100 30.11101 31.11110 32.11111
    3 points
  2. Two choices per letter upper or lower case 5 letters 2^5 = 32 possible choices. either do it lee's way (best) or use the strcase funciton to convert everything to upper case and check that way.
    3 points
  3. http://www.lee-mac.com/stringtolist.html
    2 points
  4. Here is my code, for anyone who needs. Thanks for Mr. Lee Mac. (defun CaseSensitivity (str1 / str2) (and str1 (= (type str1) 'STR) (progn (setq str2 "" i 1) (repeat (strlen str1) (if (and (= (strcase (substr str1 i 1));upper case (strcase (substr str1 i 1) T);lower case )) (setq str2 (strcat str2 (strcase (substr str1 i 1)))) (setq str2 (strcat str2 "[" (strcase (substr str1 i 1)) (strcase (substr str1 i 1) T) "]"))) (setq i (1+ i)) );repeat (setq str1 str2) );progn );and str1) ;(CaseSensitivity "floor9") => "[Ff][Ll][Oo][Oo][Rr]9"
    1 point
  5. I'd go string to List, splits at every character '-' and you can make up the texts to suit from that
    1 point
  6. I want a go.... See.... 25...
    1 point
  7. A start with the following. I leave it to you to improve it at your convenience but I think it is difficult to meet all your requirements because the slightest modification can lead to other overlaps which were not present at the start. (defun draw_tbox ( e / dxf_ent p0 ang sin_a cos_a t_box l_box) (setq dxf_ent (entget e) p0 (cdr (assoc 10 dxf_ent)) ang (cdr (assoc 50 dxf_ent)) sin_a (sin ang) cos_a (cos ang) t_box (textbox dxf_ent) l_box (mapcar '(lambda (x) (list (+ (car p0) (- (* (car x) cos_a) (* (cadr x) sin_a) ) ) (+ (cadr p0) (+ (* (car x) sin_a) (* (cadr x) cos_a) ) ) ) ) (append t_box (list (list (caadr t_box) (cadar t_box) (caddar t_box)) (list (caar t_box) (cadadr t_box) (caddr (cadr t_box))) ) ) ) ) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) (cons 8 (getvar "CLAYER")) (cons 62 (atoi (getvar "CECOLOR"))) (cons 6 (getvar "CELTYPE")) (cons 370 (getvar "CELWEIGHT")) '(100 . "AcDbPolyline") '(90 . 4) (if (eq (getvar "PLINEGEN") 1) '(70 . 129) '(70 . 1)) (cons 43 (getvar "PLINEWID")) (cons 38 (getvar "ELEVATION")) (cons 39 (getvar "THICKNESS")) (cons 10 (car l_box)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 10 (caddr l_box)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 10 (cadr l_box)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 10 (cadddr l_box)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (assoc 210 dxf_ent) ) ) ) (defun c:TEST ( / ss_keep ss_work n ent_k tmp_k obj_k ent_w tmp_w obj_w vrt_pt) (setq ss_keep (ssget "_X" (list '(0 . "TEXT") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) '(8 . "CONDUIT") '(62 . 6) '(40 . 2.0) '(7 . "Standard") ) ) ) (setq ss_work (ssget "_X" (list '(0 . "TEXT") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) '(8 . "INTERSECTION") '(62 . 4) '(40 . 2.0) '(7 . "Standard") ) ) ) (cond ((and ss_keep ss_work) (repeat (setq n (sslength ss_keep)) (setq ent_k (ssname ss_keep (setq n (1- n)))) (draw_tbox ent_k) (setq tmp_k (entlast) obj_k (vlax-ename->vla-object tmp_k) ) (repeat (setq i (sslength ss_work)) (setq ent_w (ssname ss_work (setq i (1- i)))) (draw_tbox ent_w) (setq tmp_w (entlast) obj_w (vlax-ename->vla-object tmp_w) vrt_pt (vlax-variant-value (vla-IntersectWith obj_k obj_w 0)) ) (if (>= (vlax-safearray-get-u-bound vrt_pt 1) 0) (entmod (subst (assoc 50 (entget ent_k)) (assoc 50 (entget ent_w)) (entget ent_w))) ) (entdel tmp_w) ) (entdel tmp_k) ) ) ) (prin1) )
    1 point
  8. As simple as follows: (setq str "VAR-259") (and (setq pos (vl-string-search "-" str)) (setq pre (substr str 1 pos)) ;; = VAR (setq suf (substr str (+ pos 2))) ;; = 259 )
    1 point
×
×
  • Create New...