pmxcad Posted June 21, 2018 Share Posted June 21, 2018 Hi, I have the following lisp to increase an attribute. Works well, but is it possible to do this according to a list? What I would like is the following: start at number 1001 then next 1002, 1003, 1004, 1005 & 1006. and then after the 1006 continue with 1101 to 1112 and then continue with 1201 to 1212 And so on with 1301 to 1312 1401 to 1412 1501 to 1512 1601 to 1612 1701 to 1712 1801 to 1812 ;================================================== (defun c:INCATT ( / f str i f tag num pre post OOv ; *StartStr121007 ; *IncreaseN121007 HUE:DivideNum HUE:memoVar HUE:stringsubst HUE:StringCal HUE:start HUE:end _divideStr ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:DivideNum ( str / lst s m v1 v2 i j c _NumP _Cal) (defun _NumP ( x ) (<= 48 x 57)) (defun _Cal ( ty v ) (set v (cons (vl-list->string (reverse (eval ty))) (eval v))) (set ty nil) ) (setq lst (vl-string->list str) i -1 j -1) (repeat (length lst) (setq c (nth (setq i (+ i 1)) lst)) (cond ( (_NumP c) (setq s (cons c s) ) (cond ( m (_Cal 'm 'v1) (setq j (+ 1 j))))) ( (and (= c 46) (> i 0) (_NumP (nth (- i 1) lst)) (_NumP (nth (+ i 1) lst))) (setq s (cons c s)) ) (t (setq m (cons c m)) (cond ( s (_Cal 's 'v1) (setq v2 (cons (setq j (+ 1 j)) v2)))) ) ) ) (cond ( m (_Cal 'm 'v1)) ( t (_Cal 's 'v1) (setq v2 (cons (setq j (+ 1 j)) v2))) ) (list (reverse v1) (reverse v2)) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:memoVar ( va f m s / v ) (setq v (if (member (eval va) '(nil "")) s (eval va))) (mapcar 'princ (list "\n" m " <" v "> : ")) (set va ( f )) (if (member(eval va) '(nil "")) (set va v)) (eval va) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:stringsubst ( new old str / l i ) (setq l (strlen new) i 0) (while (setq i (vl-string-search old str i)) (setq str (vl-string-subst new old str i) i (+ i l)) ) str ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:StringCal ( str f n / _GetPP data1 data2 num i DIMZIN ) (defun _GetPP ( str / lst l post pre flag ) (setq lst (vl-remove 45 (vl-string->list str)) post (if (setq l (member 46 lst)) (- (length l) 1) 0) pre (if (setq l (member 46 (reverse lst))) (- (length l) 1) (length lst)) flag (minusp (atof str)) ) (list pre post flag) ) (setq DIMZIN (getvar 'DIMZIN)) (setvar 'DIMZIN 0) (setq data1 (_GetPP str) num (vl-string->list (rtos (f (atof str) n) 2 (cadr data1))) data2 (_GetPP (vl-list->string num)) num (vl-remove 45 num) ) (setvar 'DIMZIN DIMZIN) (if (< 0 (setq i (- (car data1) (car data2)))) (repeat i (setq num (cons 48 num))) ) (if (< 0 (setq i (- (cadr data1) (cadr data2)))) (repeat i (setq num (append num '(48)))) ) (if (caddr data2) (setq num (cons 45 num))) (vl-list->string num) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:start( lst ) (vla-startundomark (HUE:end nil)) (list lst (mapcar 'getvar lst)) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:end ( d / doc ) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (and (cadr d) (mapcar 'setvar (car d) (cadr d))) (if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-endundomark doc)) doc ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun _divideStr ( str / data i j k pre post ) (setq data (HUE:DivideNum str) k (last (cadr data)) j 0 pre "" post "" ) (foreach s (car data) (cond ( (< j k) (setq pre (strcat pre s))) ( (> j k) (setq post(strcat post s))) ( (= j k) (setq i s)) ) (setq j (+ 1 j)) ) (list pre i post) ) ;------------------------------------------------------------------------- ; Error Function ;------------------------------------------------------------------------- (defun *error* (s) (if OOv (HUE:End OOv)) (princ s) ) ;----------------------------------------------------------------------------------- ; Main Function ;----------------------------------------------------------------------------------- (setq str (HUE:MemoVar '*StartStr121007 getstring "StartString " "100") i 1 OOv (HUE:Start '(DIMZIN)) ) (and (vl-string-search "," str) (setq str (HUE:StringSubst "." "," str) f t) ) (mapcar 'set '(pre num post) (_DivideStr str)) (setq tag "TEXT1" num (HUE:StringCal num - i) ) (setvar 'ERRNO 0) (setvar 'DIMZIN (while (= 0 (getvar 'ERRNO)) (and (setq o (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1)))) ;(C:PUTA);------------------------------------------------------put locatiecode----------------------------------- (vl-some '(lambda ( att ) (if (= tag (vla-get-tagstring att)) (progn (setq num (HUE:StringCal num + i) str (strcat pre num post) ) (if f (setq str (HUE:StringSubst "," "." str))) (vla-put-textstring att str) ) ) ) (vlax-invoke (vlax-ename->vla-object (ssname o 0)) 'getattributes) ) ) ) (HUE:End OOv) (princ) )(vl-load-com) thank you in advance PmxCAD Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 22, 2018 Share Posted June 22, 2018 No reason why not use list or text file etc no code just idea. ((1001 1 5)(1201 1 12)(1300 2 4)) (startnumber inc howmany) Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted June 22, 2018 Share Posted June 22, 2018 Hi,I have the following lisp to increase an attribute. Works well, but is it possible to do this according to a list? What I would like is the following: start at number 1001 then next 1002, 1003, 1004, 1005 & 1006. and then after the 1006 continue with 1101 to 1112 and then continue with 1201 to 1212 And so on with 1301 to 1312 1401 to 1412 1501 to 1512 1601 to 1612 1701 to 1712 1801 to 1812 limit 0~12 ? (defun lim12 (x / n) (setq n (rem x 100)) (cond ((if (zerop n) (- x n) ) ) ((if (< n 13) x (+ 100 (- x n)) ) ) ) ) 999 -> nil 1199 -> 1200 1300 -> 1300 1301 -> 1301 1311 -> 1311 1312 -> 1312 1313 -> 1400 1399 -> 1400 1400 -> 1400 1413 -> 1500 1699 -> 1700 1700 -> 1700 1701 -> 1701 1711 -> 1711 1712 -> 1712 1713 -> 1800 1714 -> 1800 1800 -> 1800 1812 -> 1812 1900 -> nil Quote Link to comment Share on other sites More sharing options...
pmxcad Posted June 22, 2018 Author Share Posted June 22, 2018 I have been playing around to make a list. I made the following. (defun c:test1 () (setq lst '(1001 1002 1003 1004 1005 1006 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 ) ) (princ lst) ) Is a lot of typing and it is not as advanced as yours but also works. I've also been playing around with the example of BIGAL. (defun c:test2 () (setq lst '((1001 1 6)(1201 1 12)(1301 1 12)(1401 1 12)(1501 1 12)(1601 1 12)(1701 1 12)(1801 1 12)) ) ) But I really would not know how to apply this in the INCATT lisp. Can someone help me with that? Thanks in advance, PmxCAD Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 22, 2018 Share Posted June 22, 2018 (edited) Here is a simple example: (setq n 1300) (while (getpoint) (repeat 12 (print (setq n (1+ n)))) (setq n (+ 88 n))) Edited June 22, 2018 by ronjonp Quote Link to comment Share on other sites More sharing options...
pmxcad Posted June 22, 2018 Author Share Posted June 22, 2018 Well, it's not that simple for me. But I think this is a counter. It starts at 1301 to 1312. The (1 + n) is the counter and the (+ 100 n) increases the value by 100 and the (repeat 12 is repeated 12 times. I managed to get a bit out of that, but I do not understand (getpoint) and print. Quote Link to comment Share on other sites More sharing options...
pmxcad Posted June 22, 2018 Author Share Posted June 22, 2018 I think I should use (nth 0 lst) to read my example list and (nth 0 (nth 0 lst)) to read the example of BIGAL, is that correct? Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted June 22, 2018 Share Posted June 22, 2018 (edited) cond is your friend modified from post#3 (defun[b] lim[/b] (x i) (setq n (rem x 100)) ([color="blue"]cond[/color] ((if (zerop n) (- x n) ) ) ((if (<= n i) x (1+(+ 100 (- x n))) ) ) ) ) (defun c:test (/ x n) (setq x [color="red"]1001[/color]) (while x (if (setq x (cond ((getint (strcat "\n[Enter] to continue or input number < " (itoa x) " > : "))) (x) ) n ([color="blue"]cond[/color] ((<= [color="red"]1001 [/color]x [color="red"]1006[/color]) (lim x [color="red"]6[/color])) [color="green"]; count from 1001 to 1006 only [/color] ((< [color="red"]1006[/color] x [color="red"]1101[/color]) 1101) [color="green"]; if x > 1006 jumps to 1101[/color] ((<= [color="red"]1101[/color] x[color="red"] 1812[/color]) (lim x [color="red"]12[/color])) [color="green"]; from 1101 to 1812 count every 100s to 12 [/color] ) ) (progn (princ (setq x n) ) (setq x (1+ x))) (setq x nil) ) ) (princ) ) what if after 1812? or lesser than 1001? you give a try to configure it in cond Edited June 22, 2018 by hanhphuc add comments, 1001 as OP commented & 1+ Quote Link to comment Share on other sites More sharing options...
pmxcad Posted June 22, 2018 Author Share Posted June 22, 2018 Wow hanhphuc, that works. I only changed (setq x 1000) to (setq x 1001) to start with 1001. But how can I apply it to the attinc.lsp? Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted June 22, 2018 Share Posted June 22, 2018 Wow hanhphuc, that works. I only changed (setq x 1000) to (setq x 1001) to start with 1001. But how can I apply it to the attinc.lsp? make another sub, x is number , p is predicate t/nil for range (defun lim# (x p) (cond ((<= 1001 x 1006) ([color="blue"]lim[/color] x 6)) ((< 1006 x 1101) 1101) ((<= 1101 x 1812) ([color="blue"]lim[/color] x 12)) (t (if p x)) ) ) ;example : ;(setq num (lim# num T )) ;but you need to configure it yourself.. test (defun foo (f) (foreach x '([color="purple"]999 1000 1001 1002 1005 1006 1007 1199 1300 1301 1311 1312 1313 1399 1400 1413 1699 1700 1701 1711 1712 1713 1714 1800 1812 1813 1814 1900[/color]) (princ (apply 'strcat (mapcar 'vl-princ-to-string (list "\n" x " -> " (eval f) ) ) ) ) ) (textscr) (princ) ) (defun c:test2 nil (foo '(lim# x [color="blue"][b]NIL[/b][/color]))) [color="green"];limit range 1001 to 1812[/color] (defun c:test3 nil (foo '(lim# x [b][color="blue"]T[/color][/b])))[color="green"] ; after 1812 ,1813 etc.. as normal[/color] Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 23, 2018 Share Posted June 23, 2018 (edited) Going back to the list approach If your happy typing the 3 entries can make the list or have a text file. I think this is the line to play with not tested. (setq str (HUE:MemoVar '*StartStr121007 getstring "StartString " "100") ;oflist ((1001 1 5)(1201 1 12)(1300 2 4)) (setq y 0) (repeat (length oflist) (setq stnum (nth 0 (nth y oflist)) (setq inc (nth 1 (nth y oflist)) (setq howmany (nth 2 (nth y oflist)) (repeat howmany do your attinc now ..... ...... ) ; repeat howmany (setq y (+ y 1)) ) ; repeat Edited June 23, 2018 by BIGAL Quote Link to comment Share on other sites More sharing options...
pmxcad Posted June 23, 2018 Author Share Posted June 23, 2018 Hi BIGAL, I am not going to succeed, would not know which list I should use. (red top) and where to place. And do I have to delete that one line and put your code there? (red) ;================================================== (defun c:INCATT ( / f str i f tag num pre post OOv ; *StartStr121007 ; *IncreaseN121007 [color=red] ;--------------- list PmxCAD -------------------------------------------------------------------------------------------------------------- (setq lst '(1001 1002 1003 1004 1005 1006 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 );lst );setq this one? ;(setq lst '((1001 1 6)(1201 1 12)(1301 1 12)(1401 1 12)(1501 1 12)(1601 1 12)(1701 1 12)(1801 1 12)); or this one? )[/color] ;----------------------------------------------------------------------------------------------------------------------------- HUE:DivideNum HUE:memoVar HUE:stringsubst HUE:StringCal HUE:start HUE:end _divideStr ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:DivideNum ( str / lst s m v1 v2 i j c _NumP _Cal) (defun _NumP ( x ) (<= 48 x 57)) (defun _Cal ( ty v ) (set v (cons (vl-list->string (reverse (eval ty))) (eval v))) (set ty nil) ) (setq lst (vl-string->list str) i -1 j -1) (repeat (length lst) (setq c (nth (setq i (+ i 1)) lst)) (cond ( (_NumP c) (setq s (cons c s) ) (cond ( m (_Cal 'm 'v1) (setq j (+ 1 j))))) ( (and (= c 46) (> i 0) (_NumP (nth (- i 1) lst)) (_NumP (nth (+ i 1) lst))) (setq s (cons c s)) ) (t (setq m (cons c m)) (cond ( s (_Cal 's 'v1) (setq v2 (cons (setq j (+ 1 j)) v2)))) ) ) ) (cond ( m (_Cal 'm 'v1)) ( t (_Cal 's 'v1) (setq v2 (cons (setq j (+ 1 j)) v2))) ) (list (reverse v1) (reverse v2)) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:memoVar ( va f m s / v ) (setq v (if (member (eval va) '(nil "")) s (eval va))) (mapcar 'princ (list "\n" m " <" v "> : ")) (set va ( f )) (if (member(eval va) '(nil "")) (set va v)) (eval va) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:stringsubst ( new old str / l i ) (setq l (strlen new) i 0) (while (setq i (vl-string-search old str i)) (setq str (vl-string-subst new old str i) i (+ i l)) ) str ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:StringCal ( str f n / _GetPP data1 data2 num i DIMZIN ) (defun _GetPP ( str / lst l post pre flag ) (setq lst (vl-remove 45 (vl-string->list str)) post (if (setq l (member 46 lst)) (- (length l) 1) 0) pre (if (setq l (member 46 (reverse lst))) (- (length l) 1) (length lst)) flag (minusp (atof str)) ) (list pre post flag) ) (setq DIMZIN (getvar 'DIMZIN)) (setvar 'DIMZIN 0) (setq data1 (_GetPP str) num (vl-string->list (rtos (f (atof str) n) 2 (cadr data1))) data2 (_GetPP (vl-list->string num)) num (vl-remove 45 num) ) (setvar 'DIMZIN DIMZIN) (if (< 0 (setq i (- (car data1) (car data2)))) (repeat i (setq num (cons 48 num))) ) (if (< 0 (setq i (- (cadr data1) (cadr data2)))) (repeat i (setq num (append num '(48)))) ) (if (caddr data2) (setq num (cons 45 num))) (vl-list->string num) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:start( lst ) (vla-startundomark (HUE:end nil)) (list lst (mapcar 'getvar lst)) ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun HUE:end ( d / doc ) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (and (cadr d) (mapcar 'setvar (car d) (cadr d))) (if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-endundomark doc)) doc ) ;------------------------------------------------------------------------- ; Sub Function ;------------------------------------------------------------------------- (defun _divideStr ( str / data i j k pre post ) (setq data (HUE:DivideNum str) k (last (cadr data)) j 0 pre "" post "" ) (foreach s (car data) (cond ( (< j k) (setq pre (strcat pre s))) ( (> j k) (setq post(strcat post s))) ( (= j k) (setq i s)) ) (setq j (+ 1 j)) ) (list pre i post) ) ;------------------------------------------------------------------------- ; Error Function ;------------------------------------------------------------------------- (defun *error* (s) (if OOv (HUE:End OOv)) (princ s) ) ;----------------------------------------------------------------------------------- ; Main Function ;----------------------------------------------------------------------------------- [color=red] ;(setq str (HUE:MemoVar '*StartStr121007 getstring "StartString " "100");----------------------------------------- [/color] [color=red] ;--------------- Example code BIGAL---------------------------------------------------------------------------------------- ;oflist ((1001 1 5)(1201 1 12)(1300 2 4)) (setq y 0) (repeat (length oflist) (setq stnum (nth y (nth 0 oflist)) (setq inc (nth y (nth 1 oflist)) (setq howmany (nth y (nth 2 oflist)) (repeat howmany do your attinc now ..... ...... ) ; repeat howmany (setq y (+ y 1)) ) ; repeat ;-----------------------------------------------------------------------------------------------------------------------------[/color] i 1 OOv (HUE:Start '(DIMZIN)) ) (and (vl-string-search "," str) (setq str (HUE:StringSubst "." "," str) f t) ) (mapcar 'set '(pre num post) (_DivideStr str)) (setq tag "TEXT1" num (HUE:StringCal num - i) ) (setvar 'ERRNO 0) (setvar 'DIMZIN (while (= 0 (getvar 'ERRNO)) (and (setq o (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1)))) ;(C:PUTA);------------------------------------------------------put locationcode----------------------------------- (vl-some '(lambda ( att ) (if (= tag (vla-get-tagstring att)) (progn (setq num (HUE:StringCal num + i) str (strcat pre num post) ) (if f (setq str (HUE:StringSubst "," "." str))) (vla-put-textstring att str) ) ) ) (vlax-invoke (vlax-ename->vla-object (ssname o 0)) 'getattributes) ) ) ) (HUE:End OOv) (princ) )(vl-load-com) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 24, 2018 Share Posted June 24, 2018 It would be a good idea to post a dwg it will make more sense what the code is actually doing. I am a bit lost trying to figure it all out. The code has this (setq str (HUE:MemoVar '*StartStr121007 getstring "StartString " "100") I have no idea what you are supplying as values. code something like this (defun c:INCATT ( / f str i f tag num pre post OOv) ; *StartStr121007 ; *IncreaseN121007 ;--------------- list PmxCAD ------------------------------------------------------- ;--------------- Example code BIGAL------------------------------------------------- ; replace this list with say enter the 3 values use getvals3 (setq lst2 (list (list 1001 1 6)(list 1201 1 12)(list 1301 1 12)(list 1401 1 12)(list 1501 1 12)(list 1601 1 12)(list 1701 1 12)(list 1801 1 12))) (setq y 0) (repeat (length lst2) (setq stnum (nth y (nth 0 lst2))) (setq inc (nth y (nth 1 lst2))) (setq howmany (nth y (nth 2 lst2))) ; need to use the values form the list (setq str (HUE:MemoVar '*StartStr121007 getstring "StartString " "100") (repeat howmany HUE:DivideNum HUE:memoVar HUE:stringsubst HUE:StringCal HUE:start HUE:end _divideStr ) ; repeat howmany (setq y (+ y 1)) ) ; repeat ) Quote Link to comment Share on other sites More sharing options...
pmxcad Posted June 24, 2018 Author Share Posted June 24, 2018 It is for numbering components. These are connected to the modules in cabinet 01 and 02. The first module (main module) with the address 1000 has only 6 inputs and the I / O modules have 12. So when the first one is full, it goes on with the I / O module 1100. And if it is full, it goes on with 1200 .... 1300 .... etc. Usually it is limited to 3 I / O modules but some times 7 (I / O 1800). The drawing is just an example. In real life, several types of components are used. I hope you get a little insight from my intention. test.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 25, 2018 Share Posted June 25, 2018 Starting to work out what is meant to happen I think the code provided is not in the same direction as say some of us would have approached hence the responses provided. It seems to me to be more about the rules controlling the procedure, you have the first contact, 1x6 1000's when full 1100's 5x12 up to 1500,s when full 2nd controller again 1x6 then 5x12 3rd and so on Rather than a list answer. Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted June 25, 2018 Share Posted June 25, 2018 Hi BIGAL, I am not going to succeed, would not know which list I should use. (red top) and where to place.And do I have to delete that one line and put your code there? (red) ;================================================== (defun c:INCATT ( / f str i f tag num pre post OOv ; *StartStr121007 ; *IncreaseN121007 [color=red] ;--------------- list PmxCAD -------------------------------------------------------------------------------------------------------------- (setq lst '(1001 1002 1003 1004 1005 1006 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 );lst );setq this one? ;(setq lst '((1001 1 6)(1201 1 12)(1301 1 12)(1401 1 12)(1501 1 12)(1601 1 12)(1701 1 12)(1801 1 12)); or this one? )[/color] ;----------------------------------------------------------------------------------------------------------------------------- HUE:DivideNum HUE:memoVar HUE:stringsubst HUE:StringCal HUE:start HUE:end _divideStr ) typos? you put the code in variable declaration? IMO if you could write this code, you should be able to modify it to suit your needs seems still can't solve it? as mentioned (lim# x p) ;argument x, should be integer or a number but if your (HUE:StringCal num + i) returns a string then you just need some simple conversion atoi & itoa or rtos assume your increment limits "1212", next will be "1301" right? example: (setq num [color="purple"]"1212"[/color]) (setq num ([color="blue"]HUE:StringCal[/color] num + i) [color="green"];output num as string[/color] x ([color="blue"]lim#[/color] (atoi num) [color="blue"]NIL[/color]) [color="green"]; convert num to integer[/color] num (itoa x) [color="green"];convert back to string [/color] str (strcat pre num post) [color="green"]; returns as string concatenate [/color] ) ;example : assume after increment by HUE:StringCal function (setq num [color="purple"]"1213"[/color]) (setq x ([color="blue"]lim#[/color] ([color="blue"]atoi[/color] num) [color="blue"]nil[/color])) [color="green"]; apply my function [/color] (setq num (itoa x)) [color="green"]; "[color="red"][b]1301[/b][/color]" new value as string [/color] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.