Rtext Help Please...
Rtext Help Please...
(OP)
ok...i need some help with diesel / rtext...
what i'm trying to do is get a page number using rtext...
ok...here's the catch...the page number is in the dwgname...
examples:
1111222222ir-01.dwg
111222222a-05.dwg
111222222b-14.dwg
(the 1's are the project number...sometimes 3 digits, sometimes
4...)
(the 2's are the code number...normally 6 digits)
(the ir, a, b, etc...are the revision status...starts at ir for
initial release then moves to a, b, c, etc...so it is sometimes 2
digits, and sometimes 1 digit)
(then the -XX is the page number, -01 is sht 1, -02 is sht 2, ... ,
-22 is sht 22, etc.)
so, in the drawing it is now shown like this: SHT *2*
OF 6
oh, and on the page number if it is -03, i only want the 3, not the
0 in front...
CAN THIS BE DONE???
what i'm trying to do is get a page number using rtext...
ok...here's the catch...the page number is in the dwgname...
examples:
1111222222ir-01.dwg
111222222a-05.dwg
111222222b-14.dwg
(the 1's are the project number...sometimes 3 digits, sometimes
4...)
(the 2's are the code number...normally 6 digits)
(the ir, a, b, etc...are the revision status...starts at ir for
initial release then moves to a, b, c, etc...so it is sometimes 2
digits, and sometimes 1 digit)
(then the -XX is the page number, -01 is sht 1, -02 is sht 2, ... ,
-22 is sht 22, etc.)
so, in the drawing it is now shown like this: SHT *2*
OF 6
oh, and on the page number if it is -03, i only want the 3, not the
0 in front...
CAN THIS BE DONE???





RE: Rtext Help Please...
(setq mm "111222222b-03")
use the string manip function below to isolate the part after the "-"
(setq mm1 (trimb4 mm "-")) returns the string "03"
(defun trimb4 (STRNG CHK)
(setq STR "" GO T SKIP T CNT (strlen STRNG))
(repeat CNT
(setq CHAR (substr STRNG 1 1))
(if (and GO SKIP (/= CHAR CHK))
(setq STR "")
(if SKIP
(setq GO nil SKIP nil)
(setq GO nil STR (strcat STR CHAR))))
(setq STRNG (substr STRNG 2)))
STR
) ;end defun
but it sounds like you want an integer, you can convert ascii to integer with ATOI
(setq mm2 (atoi mm1)) returns 3
RE: Rtext Help Please...
$(substr,$(getvar,"dwgname"),1,$(-,$(strlen,$(getvar,"dwgname")),4))
RE: Rtext Help Please...