View Full Version : Textmask does not behave in LISP routine
david_massingale
2007-03-21, 04:53 PM
I wrote this routine which places a masked, text object on a polyline or AEC contour object with the elevation of the object as the string. The routine will always place the text correctly, but if I am not zoomed in relatively close to the polyline the text mask will have an unusual shape.
If someone could take a look at for me, I would appreciate it.
Dave Massingale
I wrote this routine which places a masked, text object on a polyline or AEC contour object with the elevation of the object as the string. The routine will always place the text correctly, but if I am not zoomed in relatively close to the polyline the text mask will have an unusual shape.
If someone could take a look at for me, I would appreciate it.
Dave Massingale
Without looking at the routine, it sounds like you have not turned off an osnap prior to placing the mask.
Tom Beauford
2007-03-21, 08:09 PM
I used mtext with background mask for mine. Only one object that way and always displays correctly. It labels contours from our GIS as long as the elevation can be found in "Elev" or "Elevation". ; Annotate a Contour Line
; BY: Tom Beauford - 7/11/2005
; Tombu@LeonCountyFL.gov
; LEON COUNTY PUBLIC WORKS SURVEY & R/W SECTION
; (load "ContourAnnotate.lsp") ContourAnnotate
;=============================================================
(defun c:ContourAnnotate (/ mspace om osz e ent pt Rot str mtextobj ent el)
(setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
om (getvar "osmode")
osz (getvar "osnapz")
)
(setvar "osnapz" 0)
(setvar "osmode" 512)
(setq pt (getpoint"\nSelect point on Contour Line: ")
e (nentselp pt)
ent (car e)
pt (cadr e)
)
(setvar "osmode" 0)
(setq Rot (getangle pt "\nPick or Enter angle..." )
str (rtos (caddr pt) 2 0))
(if(ade_odgettables ent)
(cond
((ade_odgetfield ent (car(ade_odgettables ent)) "ELEVATION" 0)
(setq str (itoa(ade_odgetfield ent (car(ade_odgettables ent)) "ELEVATION" 0))))
((ade_odgetfield ent (car(ade_odgettables ent)) "ELEV" 0)
(setq str (itoa(ade_odgetfield ent (car(ade_odgettables ent)) "ELEV" 0))))
)
)
(setq mtextobj (vla-addMText mspace (vlax-3d-point pt) 0.0 str))
(vla-put-attachmentPoint mtextobj acAttachmentPointMiddleCenter)
(vla-put-insertionPoint mtextobj (vlax-3d-point pt))
(vla-put-Rotation mtextobj Rot)
(vla-put-Color mtextobj 7)
(vla-put-backgroundfill mtextobj :vlax-true); mask on with background color
(setq el (entget (vlax-vla-object->ename mtextobj)))
(setq el (subst (cons 45 1.15) (assoc 45 el) el)) ;Set MaskSize 1.15 × TextSize
(entmod el)
(setvar "osmode" om)
(setvar "osnapz" osz)
(princ)
)
david_massingale
2007-03-22, 04:41 PM
Thanks for the reply. The reason I used text with a wipeout mask is it is better for us, because we plot with the "lines merge" option set to on.
I was able to solve my problem by setting osmode to 0 just before the mask is created.
Thanks,
Dave Massingale
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.