Transform cad block into revit family

This would be an example using your graph

1 Like

I did that, but it’s still not correct. What could be the issue? Does the code block with the name “Familias revit - chave” already contain the names of my families in Revit, and will the conversion be done solely through it? Is it not necessary to insert an element node? Since I’m using the dictionary, would it not be necessary to create the “Block and Family Schedule” or “CAD Schedule” script? Or should I precisely connect the output of the “Block and Family Schedule” to the values of “Dictionary.ByKeysValues” and the output of the “CAD Block” to the keys?

Please show what the error is being returned by the Dictionary.ValueAtKey node.

In order to use a dictionary, you have to have a list of keys and a list of the corresponding values. Both list must have the same number of items (ex. 20 keys and 20 values). The key would be the block name and the value could be either the name of the family or the actual family element itself. If you use the family name as the value, then you will need to use the Family.ByName node to get the actual family and pass that along in your graph. Whichever method you use is up to you.

Is your block name always the same as you family name?

1 Like

Yes, both my blocks and families have identical names.
The error was: The provided key was not present in the dictionary.
“If you use the family name as the value, you will need to use the Family.ByName node to retrieve the actual family and pass it into your graph.”
That’s what I was doing according to the image I sent, right?


10Âș - Automação Tomadas e Interruptores (3).dyn (183.5 KB)

So the error is because you have block names coming in that don’t match any of the existing standard block names.

Can you provide the excel sheet you are referencing? Just want to see what information you are bringing in and how it’s formatted.

I was assuming that all of the families were already loaded into your model and you were just placing them as needed.

To answer your last question, no you were getting the value from the dictionary, but you weren’t doing anything with the output.

1 Like

Where’s the confusion in knowing which families to use if the family names are identical to the block names? Wouldn’t you just use the block name as the family name in that case?

3 Likes

Yes, I checked here and there were some non-standard blocks and families, so I reformulated them. If you can take a look for me. Here’s the script and the spreadsheet.
Planilha tomadas.xlsx (10.3 KB)
10Âș - Automação Tomadas e Interruptores (3).dyn (199.0 KB)

One more request. Since I can’t run the script and get proper results, please add watch nodes to the outputs from BlockName, OriginPoint and Rotation from the CAD Block and run your script. Then provide a clip of the list from the watch nodes. This way we can see what is being brought in and can mimic those results.

It’s not working because I’m not sure if I’m using the correct nodes, and I also don’t know where to link the dictionaries to my imported floor plan in the CAD block. But anyway, it’s not importing. :frowning:

The import instance tells you the block Name, Point, and Rotation. That’s all you need to place new instances of your families since the block name matches the family name. (Although it looks like the family type name matches the block name.) You can then use the block name to get the specific family type you need and place it at that point, with that rotation. You need to use a family instance creation node to place new instances - probably FamilyInstance.ByPoint, but it may be something else depending on what kind of families you’re using.

2 Likes

I duplicated what you had and tested with the graph shown here. I got good results up to the FamilyType.ByName as my project doesn’t have those families loaded. But everything else looked to get you what you are after, “I believe”. :grinning:

Here is the actual graph so there is no misinterpretation.

Block Name Filtering.dyn (61.2 KB)

2 Likes

Wow
 Oh my God, I don’t even know how to thank you guys. I’ve been trying to get this routine to work for days. It worked perfectly! Thank you so much!

You are great. Congratulations!

2 Likes

You are welcome! It really became a quest for me. :rofl:

1 Like

Hi again! :face_with_hand_over_mouth: :sweat_smile:
Because there was some problem and I can’t understand why. The routine only worked for a specific project, the one I was using as a test from the beginning, for other projects it didn’t work. Any idea what it could be? I didn’t change names or anything.

Oh hello! :rofl:
I can’t really provide a definite answer without seeing the results from the graph. This time we may need to get a stripped down version of the dwg so we can run the graph and get the same results you are getting. Would help expedite a resolution.

1 Like

I found out. Actually I can’t change base point of cad block. Which I did for better positioning.
Which is strange, since he is finding himself by names, from the worksheet and from the cad link. Even not changing names he is not recognizing.

Yeah that is weird. The base point shouldn’t matter. As long as the CAD Block is bringing in the block names with corresponding base points and rotations it should work. This is also assuming the block names match exactly between the worksheet and the cad link. Any variance between the names and it won’t associate them together.

1 Like

Do you know which nodes I can use within the routine itself to rotate objects to the correct position?