Problem with DirectShape.ByGeometry

Hi guys
Any idea of why DS is giving null values?
Already tried to fill category input, tried with a simple cuboid to see if my geometry was the problem. I also migrated the Python script to CPython3 (with the Dynamo tool) and still have the same problem.
Just for your knowledge I’m using springs library because my program crashes if I try Auto mode with the similar node from Dynamo library (it works well with A. mode for Geometry.Translate node preview and it also works with DirectShape in Manual Mode), so if you have any sugestión for that it could work as well.

New update! I have seen in another posts that spring nodes are having troubles with Revit 2024… so I tried with synthesize toolkit, it worked! but I still can’t run on automatic mode withouth having an instant crash… Auto mode works for Geometry preview, Manual mode works for SPDirectShape, Automode crashes whith SPDirectShape, any solution?

¨Hi @Franck0 thanks for you PM…works for me on a small test in automatic…probably you have another issue not sure…but you are welcome share your graph and we can take a look…btw whitch revit version are you in ?

Revit_IGBP3BNQOZ

Hi @sovitek and thank you for answer! I am working on Revit 2024, I will let my Revit and Dynamo archive right below so you can check them.
The objective of this program is to set Clearence Areas (WorkSpace) for every Electrical/Special equipment, the areas should move around X axis of the equipment too but without going beyond the sides of them, as you can see in the video. Sorry if my program isn’t so clean, I just started learning how to use all of this like a week ago.
I couldn’t find any solution for moving them on an easy why or something like dynamic generation of sliders so I just put 30 on it for working with a maximum of 30 objects.
“Front Face” of the equipment is usually their model back face so that’s why the orienting vectors are rotated.

Regards

SetWorkingSpaceFinal.dyn (210.0 KB)
Electrical Equipment Tests.rvt (6.0 MB)

Is the intent to ‘shift the geometry’ by way of N individual sliders like that? This feels problematic as you’ve got no way of knowing which slider is associcated to which piece of equipment.

A better solution might be to use Dynamo Player to allow the user to select one piece of equipment and a single slider value from -N to N. The user selects any piece of equipment, sets the value of N, and executes it. if they don’t like where it sits they can hit undo and adjust N, or delete the workspace and set the value of N accordingly.

Better still (and likely the best solution) would be to manually author the workspace family as a stand alone family, and populate it on the face of each piece of equipment. Build the family with an offset parameter to allow movement from -N to N and call it a day. This family can have an type parameter to allow for programmatically setting the required dimensions, and even be nested into your equipment families. From there Dynamo can automatically set the type parameters for each piece of equipment, and you could even use generative design to find the right clearance configuration… All of that isn’t possible with the directshape methodology.

Hi @jacob.small , I arranged the program in a way that allows to preserve the index for every piece of equipment so the sliders could be related to the objects in my layout, I also try disconnecting this part of the program to see if dynamo didn’t crash but it did that anyways. I’m very interested on your second solution and would probably speed up my program a lot… can you give me a bit of guidance of how to execute this, what nodes should I use etc. I am a bit new with Revit, Dynamo and programming in general so it’s difficult for me haha, thank you!

I am also interested on save every change on the movement of the workspace, so if you have 5 pieces of equipement you could move the 5 of them to different sides and the program saves all of this changes in the project

No nodes or even Dynamo to start with. In Revit start a new family using the family template and category of your chosing, but I’m guessing you’ll want a ‘point based’ object as a starting point. Build a cuboid constrained to the origin (the crossing planes in the plan view) with parametric control over it’s width, length, and height.

Once you have that done load it into your project.

Then we move to Dynamo.

  1. Get the ‘center of the front face’ for selected equipment, and pull that point down to the floor level.
  2. Next build a control to ‘shift’ that point along the equipment’s X axis. This step and the proceeding step are conceptually VERY close to what you’re doing now so you can figure it out fairly easily.
  3. Now use a FamilyInstance.ByPoint node to create the instance of the clearance family for each projected point.
  4. Get the facing direction for each of the selected equipment family instances, and get the angle about the Z axis from the new family’s facing direction.
  5. Set the family rotation (SetRotation node) to the angle.
  6. Set the width, depth and height parameters for the mass according to the requirements of the equipment (assuming you don’t just need a consistent dimension) with an Element.GetParameterValue node from the equipment and an Element.SetParameterValueByName node for the new instances.
1 Like

Perfect, I will work with that solution and then if the program works maybe you could help me a bit with the generative design idea, thank you so much I will let you know if this option solved the problem!

1 Like

Hi there! I made I “new” program with all your corrections and it worked!, Dynamo doesn’t crash anymore, only thing is that when I move mi working space around X axis in automatic mode Dynamo takes a time to process every move, not as smooth as how it does with geometry’s preview, if you have any suggestion to make the program smoother that will be great!
SetWSByFamily.dyn (170.5 KB)

Electrical Equipment Tests.rvt (6.0 MB)


I am traveling for work this week so I cannot test anything. But what you describe makes some sense - sadly it won’t be as smooth this way as Revit has to refresh between instance creation… however this can the a great basis for a generative equipment layout tool, where you let Generative Design find the best location for ALL clearances and even equipment locations in the room.

Alternatively you could ‘fake’ the clearance location using the same parameters and let an intermediate UI and Dynamo preview geometry update things before passing them though a Data.Gate that is kept closed until you are ready to create the family instance.

1 Like

Hi again @jacob.small, I definitely want to evolve this to a generative design option in the next weeks but for the moment I am interested in your second solution while I study how to apply the first one. So I’m now doing something similar to what I have before to create the geometries and I faced with my original problem with the sliders. I change the origin point por a specific WorkingSpace preview but I can’t save that modifications if I want to modify another one, just like with Parameters from Families. I would like to save my modifications without having to place 50 sliders as before, chatgpt give something that could work with “DataRemember” node but Dynamo doesn’t let me create a cyclic relation.

#Inputs from Dynamo
slider_value = IN[0] # Slider value
index = IN[1] # Index where the value is to be stored

#Get the previous list of values from Data.Remember
prev_values = IN[2] if isinstance(IN[2], list) else

#Ensure the list has sufficient length
if len(prev_values) <= index:
# Expand the list with zeros up to the necessary index
prev_values.extend([0] * (index + 1 - len(prev_values)))

#Update the value at the specified index
prev_values[index] = slider_value

#Output to Dynamo
OUT = prev_values

If the solids could move trough Revit to avoid the use of sliders it will be amazing too

Traveling this week so might not get to check, but you should be able to use a parameter to control the offset. And that can also enable adjusting the slider or using a set parameter value by name node.

The Data.Remembee node here is making an infinate loop. You want a data.gate somewhere, but I can’t see where.

1 Like