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

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

1 Like

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

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

@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

1 Like

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

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.

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

image

No, sorry.

2 posts were merged into an existing topic: Wipeout from Polyline

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.