boesiii
2006-02-17, 01:44 AM
I have a routine that places text along a polyline at a specified distance for utilities, such as waterlines and gaslines. I would like to trim the line around the text. Is there a way to do this. I am having trouble with it.
(defun rtd (a)
(* (/ a pi) 180.0)
)
(defun dtr (a)
(* (/ a 180.0) pi)
)
(defun c:annotate_utility (/ u_line)
(setq c_osmode (getvar "osmode"))
(setvar "osmode" 0)
(setq u_line (car (entsel "\nSelect Line or Polyline to be Stationed: ")))
(setq u_text (getstring "\nEnter Text (ex: W = Waterline): "))
(setq u_text_dist 25)
(vl-load-com)
(vlax-ename->vla-object u_line)
(setq total_length (vlax-curve-getDistAtPoint u_line (vlax-curve-getEndPoint u_line)))
(setq total_dist u_text_dist)
(while (<= total_dist total_length)
(progn
(setq u_point (vlax-curve-getPointAtDist u_line total_dist))
(setq u_point2 (vlax-curve-getPointAtDist u_line (+ 0.001 total_dist)))
(setq u_ang (rtd (angle u_point u_point2)))
(setq u_point3 (polar u_point (+ u_ang (dtr 90)) 1))
(setq u_point4 (polar u_point (+ u_ang (dtr 270)) 1))
(command "text" "j" "mc" u_point u_ang u_text)
;(command "trim" "l" "" "f" u_point3 u_point4 "" "")
(setq total_dist (+ total_dist u_text_dist))
);progn
);while
(princ "\n******Utiltiy Anno Worked*******")
(princ)
)
[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]
(defun rtd (a)
(* (/ a pi) 180.0)
)
(defun dtr (a)
(* (/ a 180.0) pi)
)
(defun c:annotate_utility (/ u_line)
(setq c_osmode (getvar "osmode"))
(setvar "osmode" 0)
(setq u_line (car (entsel "\nSelect Line or Polyline to be Stationed: ")))
(setq u_text (getstring "\nEnter Text (ex: W = Waterline): "))
(setq u_text_dist 25)
(vl-load-com)
(vlax-ename->vla-object u_line)
(setq total_length (vlax-curve-getDistAtPoint u_line (vlax-curve-getEndPoint u_line)))
(setq total_dist u_text_dist)
(while (<= total_dist total_length)
(progn
(setq u_point (vlax-curve-getPointAtDist u_line total_dist))
(setq u_point2 (vlax-curve-getPointAtDist u_line (+ 0.001 total_dist)))
(setq u_ang (rtd (angle u_point u_point2)))
(setq u_point3 (polar u_point (+ u_ang (dtr 90)) 1))
(setq u_point4 (polar u_point (+ u_ang (dtr 270)) 1))
(command "text" "j" "mc" u_point u_ang u_text)
;(command "trim" "l" "" "f" u_point3 u_point4 "" "")
(setq total_dist (+ total_dist u_text_dist))
);progn
);while
(princ "\n******Utiltiy Anno Worked*******")
(princ)
)
[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]