Keith™ 发表于 2008-8-18 15:20:34

Text is Null

Is there any property or telltale way to know if you ahve null text in your drawing?The only thing I can think of is if the contents contain a space only, as in " "
Any other ideas of how to find stupidity running rampant in the office?

Atook 发表于 2008-8-18 15:28:07

(ssget "x" '((0 . "TEXT")(1 . ""))
(ssget "x" '((0 . "TEXT")(1 . " "))
(ssget "x" '((0 . "TEXT")(1 . "")) 'to infinity and beyond
or you could turn on qtext and regen ... "null" text should show up as points in the drawing

Rogue 发表于 2008-8-18 16:14:55

maybe something along the lines of:
if len(Trim(objtext.textstring))=0 then
' fight for whirled peas
end if

Rogue 发表于 2008-8-18 16:41:05

Thank you to all three!!! I used a combined versioin of what you guys posted and it works great

Atook 发表于 2008-8-19 12:35:25

If any of you have done database programming, you might remember there is a difference between an empty string ("") and a NULL one.
And I believe any other string that contains 1-to-many space characters (Chr(32)) isnt Null, or an empty string.
One of the ways to check for Nulls is to read the variables in as variants, and check for IsNull. And then, if it is, add an empty string to it ("") to convert to string.

Atook 发表于 2008-8-19 15:56:03

Whilst that would be true for an RDBMS, which AutoCAD is NOT, a simpler idea might be to use regular expressions...
页: [1]
查看完整版本: Text is Null