I was trying out a workflow where I’m sending blocks from AutoCAD and receiving them in Dynamo in order to place them in Revit as corresponding families. Is there a way to export the Autocad Blocks’ rotation to Speckle? Or could you add this functionality in the future?
This workflow would be handy when working with consultants that use AutoCAD. For example you export your plan in DWG format and send it to an interior consultant. They place their furniture, etc. and send back the DWG. You can then collect all their blocks, match them to some corresponding Revit families in your project, and place those families according to the Cad blocks position and rotation.
Hi @Cillian_Warfield, thanks for reaching out. As far as I am aware, blocks should contain the full position/rotation of the object but I may be mistaken. If not, it is certainly an issue on our side so we’ll definitely look into it and fix it.
It would be super useful if you could share a stream with those blocks to check out the data in Speckle too
I think the rotation is being sent as a transform (the property just below insertionPoint), I’ll look at the source code and see if I can give you a quick formula to convert between the two
Alright, so I think I got it! This python script should return:
if the operation was successful
scale
rotation
translation
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('System.Numerics')
from System.Numerics import *
v = IN[0]
matrix = Matrix4x4(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14],v[15])
val = Matrix4x4.Decompose(matrix)
OUT = val
Thanks for the python script! It works in my graph too. However, I’m just not sure how to convert the {X Y Z W} data into radians/degrees. I did some digging in dynamo and figured out that it’s a quaternion(?) but not sure how to proceed.
I tried extracting the Z: data, on the off-chance that that contained the rotation in radians, but that doesn’t seem to be the case.
That’s awesome, thanks. Super interesting to see the code too. I came across quaternions doing some Unity tutorials a few years ago but alas, I don’t remember much!
Well your efforts are very much appreciated!
It works like a charm! You can mark this topic/query as solved now (I don’t seem to be able to do that myself).
Also if this workflow is of interest, I can volunteer to create a tutorial based on this for Speckle’s tutorials portal.