Sweety Posted September 1, 2010 Posted September 1, 2010 Hello GUYS How are you all ? 1* how can I get the Name of Text Style and Dimension Style as well . Thankxxxxxxxxxxxx Sweety. :wink: Quote
migs Posted September 1, 2010 Posted September 1, 2010 Can you explain further what your looking to do Quote
lpseifert Posted September 1, 2010 Posted September 1, 2010 Look in Help for the sysvars Textstyle & Dimstyle (getvar "...") Quote
Lt Dan's legs Posted September 1, 2010 Posted September 1, 2010 (edited) (getvar 'textstyle) (getvar 'dimstyle) ***for current style's Edited September 1, 2010 by Lt Dan's legs more info Quote
JohnM Posted September 1, 2010 Posted September 1, 2010 look at the tblsearch and tblnext functions Quote
BlackBox Posted September 1, 2010 Posted September 1, 2010 This will give you the styles for Text and Dimension objects: vla-get-textstyle (Dims only) vla-get-stylename (Text, Mtext, and Dims) Quote
Sweety Posted September 1, 2010 Author Posted September 1, 2010 Thank you GUYS. *** AMAAAAAAAAAAAZING *** 1- Thank you Mr.Lt Dan that was useful and direct . 2- Thank you Mr. johnM your suggestion is really nice, and I found out that both are the same result. (tblnext "style" "standard") ((0 . "STYLE") (2 . "Standard") (70 . 0) (40 . 0.0) (41 . 1.0) (50 . 0.0) (71 . 0) (42 . 0.2) (3 . "ARIAL.TTF") (4 . "")) (tblsearch "style" "standard") ((0 . "STYLE") (2 . "Standard") (70 . 0) (40 . 0.0) (41 . 1.0) (50 . 0.0) (71 . 0) (42 . 0.2) (3 . "ARIAL.TTF") (4 . "")) 3- Mr. Renderman This time I couldn't deal with your codes .and I couldn't find them in Help to search for way of implementing them. So would you please complete them for me ? many many THANKXXXXXXXXXX. Sweety. Quote
BlackBox Posted September 1, 2010 Posted September 1, 2010 (edited) 3- Mr. Renderman This time I couldn't deal with your codes .and I couldn't find them in Help to search for way of implementing them. So would you please complete them for me ? Sorry for the confusion. The functions I provided you are for extracting the style information from text and dimension objects within your drawing. For example: If you have text in a drawing from another company, and you want to copy that text into your drawing, but their text style(s) aren't the same as your text style. In this example, let's assume "Standard" is your text style, so we'll look for anything that is "Non-Standard" and replace it... Sample: (defun c:TEST (/ ss count) (vl-load-com) (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object))))) (prompt "\n >> Checking for non-standard text styles... ") (if (setq ss (ssget "_x" '((0 . "TEXT,MTEXT") (-4 . "<not") (7 . "Standard") (-4 . "not>")))) (progn (vlax-for x (setq ss (vla-get-activeselectionset *activeDoc*)) (vla-put-stylename x "Standard")) (prompt (strcat "\n<< " (cond ((= "1" (setq count (itoa (vla-get-count ss)))) (strcat count " text object corrected! ")) ((strcat count " text objects corrected! "))))) (vla-delete ss)) (prompt "\n<< All text objects have \"standard\" text style ")) (terpri) (princ)) Edit: You can find more information on these and other VL*- functions inside the VLIDE, using the Apropos button, or look under the ActiveX and VBA Reference in the Developer Documentation Edit: Code revised for accuracy. Hope this helps! Edited September 1, 2010 by BlackBox VL*- reference Quote
Sweety Posted September 1, 2010 Author Posted September 1, 2010 Thank you Renderman for the codes that you provided. And there were some extra brackets and I hope you don't mind as I did remove them. (prompt (strcat "\n<< " (cond ((= 1 (setq count (itoa (vla-get-count ss)))) [b][color="red"]([/color][/b]" text object corrected! "[color="red"][b])[/b][/color]) ((strcat count " text objects corrected! "))))) (vla-delete ss)[b][color="red"])[/color][/b] After that it has worked well. BUT. I haven't seen the codes that you have given in your post No.6 . Thank you for your kindness. Sweety. Quote
BlackBox Posted September 1, 2010 Posted September 1, 2010 ... there were some extra brackets and I hope you don't mind as I did remove them. ... After that it has worked well. ... Thank you for the correction. I guess that's what I get for trying to quickly type out my code from within the text editor, instead of the VLIDE. (setq RM "RenderMan is lazy") I haven't seen the codes that you have given in your post No.6 . ... I had hoped that you could deduce their meaning by the key word differences 'get' instead of 'put', but that's ok. As a quick example of the functions from post #6, try this: (defun c:GETSTYLE (/ ss objName styleName) (vl-load-com) (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object))))) (prompt "\n >> Select dimension or text to list style information: ") (if (setq ss (ssget ":S:E" '((0 . "DIMENSION,TEXT,MTEXT")))) (progn (vlax-for x (setq ss (vla-get-activeselectionset *activeDoc*)) (alert (strcat (cond ((wcmatch (setq objName (vla-get-objectname x)) "AcDb*Dimension") (strcat "Dimension Selected: \n\n" "Text Style =\t" ([color=blue]vla-get-textstyle[/color] x) "\nDim Style =\t" ([color=blue]vla-get-stylename[/color] x))) ((vl-position objName '("AcDbText" "AcDbMText")) (strcat "Text Selected: \n\n" "Text Style =\t" ([color=blue]vla-get-stylename[/color] x))))))) (vla-delete ss))) (princ)) Does this example make sense for you? Quote
Sweety Posted September 1, 2010 Author Posted September 1, 2010 (setq RM "RenderMan is lazy") That's a very kind of you, and I did like the way you are using Lisp in life. Does this example make sense for you? Of course it does. I thank you for great help that you have been giving me. It's greatly appreciated. Sweety. Quote
Sweety Posted September 3, 2010 Author Posted September 3, 2010 Thank you all GUYS. One more question please. How can I get the height of the current text style but not "textsize" . Thanks. Quote
Lee Mac Posted September 3, 2010 Posted September 3, 2010 Something like this... In VL: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color] [/b][color=black]GetTextStyleHeight[/color][b][color=black] [/color][/b][b][color=RED]([/color][/b] Style [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; © Lee Mac 2010[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-catch-all-error-p[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] style [b][color=RED]([/color][/b][b][color=BLUE]vl-catch-all-apply[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]vla-item[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-TextStyles[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ActiveDocument[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-get-acad-object[/color][/b][b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] style [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]zerop[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-Height[/color][/b] style[b][color=RED]))[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-LastHeight[/color][/b] style[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-Height[/color][/b] style[b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] In Vanilla: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] [color=black]GetTextStyleHeight[/color] [b][color=RED]([/color][/b] Style [b][color=RED])[/color][/b] [i][color=#990099];; © Lee Mac 2010[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] style [b][color=RED]([/color][/b][b][color=BLUE]tblsearch[/color][/b] [b][color=#a52a2a]"STYLE"[/color][/b] style[b][color=RED]))[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]zerop[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]40[/color][/b] style[b][color=RED])))[/color][/b] [b][color=#009900]42[/color][/b] [b][color=#009900]40[/color][/b][b][color=RED])[/color][/b] style [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] Quote
Sweety Posted September 3, 2010 Author Posted September 3, 2010 I did not get it so far. Lee. Why you are complicating things to me ? Thanks Quote
BlackBox Posted September 3, 2010 Posted September 3, 2010 (edited) LOL! :: Lee :: I think what Sweety meant, was that she doesn't understand Visual LISP very well, Lee. I don't think she meant anything by it. :: Sweety :: Lee's code is much better than my own quick routines, but as an alternative, perhaps these [inferior] routines make more sense to you..? This will tell you the current text style's height: (defun c:CURTXTHGT () (vl-load-com) (prompt (strcat "\n << Current Text Style Height = " (rtos (vla-get-height (vla-get-activetextstyle (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))))) " >> ")) (princ)) Edit: This could be used as a sub-function in another routine: (defun CURTXTHGT () (vl-load-com) (vla-get-height (vla-get-activetextstyle (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))))) This will show you all the information for the current text style: (defun c:DUMPCURTXTSTY () (vl-load-com) (vlax-dump-object (vla-get-activetextstyle (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))) T) (textpage) (princ)) Hope this helps! Edited September 3, 2010 by BlackBox Added (vl-load-com) Quote
Sweety Posted September 3, 2010 Author Posted September 3, 2010 Mr. Renderman. You have forgotten to add (vl-load-com). And your routine can not help me as a part to be added to mine. I wonder why. Last thing. Should I include that big defun to get only the height of a text style ? Thanks Quote
Lee Mac Posted September 3, 2010 Posted September 3, 2010 Sweety, If you were to use mine, you would call it as a subfunction from your main code, supplying it with the name of the style you wish to query: (GetTextStyleHeight "Standard") It will thus return the height should the style be present. Quote
Sweety Posted September 3, 2010 Author Posted September 3, 2010 Something like this...(defun GetTextStyleHeight ( Style ) ;; © Lee Mac 2010 (if (setq style (tblsearch "STYLE" style)) (cdr (assoc (if (zerop (cdr (assoc 40 style))) 42 40) style ) ) ) ) Thanks Lee. Can you please tell me why did you add Zerop and 42 40 in your codes, although the text can not be zero. Appreciated. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.