# Python script CAD handle to ObjectByHandle

**URL:** <https://forum.dynamobim.com/t/python-script-cad-handle-to-objectbyhandle/81728>\
**Category:** Civil 3D\
**Tags:** python\
**Created:** [October 4, 2022, 10:29am UTC](https://forum.dynamobim.com/t/python-script-cad-handle-to-objectbyhandle/81728 "2022-10-04T10:29:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kbzawork](https://avatars.discourse-cdn.com/v4/letter/k/d26b3c/32.png) [@kbzawork](https://forum.dynamobim.com/u/kbzawork)\
**Post date:** [October 4, 2022, 10:29am UTC](https://forum.dynamobim.com/t/python-script-cad-handle-to-objectbyhandle/81728/1 "2022-10-04T10:29:34Z")

</div>

Hi … I am using Python Script to read a CAD object. I can get the Object Handle - but that’s an object not a string. The Dnamo Node ObjectByHandle needs a string. How do I get the string in the Python Script (from Database Transaction) for the ObjectByHandle node?

---

<div class="post-metadata">

**Author:** ![kovacsv](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@kovacsv](https://forum.dynamobim.com/u/kovacsv)\
**Post date:** [October 4, 2022, 11:06am UTC](https://forum.dynamobim.com/t/python-script-cad-handle-to-objectbyhandle/81728/2 "2022-10-04T11:06:33Z")

</div>

Hi,  
have you tried the String from Object node or `strhandle = str(handle)`?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/6298701223c7d7376e7ae43f10c926b71f226ecd.jpeg)

---

<div class="post-metadata">

**Author:** ![kbzawork](https://avatars.discourse-cdn.com/v4/letter/k/d26b3c/32.png) [@kbzawork](https://forum.dynamobim.com/u/kbzawork)\
**Post date:** [October 4, 2022, 11:20am UTC](https://forum.dynamobim.com/t/python-script-cad-handle-to-objectbyhandle/81728/3 "2022-10-04T11:20:28Z")

</div>

[vp-client-biind.dwg](https://forum.dynamobim.com/uploads/short-url/rSHpmSHWS5n1CdBzmVtX6SxImok.dwg) (2.8 MB)  
[vpgtext.dyn](https://forum.dynamobim.com/uploads/short-url/rXO4czNvFIEI3vgSt9UtQOdOPQQ.dyn) (45.9 KB)

now I get error not set to instance of object … : ( … I am trying to run before I can walk … I found that the CIVIL3DTOOKIT node Layout.GetViewportByPoint does not support irregular boundary paper space viewports … so … I tried to be clever with script to get around the problem … and … no success so far …

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [October 13, 2022, 6:05pm UTC](https://forum.dynamobim.com/t/python-script-cad-handle-to-objectbyhandle/81728/4 "2022-10-13T18:05:49Z")

</div>

Hi @kbzawork ,

Could you maybe explain further what you are trying to achieve with your script?

> [@kbzawork](#):
>
> now I get error not set to instance of object … : ( … I am trying to run before I can walk … I found that the CIVIL3DTOOKIT node Layout.GetViewportByPoint does not support irregular boundary paper space viewports … so … I tried to be clever with script to get around the problem … and … no success so far …
