Message 1 of 32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
The code below does what I want, but of course I want more:
- How can I integrate Lee_Mac's code (and actually I want 3 digits instead of 4).
- How can I stote the attribute value of the tag "TAPPUNT/KEERKLEP" into a variable " tapkeer" (to make the comment out code work)
(defun c:TP-change (/ ss i e tapkeer bouwdeel int)
(vl-load-com)
(if (setq ss (ssget ":S" '((0 . "insert")(66 . 1)(2 . "`*U*,TAPPUNT_CZE"))))
(repeat (setq i (sslength ss))
(setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)) )))
(if (Eq (strcase (vla-get-effectivename e)) "TAPPUNT_CZE")
(foreach itm (vlax-invoke e 'GetAttributes)
; (setq tap "Tappunt")
; (setq keer "Keerklep")
; (setq nrtappunt "NUMMER_TAPPUNT")
; (setq nrkeerklep "NUMMER_KEERKLEP")
; (cond ((= tapkeer tap) (setq nr nrtappunt))
; ((= tapkeer keer) (setq nr nrkeerklep))
; (t (prompt "N.v.t.: Tappunt onder/boven")))
(if (eq (vla-get-tagstring itm) "NUMMER_TAPPUNT")
(vla-put-textstring itm (getstring "\nTappuntnr: ") )))
)))
(princ)
)
Code van Lee_Mac:
(defun c:4digits ( / int )
(while
(and
(progn
(initget 6)
(setq int (getint "\nEnter a 4-digit number <Exit>: "))
)
(not (wcmatch (itoa int) "####"))
)
(princ "\nThat's not 4-digits!")
)
(if int
(princ (strcat "\nYou entered " (itoa int) "."))
(princ "\nUser exited.")
)
(princ)
)
Solved! Go to Solution.