View Full Version : Change Text to Attribute
bhughes.68125
2004-08-11, 06:02 PM
Is anyone aware of a way to change tesxt into a block or attribute.
I am trying to assess the number of items on a drawing identified by the same prefix i.e. xx-20
mjfarrell
2004-08-11, 06:09 PM
This type of query would be easy to do with MAP
you would only need it to search for that text value.
In regular ACAD, use QSELECT in opbject properties manager
have it look for MTEXT entities, look for Contents and set it
to WILDCARD matching.
This should return a selection set for you of the total number
of these itms.
bhughes.68125
2004-08-11, 06:47 PM
I tried this for text & Mtext selecting Contents, Wildcard match and inputting xx* in for the value. It reports 0 items selected however a number of them exist.
What am I doning wrong?
Also, I am trying to evaluate the information linking it with data in Excel. Is there anyway to export the findings to Excel other than attribute extractions?
mjfarrell
2004-08-11, 07:04 PM
Perhaps you could wblock a few of the out and post them here
so that I can see what you really have.
Other than that try xx-* as that appears to be the format you
have listed above. As this is the manner I input to test.
mjfarrell
2004-08-11, 07:11 PM
When you say data that is linked to Excel
is through DBconnect?
bhughes.68125
2004-08-11, 07:24 PM
No.
What I am trying to do is:
Each item I want to work with is labelled as "SS-XX" where the XX is a reernece number. These items have the same features but indiffering quantitities. I am trying to claculate the total quantities of each type and total features.
i.s. ss-1 has 2 outlets, SS-5 has 3 outlets
scott.wilcox
2004-08-12, 01:36 PM
If you are simply trying to count instances of text in a drawing, you can use FIND to defing the search parameter, i.e. xx-21 and click replace all in the dialogue box. AutoCAD will tell you how many instances it changed. You can undo to get the original text back and re-run FIND for the remaining variables.
Scott
Mike.Perry
2004-08-20, 11:19 PM
Hi
Done.
Thread moved from the ACAD 2005 General (http://forums.augi.com/forumdisplay.php?f=58) Forum to this one.
You might consider adding some additional information to your original request so people can get a better picture of exactly the kind of thing you're after.
Thanks, Mike
Forum Moderator
peter
2004-09-11, 02:23 PM
If I understand what you are trying to do is find every instance of a certain text string whether it occurs in a block attribute, text, or mtext.
Maybe this little routine will help
Peter Jamtgaard
(defun C:FindIt (/ intCount intTotal entSelection objAttribute
objSelection ssSelections strToFind )
(setq strToFind (getstring "\nEnter string to find: ")
ssSelections (ssget "x" (list (cons 0 "TEXT,*INSERT")))
intTotal 0
)
(repeat (setq intCount (sslength ssSelections))
(setq intCount (1- intCount)
entSelection (ssname ssSelections intCount)
objSelection (vlax-ename->vla-object entSelection)
)
(if (or (= (vla-get-objectname objSelection) "AcDbMInsertBlock")
(= (vla-get-objectname objSelection) "AcDbBlockReference")
)
(if (= (vla-get-hasattributes objSelection) :vlax-true)
(foreach objAttribute (getAttributes objSelection)
(if (vl-string-search strToFind (vla-get-textstring objAttribute))
(setq intTotal (1+ intTotal))
)
)
)
(if (vl-string-search strToFind (vla-get-textstring objSelection))
(setq intTotal (1+ intTotal))
)
)
)
(princ "\nThe string occurs ")
(princ intTotal)
(princ " times.")
(princ)
)
(defun GetAttributes (objSelection /)
(if (= (type objSelection) 'ename)
(setq objSelection (vlax-ename->vla-object objSelection))
)
(if (= (vla-get-hasattributes objSelection) :vlax-true)
(vlax-safearray->list
(variant-value
(vla-getattributes objSelection)
)
)
)
)
(princ "\nC:FindIt ")
(prin1)
bhughes.68125
2004-09-14, 07:51 PM
Thank you Peter. This does a portion of what I was looking for.
I would like to replace the text found with a block. The block would contain an attribute with containing the text that was found.
The whole purpose is to extract the attribute information for use in a spreadsheet.
Thanks for your input
kennet.sjoberg
2004-09-14, 09:05 PM
Why not extract the text in the first place ?
( find text and write code to a file )
Happy Computing !
kennet
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.