Replace Text
Replace Text
(OP)
acad2004 - vba
I want to be able to replace text strings in a drawing
I have written a program which calcs perameters for a drawing
the drawing is not to scale so all i am trying to do is replace items with the calced value
Private Sub cmdCreatePart_Click()
xxx = Replace("DimA", DimA, XX)
End Sub
thanks in advance
I want to be able to replace text strings in a drawing
I have written a program which calcs perameters for a drawing
the drawing is not to scale so all i am trying to do is replace items with the calced value
Private Sub cmdCreatePart_Click()
xxx = Replace("DimA", DimA, XX)
End Sub
thanks in advance





RE: Replace Text
RE: Replace Text
they are both mtext and text
RE: Replace Text
(DEFUN C:CT (/ p l n e os as ns st s nsl osl sl si chf chm olderr) ; Correct spelling errors
(setq olderr *error* ; Initialize variables
*error* chgterr
chm 0)
(setq p (ssget)) ; Select objects
(if p (progn ; If any objects selected
(while (= 0 (setq osl (strlen (setq os (getstring t "\nOld string: ")))))
(princ "Null input invalid")
)
(setq nsl (strlen (setq ns (getstring t "\nNew string: "))))
(setq l 0 n (sslength p))
(while (< l n) ; For each selected object...
(if (= "TEXT" ; Look for TEXT entity type (group 0)
(cdr (assoc 0 (setq e (entget (ssname p l))))))
(progn
(setq chf nil si 1)
(setq s (cdr (setq as (assoc 1 e))))
(while (= osl (setq sl (strlen
(setq st (substr s si osl)))))
(if (= st os)
(progn
(setq s (strcat (substr s 1 (1- si)) ns
(substr s (+ si osl))))
(setq chf t) ; Found old string
(setq si (+ si nsl))
)
(setq si (1+ si))
)
)
(if chf (progn ; Substitute new string for old
(setq e (subst (cons 1 s) as e))
(entmod e) ; Modify the TEXT entity
(setq chm (1+ chm))
))
)
)
(setq l (1+ l))
)
))
(princ "Changed ") ; Print total lines changed
(princ chm)
(princ " text lines.")
(terpri)
(setq *error* olderr) ; Restore old *error* handler
(princ)
)
RE: Replace Text
RE: Replace Text
What I did was create a master of the filter assembly
then i used attributes for the fields that i want to fill in
this seems to be working fine
just need to get the rounding of the numbers done
right now they are spending about an hour to create this drawing
thru the program it takes about 2 minutes and you get the
flat pattern also....