# How to use civil 3D commands in a Python Script?

**URL:** <https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779>\
**Category:** Civil 3D\
**Tags:** python, dynamo\
**Created:** [July 2, 2021, 5:21pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779 "2021-07-02T17:21:02Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![patrick.ericson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/patrick.ericson/32/121411_2.png) [@patrick.ericson](https://forum.dynamobim.com/u/patrick.ericson)\
**Post date:** [June 14, 2022, 8:14pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/21 "2022-06-14T20:14:58Z")

</div>

Agree with @WrightEngineering  
Thanks Ken for sharing. That was a great example how to add the command in the correct flow And I think it also gives us the possibility to sen additional information to the command line

---

<div class="post-metadata">

**Author:** ![hestingjj](https://avatars.discourse-cdn.com/v4/letter/h/bbe5ce/32.png) [@hestingjj](https://forum.dynamobim.com/u/hestingjj)\
**Post date:** [August 23, 2022, 3:30pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/22 "2022-08-23T15:30:09Z")

</div>

Is there a way to send an object to the command line within a command? I am trying to run the xclip command based on this post.

The inputs would be as follows:

1. “xclip” + “\n” (Initiate Command)
2. Select xrefs “\n” (I don’t think this can be input as a string, needs to be the objects)
3. “N” + “\n” (New Boundary)
4. “S” + “\n” (Select Polyline)
5. Select Polyline “\n” (Select polyline object, I don’t think this input can be a string either)

There are two inputs to get through the xclip function that cannot be strings as far as I can tell. How would I need to go about passing those through the command line? I would prefer to use python if possible.

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/d/edf7679bf2fdacee0720fac3190fbe65b7931b7f.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/0/704b32a37624da112ca837ea389a5261869b026a.png)

---

<div class="post-metadata">

**Author:** ![Ahmed.Kamal.Moussa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ahmed.kamal.moussa/32/179234_2.png) [@Ahmed.Kamal.Moussa](https://forum.dynamobim.com/u/Ahmed.Kamal.Moussa)\
**Post date:** [October 2, 2022, 12:40pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/23 "2022-10-02T12:40:09Z")

</div>

Did you try Camber package node “Document.SendCommand”?

---

<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 3, 2022, 9:01am UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/24 "2022-10-03T09:01:06Z")

</div>

@hestingjj EDIT: ohhh I just realized this is a month old post, anyway if it has not been solved yet, maybe this helps.

I don’t know if object can be fed as selection, as a workaround try xclip “All” or unload the xref you don’t want to clip and xclip “CP” and add the boundary polygon vertices coordinates as string input.

`"xclip"+" cp "+rectangular+"\n"+"N"+"\n"+"P"+"\n"+rectangular+"\n";`

the coordinates input form:  
`"584309.354,95027.656 585577.751,95027.656 585577.751,93720.350 584309.354,93720.350 "`  
I added two spaces to the end. The new lines are sometimes tricky for me, but this way it worked.

![acad_qYdZTrslHq](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/5/15a9ce5d77c4ccf4b73a5a9acf8142c5a2ae7e7f.gif)

---

<div class="post-metadata">

**Author:** ![dineshsubramani](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dineshsubramani/32/159417_2.png) [@dineshsubramani](https://forum.dynamobim.com/u/dineshsubramani)\
**Post date:** [August 28, 2023, 8:37am UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/25 "2023-08-28T08:37:50Z")

</div>

Hi @zachri.jensen where can I find the node in camber package

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [August 28, 2023, 1:55pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/26 "2023-08-28T13:55:21Z")

</div>

If you don’t see it, you likely need to update Civil 3D. Make sure you have the latest updates installed for Civil 3D 20XX.

---

<div class="post-metadata">

**Author:** ![hestingjj](https://avatars.discourse-cdn.com/v4/letter/h/bbe5ce/32.png) [@hestingjj](https://forum.dynamobim.com/u/hestingjj)\
**Post date:** [August 29, 2023, 5:54pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/27 "2023-08-29T17:54:36Z")

</div>

Is there a way to use SendCommand when working with an External Document?

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/d/4d9d21f712425d7fcaecdf702eaf84e7eb9f85d0.png)

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [August 29, 2023, 8:33pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/28 "2023-08-29T20:33:10Z")

</div>

No, sorry.

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [October 15, 2023, 7:48pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/29 "2023-10-15T19:48:28Z")

</div>

Split this topic on October 15, 2023, 7:48pm UTC

2 posts were merged into an existing topic: [Wipeout from Polyline](https://forum.dynamobim.com/t/wipeout-from-polyline/94544/5)

---

<div class="post-metadata">

**Author:** ![Tommy](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@Tommy](https://forum.dynamobim.com/u/Tommy)\
**Post date:** [December 28, 2023, 7:06pm UTC](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779/30 "2023-12-28T19:06:34Z")

</div>

This is a great little node. Is there a way to do the opposite? Getting the command line output into a watch node in dynamo would be great, not to mention all the other things you could chain together from there if you were ‘talking’ to the command line the old fashioned way.

[Previous page](https://forum.dynamobim.com/t/how-to-use-civil-3d-commands-in-a-python-script/65779.md?page=1)
