CAD Block location


#1

Hi there,

What I’m trying to achive is to get location of some Cad blocks from a Cad file inserted as a link in Revit.

Right now, I’m using an Excel file got from AutoCad and then I use dynamo to insert a family instance by point.

I would like sth without using Excel, because those Cad blocks have geometry parameters with the location, so if I could read them, it’s gonna be faster than create an Excel file and…

I’ve tried with ActiveX package ans DynamoCad package, but nothing works.

Any Idea?

Thks

Manel


AutoCAD Block to Revit Familie
#2


#3

Have you looked into what you can access via the dataextraction command in AutoCAD?


#4

Using dataextraction I can get what I want. x,y.z geometry and the block name.

I can get that, buy I dont want to do it with an excel file. I want to do it directly from Dynamo.

manel


#5

What type of blocks are they, can you post a copy?


#6

Does the GIF below demonstrate what you want to do?

If so, here is the python script to get the origin of a CAD import.

#Copyright(c) 2018, parallax team
#@prlxTeam
import clr

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk

#Custom tolist definition provided by Dimitar Venkov
#https://github.com/dimven/SpringNodes
def tolist(x):
	if hasattr(x,'__iter__'): return x
	else : return [x]

#unwrap all elements to use with API
items = tolist(UnwrapElement(IN[0]))

#lists to append results to
locations = list()

#iterate through the cad imports
for i in items:
	transform = i.GetTotalTransform()
	locations.append(transform.Origin.ToPoint())

#Assign your output to the OUT variable
OUT = locations

#7

Hi there!

First of all, thks for your answers.

@Ewan_Opie
Find attached a capture of the cad file:

As you can see, there are some blocks in the same cad. They are some ligthing fixture, each block has a geometry with the location, so, I just need to read them in order to set my objects in Revit.

@john_pierson
I would need to know the location of blocks inside the Cad file instead of the origin of a cad file.

I would need to find for each block named “blablabla” the location “XYZ”.

Thks again

Manel


#8

I have the same issue with active x the file package :frowning:


#9

Don’t know why, but sometimes works, sometimes doesn’t.

Manel


#10

while run the dyn you should open the related autocad file…