• <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
            數據加載中……

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

            色综合久久久久综合体桃花网 | 久久婷婷五月综合色奶水99啪| 色欲综合久久躁天天躁| 欧美麻豆久久久久久中文| 久久天天躁狠狠躁夜夜2020一| 无码日韩人妻精品久久蜜桃| 99久久精品午夜一区二区| 国产精品嫩草影院久久| 亚洲综合伊人久久大杳蕉| 97r久久精品国产99国产精| 亚洲国产成人精品91久久久| 久久精品蜜芽亚洲国产AV| 久久国产精品免费| 麻豆一区二区99久久久久| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 国产V综合V亚洲欧美久久| 久久久久国色AV免费看图片| 久久久国产乱子伦精品作者 | 国内精品人妻无码久久久影院导航 | 精品久久久无码人妻中文字幕豆芽| 品成人欧美大片久久国产欧美| 日韩乱码人妻无码中文字幕久久| 久久久精品国产亚洲成人满18免费网站| 久久精品国产亚洲AV香蕉| 久久久久无码国产精品不卡| 久久99国产精品久久久| 久久综合香蕉国产蜜臀AV| 亚洲中文字幕伊人久久无码| 国产精品久久久久一区二区三区| 国产91色综合久久免费| 人妻无码αv中文字幕久久琪琪布| 性做久久久久久久久浪潮| 国产综合免费精品久久久| 久久夜色精品国产亚洲| 国产精品一久久香蕉产线看| 浪潮AV色综合久久天堂| 久久99精品国产自在现线小黄鸭| 狠狠色丁香久久婷婷综合蜜芽五月| 久久精品国产黑森林| 久久精品夜色噜噜亚洲A∨| 久久婷婷五月综合97色直播|