• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Life is Good.

            Enhance Tech and English
            隨筆 - 65, 文章 - 20, 評(píng)論 - 21, 引用 - 0
            數(shù)據(jù)加載中……

            How to Use (handent …) Safely

            Caution around (handent …) Function

             

            If not used carefully, this function can easily generate “bad argument type: stringp nil” or “bad argument type: lentityp nil” errors in our product. The purpose of this function is to convert a hexadecimal text string value that represents an object “handle” ID into an entity name assignment. AutoCAD uses this entity name to access the target object in the drawing. This ascii text string is the function’s only argument.

             

            The most serious problem occurs immediately if the passed string value is nil. Our program will exit with a “bad argument type: stringp nil” error.  

            A real-world example: here is a line of code that triggered a recent regression ():

             

                        (setq layername (cdr (assoc 8 (entget (handent entname)))))

             

            In this example, the variable “netwire” could, under certain conditions, be passed as a value of nil instead of as an ASCII text string giving the handle number. The function (handent netwire) that is embedded in the line of code above fails with the error message “bad argument type: lentityp nil”. You can simulate this at the command line. Type in this sequence:  (setq netwire nil) [Enter] and then (handent netwire) [Enter].

             

            The above line of code has a second potential problem. Even if “netwire” is not nil but is an ASCII text string, it might not convert to a valid entity name in the active drawing. In this case, the (handent…) function will not fail but will simply return nil. But, this creates a downstream problem. The nil value gets passed to the (entget…) function. When passed a nil value instead of a valid entity name, the (entget…) function fails. The program stops with the error “bad argument: lentityp nil”. You can simulate this at the command line by typing this:  (entget (handent “ABCD1234”)) [Enter]

             

             

            How to Use (handent …) Safely

             

            In the above example, two checks are needed. First check is to make sure that “netwire” is not a nil value. The second is that “netwire” is a valid handle ID for an entity in the target drawing. So, these two checks might be coded up like this:

             

            (if (AND entname(handent entname) (entget (handent entname))) (setq layername (cdr (assoc 8 (entget (handent entname))))))

             

            … or, a written a bit more efficiently…

             

            (if (AND entname(setq en (handent entname)) (entget en)) (setq layername (cdr (assoc 8 (entget en)))))

            posted on 2008-07-31 15:00 Mike Song 閱讀(366) 評(píng)論(0)  編輯 收藏 引用


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            日本道色综合久久影院| 日本亚洲色大成网站WWW久久| 亚洲精品国精品久久99热| 亚洲午夜久久久久久噜噜噜| 国产成人精品久久免费动漫| 午夜精品久久久内射近拍高清| 久久久久波多野结衣高潮| 久久精品国产精品亚洲人人| 久久精品国产日本波多野结衣 | 欧美粉嫩小泬久久久久久久| 欧洲精品久久久av无码电影| 久久天天躁狠狠躁夜夜不卡 | 思思久久99热免费精品6| 久久国产精品99精品国产| 亚洲午夜无码久久久久小说| 精品亚洲综合久久中文字幕| 久久久久久九九99精品| 亚洲天堂久久久| 少妇久久久久久被弄到高潮| 日本福利片国产午夜久久| 国产A三级久久精品| 久久久久亚洲AV无码去区首| 亚洲成人精品久久| 国产精品女同久久久久电影院| 久久天天躁狠狠躁夜夜不卡| 久久天天躁夜夜躁狠狠躁2022| 久久精品国产第一区二区| 久久se这里只有精品| 99久久国产综合精品女同图片| 精品久久久久久无码中文字幕| 国产精品欧美久久久天天影视| 欧美一区二区三区久久综| 国产69精品久久久久9999APGF | 久久精品国产一区二区| 久久综合狠狠综合久久激情 | 精品久久777| 国产福利电影一区二区三区久久老子无码午夜伦不 | 欧美久久精品一级c片片| 99久久99久久精品免费看蜜桃 | 久久精品国产秦先生| 久久精品国产99国产精品澳门|