Hey guys, thanks for your input.
... it seems the easiest way to go about it would be to place a wipeout around the text portion, and make a group from the dimension and the wipeout. Throwing a reactor in so that the wipeout updates when the text changes is even better.
Bob, I appreciate your idea, my problem is, I don't know how to do that.
I've been trying to make the following code work, but every time I edit it, it no longer works. Then again, I don't know just what I'm doing to make it work correctly. This code will put a box around an associative dimension, making it a part of the entity, but I don't know how to make it a wipeout box.
(setvar "cmdecho" 1)
(vl-load-com)
(prompt "\nEntity-Box Loaded... Start with Command: < txtbx >"
) ;_ end of prompt
;;;---DIMENSION---
(defun msk-dim ()
(setq dim-gap
(vlax-make-variant
(* -0.5 (vla-get-textgap vla-ename-ent))
vlax-vbString
) ;_ end of vlax-make-variant
) ;_ end of setq
(vla-put-textgap vla-ename-ent dim-gap)
) ;_ end of defun
;;;---TEXT---
(defun msk-txt (/ p0 p1 p2 p3 p4 t1 t2 sinrot cosrot list1 list2 margin ang)
(setq e-list (entget ename-ent))
(setq p0 (cdr (assoc 10 e-list))
ang (cdr (assoc 50 e-list))
margin (* 0.425 (cdr (assoc 40 e-list)))
list1 (list (- margin) (- margin) 0.0)
list2 (list margin margin 0.0)
sinrot (sin ang)
cosrot (cos ang)
t1 (mapcar '+ (car (textbox e-list)) list1)
t2 (mapcar '+ (cadr (textbox e-list)) list2)
p1 (list
(+ (car p0) (- (* (car t1) cosrot) (* (cadr t1) sinrot)))
(+ (cadr p0) (+ (* (car t1) sinrot) (* (cadr t1) cosrot)))
) ;_ end of list
p2 (list
(+ (car p0) (- (* (car t2) cosrot) (* (cadr t1) sinrot)))
(+ (cadr p0) (+ (* (car t2) sinrot) (* (cadr t1) cosrot)))
) ;_ end of list
p3 (list
(+ (car p0) (- (* (car t2) cosrot) (* (cadr t2) sinrot)))
(+ (cadr p0) (+ (* (car t2) sinrot) (* (cadr t2) cosrot)))
) ;_ end of list
p4 (list
(+ (car p0) (- (* (car t1) cosrot) (* (cadr t2) sinrot)))
(+ (cadr p0) (+ (* (car t1) sinrot) (* (cadr t2) cosrot)))
) ;_ end of list
) ;_ end of setq
(command "pline" p1 "w" "0" "0" p2 p3 p4 "c")
) ;_ end of defun
;;;---MTEXT---
(defun msk-mtxt (/ minpoint maxpoint t1a t2a list1 list2 margin)
(vla-GetBoundingBox vla-ename-ent 'minpoint 'maxpoint)
(setq t1a (vlax-safearray->list minpoint))
(setq t2a (vlax-safearray->list maxpoint))
(setq e-list (entget ename-ent))
(setq margin (* 0.425 (cdr (assoc 40 e-list)))
list1 (list (- margin) (- margin) 0.0)
list2 (list margin margin 0.0)
t1a (mapcar '+ t1a list1)
t2a (mapcar '+ t2a list2)
) ;_ end of setq
(command ".rectangle" t1a t2a)
) ;_ end of defun
;;;-----------MAIN-------------
(defun c:txtbx ()
(setvar "cmdecho" 1)
(setq oldos (getvar "osmode"))
(setvar "osmode" 0)
(vl-load-com)
(initget 1)
(setq ename-ent (car (entsel "\nPick an Entity:")))
(if ename-ent
(progn
(setq vla-ename-ent (vlax-ename->vla-object ename-ent))
(cond ((vlax-property-available-p vla-ename-ent "textgap") (msk-dim))
((= "AcDbText" (vla-get-objectname vla-ename-ent)) (msk-txt))
((= "AcDbMText" (vla-get-objectname vla-ename-ent)) (msk-mtxt))
(T (alert "Not possible....."))
) ;_ end of cond
) ;_ end of progn
(alert "You did not select anything")
) ;_ end of if
(setvar "osmode" oldos)
(setvar "cmdecho" 1)
(princ)
) ;_ end of defun
I want to take the text and mtext box creation out, I don't need it. But I've tried everything I can think of and everything I can find in my dismal amount of time I can't get it to work after I start editing it.
LE asked:
Why you do not hire a professional to do, what you are looking for?
Then what is the purpose of the Swamp? I was to the understanding that we come here to talk about code, to learn and to grow. Perhaps I mis-spoke myself, I am very interested in learning the code. I don't post here often because I would prefer to learn it rather than have you good people doing things for me. I come here to get ideas and to give ideas when I can, but I try to make the code work before I post a question and ask for help. I have searched high and low, through ALL of the archives here and ALL of the archives from Cadalyst's Get-the-Code to try and find something that will give me an idea of how to make a wipeout around a dimension string. I haven't found anything. I have struggled for weeks, going through the VL help files from Autodesk to Nemi's Pacifier, but I'm missing something, or more than just a something & I don't know what it is. I don't know how to put reactors together. I don't know what sequence is needed get a file, create something, replace something and release the file with VL.
Look, I love writing code. If I knew enough to be effective, I'd give fish out all day. But the truth of the matter is, I've got to learn to fish before I can give it out.
Mark stated:
It's not that I wouldn't do it because I believe it would be a worth while application for everyones use. But what you're asking for is lot of work for me, assuming I could write such an application, and I just don't have the time to invest in it right now. Even the professional programmers here would have to spend many hours on such an application. /guess
Thank you Mark, I appreciate your comment and concern. I understand your time and everyone elses time is important. And your mentioning of taking many hours to write such a code shows my lack of understanding of the task. Perhaps there is my first mistake, I am thinking it would not take very long to do. But then, I put together little projects like callout marks and hold-down symbols which, I have gotten quite resourceful at & it doesn't take me very long to put those together any more.
I have a wipeout mask created for bubble cuts, shear wall callouts and footing callouts. But I don't know how to extract the text gap box of an attribute block or the dimension string to create a simple wipeout box for the text at some angle.
I was hoping that if someone could throw together a program that would do this (a wipeout box integrated into a dimension string), I would be able to take that example and expand upon it to create a similar thing for attributed blocks and other text as well.