• <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, 評論 - 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 閱讀(365) 評論(0)  編輯 收藏 引用


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


            亚洲人成电影网站久久| 亚洲熟妇无码另类久久久| 国产精品久久久久国产A级| 国产一久久香蕉国产线看观看| 国内精品久久久久| 久久精品亚洲乱码伦伦中文| 久久婷婷午色综合夜啪| 久久国产高潮流白浆免费观看| 久久影院午夜理论片无码| 久久综合亚洲鲁鲁五月天| 久久精品成人免费看| 狠狠精品久久久无码中文字幕| 久久精品国产亚洲综合色| 青青青青久久精品国产h久久精品五福影院1421| 日日狠狠久久偷偷色综合96蜜桃 | 久久国产亚洲精品麻豆| 青青久久精品国产免费看| 久久久噜噜噜久久中文福利| 国内精品久久久久久久coent| 亚洲精品乱码久久久久久中文字幕| 久久国产精品免费一区| 性欧美丰满熟妇XXXX性久久久| 亚洲国产高清精品线久久 | 久久久中文字幕| 日本欧美久久久久免费播放网| 久久久亚洲裙底偷窥综合| 亚洲一区二区三区日本久久九| 久久精品国产亚洲AV无码娇色 | 久久久久亚洲av成人无码电影| 97久久精品国产精品青草| 久久综合视频网| 国产亚洲美女精品久久久| 久久久精品午夜免费不卡| 国产精品无码久久久久久| 国产色综合久久无码有码| 欧美日韩精品久久久久| 国产精品中文久久久久久久 | 新狼窝色AV性久久久久久| 国产69精品久久久久观看软件| 最新久久免费视频| 亚洲精品国产自在久久|