27
126
99
初露锋芒
(defun c:sdi ()(j))(defun j (/ uicon ent ename sta ang ang-test stra dotpos statxt) (vl-load-com) (setvar "cmdecho" 0) (EXTEK_StartErrorTrap) (setq blocks (mapcar (function strcase) '("anchor-sta" "catch basin-sta" "conc. pole-sta" "elec transformer-sta" "fiber marker tube-sta" "fire hydrant-sta" "grate inlet-sta" "handhole-sta" "handhole prop-sta" "mailbox-sta" "manhole-sta" "parking meter-sta" "pole-sta" "property pin-sta" "sign-sta" "steel pole-sta" "steel post-sta" "street light-sta" "tel ped-sta" "test pit-sta" "traffic control box-sta" "traffic pole-sta" "traffic signal-sta" "tree-sta" "verizon mh-sta" "valve-sta" "water meter-sta")) i -1) (setq uicon (getvar "ucsicon" )) (setvar "osmode" 44) ;(vl-cmdf "UCS" "w") (setq ent (entsel "\nSelect Running Line: ") ename (car ent)) ;;;====Check if entsel is valid==== (if (not ent) (progn (princ "\nMissed... try again!") (j) ) ) ;;;====End check=================== (setq sta (vlax-curve-getDistAtPoint ename (setq on-pt (vlax-curve-getClosestPointTo ename (setq ox-pt (trans (getpoint "\nSelect Block Intersection" ) 1 0)))))) (setq stra (rtos sta 2 2)) (if (not (= stra "0.00")) (progn (setq dotpos (1+ (vl-string-search stra))) (substr stra (- dotpos 2)) (if (>= (strlen stra) 6) (setq statxt (strcat (substr stra 1 (- dotpos 3)) "+"(substr stra (- dotpos 2)))) (setq statxt (strcat (chr 48)"+" (substr stra (- dotpos 2)))) ) );progn (setq statxt "0+00") ) (if (and (setq s1 (ssget ":L" (list '(0 . "INSERT") (cons 2 (apply 'strcat (cons "`*U*" (mapcar '(lambda ( s ) (strcat "," s)) blocks))) ) ; End Cons ) ; End list ) ; End ssget ) ) ; End setq (while (setq e (ssname s1 (setq i (1+ i)))) (if (and (vl-position (strcase (vlax-get-property (setq o (vlax-ename->vla-object e)) (if (vlax-property-available-p o 'EffectiveName) 'EffectiveName 'Name) ) ) blocks ) (eq (vla-get-isDynamicBlock o) :vlax-true) ) (LM:SetDynamicPropValue o "STA" statxt) ) ) ) ; End (EXTEK_EndErrorTrap) (setvar "cmdecho" 1) (princ (strcat "\n Stationing:" statxt "")) (princ) );;------------=={ Set Dynamic Property Value }==--------------;;;; ;;;; Modifies the value of a Dynamic Block Property ;;;;------------------------------------------------------------;;;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;;;;------------------------------------------------------------;;;; Arguments: ;;;; block - VLA Dynamic Block Reference Object ;;