Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hai, i need a help in a lisp code. I have a working lisp routine which gives me distance(chainage) of pline when clicked on the pline i selected. It will add a text there showing chainage.
Only thing i want is i need the chainage also in an external Excel Workbook cell. Like when i click and get the chainage there i want to get that chainage in excel workbook cell which is open (like Click to Xls lisp).
Pls reply if its possible... thanks🙂
Attaching the lisp file and also adding same lisp code below.
;-- PIPE CHAINAGE abhi- CAA --
(defun c:CAA (/ s p c tp sch f)
(setvar "cmdecho" 0)
(setq sch (getstring "\nSpecify start chainage : <0>")) ;"0" is set as the default value
(if (= sch "")(setq sch "0"))
(if
(and (setq s (car (entsel "\nPick a polyline :")))
(or (= (cdr (assoc 0 (entget s))) "LWPOLYLINE")
(alert "Invalid object! Please pick a polyline only.")
)
)
(while
(and
(setq
p (getpoint "\nSpecify point :")
)
(setq c (vlax-curve-getclosestpointto s p))
(setq tp (getpoint "\nSpecify Point for Text : "))
)
(setq di (vlax-curve-getdistatpoint s c))
(setq f (fix (/ di 1000.0)))
(setq di (- di (* f 1000.0)))
(command "_.LEADER" c tp ""
(strcat "FF-LINE 01" )
(strcat "CH=" (itoa (+ (atoi sch) f)) "+" (rtos di 2 3))
""
)
(vlax-put-property (vlax-ename->vla-object (entlast)) 'height 3.50);;; Text Height 3.50
)
)
(setvar "cmdecho" 1)
(princ)
)
(vl-load-com)
Solved! Go to Solution.