Integrate Dynamo with Autocad

Integrate Dynamo with Autocad

Yonas89
Collaborator Collaborator
43,804 Views
51 Replies
Message 1 of 52

Integrate Dynamo with Autocad

Yonas89
Collaborator
Collaborator

Hello,

 

I am not sure which forum to choose for my question, thus I hope I have chosen the right one. I have read and watched about Dynamo compatibility with Revit and it looks just amazing. However I use Civil 3d in my daily process which is AutoCAD based and though it's  challenging  to combine Dynamo with AutoCAD, I know it's possible, but I don't know how. I would like to discuss with you guys, maybe you have some experience with it or some thoughts to share. I have found this short video here: https://www.youtube.com/watch?v=oiz76GTN-8Y. Sorry that it's in Russian, don't understand Russian but I get the point that AutoCAD objects could be controlled from Dynamo.

Accepted solutions (1)
43,805 Views
51 Replies
Replies (51)
Message 2 of 52

Alexander.Rivilis
Mentor
Mentor

@Anonymous

It is a question for you.

 

@Yonas89

You can ask @Anonymous in PM about Dynamo & AutoCAD.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 52

Anonymous
Not applicable

Hello. You're right, Dynamo can integrate with AutoCAD. Say what you want to solve the problem and I'll show you a solution.

Message 4 of 52

Yonas89
Collaborator
Collaborator

Hello, thanks a lot for tagging the author of the video. This is great.

Message 5 of 52

Yonas89
Collaborator
Collaborator

Hello @Anonymous, 

I do not have any specific task yet actually, I am just trying to understand the limits of Dynamo  implementation in civil engineering.  I think that Civil 3D with Subassembly composer is okay for making dynamic road. However I am thinking to use Dynamo for making some infrastructure elements such as intersections, roundabouts, driveways or culverts to make it parametric as much as possible.

0 Likes
Message 6 of 52

Anonymous
Not applicable
Accepted solution

Well, if you do not have a specific task, then I'll show you how to build the line in the open AutoCAD file.

DyAcad MakeLines.jpg

 

restart = IN[0]
if IN[1] != True: off = 1/0

import clr

clr.AddReference('ProtoGeometry')
import Autodesk
from Autodesk.DesignScript.Geometry import *

import System
from System import *

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

lines = IN[2]

def ptA(p):
	return Array[float]([p.X, p.Y, p.Z]) 


for k in lines:
	stpt = ptA(k.StartPoint)
	enpt = ptA(k.EndPoint)
	linn = AcDoc.ModelSpace.AddLine(stpt, enpt)

 

 

Message 7 of 52

Anonymous
Not applicable

Download Dynamo file https://yadi.sk/d/TEdi5lwcyHmn6

Message 8 of 52

Anonymous
Not applicable

This inverse problem. Get a dedicated line from AutoCAD

DyAcadTakeLines.jpg

 

restart = IN[0]
if IN[1] != True: off = 1/0

import clr

clr.AddReference('ProtoGeometry')
import Autodesk
from Autodesk.DesignScript.Geometry import *

import System
from System import *

DPoint = Autodesk.DesignScript.Geometry.Point
DLine = Autodesk.DesignScript.Geometry.Line

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

def ptD(p):
	return DPoint.ByCoordinates(p[0],p[1],p[2])

def linD(p1,p2):
	return DLine.ByStartPointEndPoint(ptD(p1),ptD(p2))

sset = AcDoc.PickfirstSelectionSet
n = sset.Count

curvs = []
for i in range(n):
	if sset.Item(i).EntityName == "AcDbLine":
		stpt = sset.Item(i).StartPoint
		enpt = sset.Item(i).EndPoint
		lns = linD(stpt,enpt)
		curvs.append(lns)

OUT = curvs

 

download Dynamo file https://yadi.sk/d/xDnbn2EHyHtdK

Message 9 of 52

Slawomir_
Advisor
Advisor

Hi,

 

I can't find "ForceChildrensEval" on the web. Where can I find this or how can I make this in Dynamo?

0 Likes
Message 10 of 52

Anonymous
Not applicable

This node from Prorubim DS Common Kit package 

Message 11 of 52

Slawomir_
Advisor
Advisor

Thanks! Is it free for commercial use?

0 Likes
Message 12 of 52

Anonymous
Not applicable

its free

Message 13 of 52

Slawomir_
Advisor
Advisor

I'm stuck. Did complete sample You have shown but now I don't know how to display this Python text window.

 

Dynamo 0.9.1

0 Likes
Message 14 of 52

Anonymous
Not applicable

Double click to Python Script node

Message 15 of 52

Slawomir_
Advisor
Advisor

It's working! Thanks a lot!

0 Likes
Message 16 of 52

Anonymous
Not applicable

Smiley Wink

0 Likes
Message 17 of 52

Anonymous
Not applicable

is it possible to import information from Excel to property set data in Autocad Architecture?

 

Message 18 of 52

Yonas89
Collaborator
Collaborator
Hmm, I think with Dynamo it would be possible but difficult. I think the better option would be to create custum plugin for it.
0 Likes
Message 19 of 52

Anonymous
Not applicable

That's possible.

0 Likes
Message 20 of 52

Anonymous
Not applicable

Of course it would be good to write a plugin, but in what programming language? In Dynamo there are nodes to work with Excel, it is already good