On 29 Apr, 00:02, "R. Hamm" <rallo...@[EMAIL PROTECTED]
> wrote:
> YES!
> With the distof added it works good enough!
> Thanks much, all
> Ramey
>
> On Apr 24, 3:34=A0pm, strawberry <zac.ca...@[EMAIL PROTECTED]
> wrote:
>
>
>
> > On Apr 24, 3:27 pm, strawberry <zac.ca...@[EMAIL PROTECTED]
> wrote:
>
> > > On 24 Apr, 14:45, strawberry <zac.ca...@[EMAIL PROTECTED]
> wrote:
>
> > > > On 23 Apr, 22:15, "R. Hamm" <rallo...@[EMAIL PROTECTED]
> wrote:
>
> > > > > anyone know where I can find a lsp program where I can select
exis=
ting
> > > > > text in the drawing,
> > > > > eg.
> > > > > 12'-2 1/2"
> > > > > 3 1/2"
> > > > > 13' 4 3/8"
> > > > > and it adds it all up for me?
> > > > > I searched with no luck yet.
> > > > > Thanks in advance!
> > > > > Ramey
>
> > > > Hmm, are these text objects or something else, e.g. dims?
>
> > > Anyway, I don't have a complete solution, however, this routine from
> > > Cadalyst should get you started:
>
> > > ; ----- ADDNUM.LSP -----
> > > ; CADalyst Oct. 1991, p. 84
> > > ; TIP #703
>
> > > ; Adds numbers by pick.
>
> > > (defun C:ADDNUM (/ ENT CT ANX SNUM SLEN E EE X)
> > > (prompt "\nPick numbers to add: (CANNOT HAVE COMMAS) ")
> > > (setq ENT (ssget)) ; pick text
> > > (setq CT 0 ; initialize counts
> > > ANX 0)
> > > (setq SNUM (ssname ENT CT)) ; get first piece of text
> > > (setq SLEN (sslength ENT)) ; get number of pieces
> > > (while (<=3D (1+ CT) SLEN) ; loop through selection set
> > > (setq SNUM (ssname ENT CT) ; get next number's ENAME
> > > E (entget SNUM) ; get entity data
> > > EE (cdr (assoc 1 E)) ; get text value
> > > X (atof EE)) ; convert string to real
> > > (setq ANX (+ ANX X) ; add number to base
> > > CT (1+ CT)) ; increment counter
> > > )
> > > (princ "\nTotal =3D ")(princ (rtos ANX 2 4)) ; print in decimal
form.
> > > (princ)
> > > )
>
> > > and thedistoffunction can convert architectural fractions to real
> > > numbers:
>
> > > eg:
> > > (distof"1'-5 1/2\"" 4)
> > > 17.5
>
> > > Put them together, stir it around a bit and hey presto!?! Anyway,
let
> > > us know how you get on.
>
> > > Oh, and this function from Bill Kramer's AutoCADet's Guide to Visual
> > > Lisp converts distance by testing all unit types (apparently)
>
> > > (DEFUN CONVERTDISTANCE (S / LU RES TMP)
> > > (SETQ LU 1)
> > > (REPEAT 5 ;Five types to test
> > > (SETQ TMP (DISTOFS LU)
> > > LU (1+ LU))
> > > (IF TMP (SETQ RES TMP)))
> > > RES)
>
> > I tried this earlier but it didn't seem to work. I tried it again just
> > now and it worked perfectly, so go figure!?!
>
> > ; ----- ADDNUMX.LSP -----
> > ; CADalyst Oct. 1991, p. 84 with a tiny adaptation from strawberry
> > ; TIP #703
>
> > ; Adds numbers by pick.
>
> > (defun C:ADDNUMX (/ ENT CT ANX SNUM SLEN E EE X)
> > (prompt "\nPick numbers to add: (CANNOT HAVE COMMAS) ")
> > (setq ENT (ssget)) ; pick text
> > (setq CT 0 ; initialize counts
> > ANX 0)
> > (setq SNUM (ssname ENT CT)) ; get first piece of text
> > (setq SLEN (sslength ENT)) ; get number of pieces
> > (while (<=3D (1+ CT) SLEN) ; loop through selection set
> > (setq SNUM (ssname ENT CT) ; get next number's ENAME
> > E (entget SNUM) ; get entity data
> > EE (cdr (assoc 1 E)) ; get text value
> > X (distofEE 4)) ; convert string to real
> > (setq ANX (+ ANX X) ; add number to base
> > CT (1+ CT)) ; increment counter
> > )
> > (princ "\nTotal =3D ")(princ (rtos ANX 2 4)) ; print in decimal form.
> > (princ)
> > )- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
On 29 Apr, 00:02, "R. Hamm" <rallo...@[EMAIL PROTECTED]
> wrote:
> YES!
> With the distof added it works good enough!
> Thanks much, all
> Ramey
>
Top-posting corrected.
You're welcome.
Curiously, while the routine works fine on my Vista workstation, it
fails on my XP workstation. No idea why.


|