Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rtext Help Please...

Status
Not open for further replies.

willb5150tx

Aerospace
Jul 31, 2003
20
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???
 
Replies continue below

Recommended for you

start with
(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
 
thanks Cadnonimous...but you totally lost me when you started typing...you are way tooooo start...lol...can you put that into rtext...i was looking for something in this kinda format:

$(substr,$(getvar,"dwgname"),1,$(-,$(strlen,$(getvar,"dwgname")),4))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor