Placing block reference using current block reference points in Civil 3D using Dynamo and python

OK following are some quick thoughts. I recommend that you download the Civil 3D Toolkit package (I’ll refer to it as “Toolkit”) if you don’t already have it.

Sounds like you’ve got this part - use the Select Object node. There is a node in the Toolkit to select multiple objects if you want to try and consolidate to one step for the user.

I think there could be a non-Python solution for this. If there are pre-set layers that you know ahead of time (or the user can provide them), then you can use the All Objects on Layer node to build the selection in Dynamo. There are other approaches too, like just selecting everything in modelspace and then filtering the list in Dynamo by the properties that you want (layer, linetype, property sets, etc.). The List.FilterByBoolMask is a go-to for this.

This will be tricky. Dynamo currently only works with the current DWG. You might have a look at the Python code @Paolo_Emilio_Serra1 wrote in this post:

It looks like your block references are rectangles. If that is true all of the time, then I think the Bounding Box nodes will work here. You can use Object.Extents to get the bounding box for the block references, and then use BoundingBox.MaxPoint and BoundingBox.MinPoint to get the corner points. There might also be opportunity to utilize the block reference insertion point, which you can get with the Toolkit node BlockReferenceExtensions.GetInsertionPoint.

This will take some work as well. The easiest way to get user input is to run the graph via Dynamo Player, but this means that all of the inputs have to be provided at the start. If you want to collect user input at an intermediate step, I suggest looking into the UI.MultipleInputForm++ node from the DataShapes package.

I’m thinking you could use the Block.Import node here.

Here is some quick Python code to send a string to the command line:

import System
from System import *

input = IN[0]

app = System.Runtime.InteropServices.Marshal.GetActiveObject("Autocad.Application")
adoc = app.ActiveDocument

adoc.SendCommand(input)							

OUT = str(input) + " sent to command line"