How to delete a single dimension from a multi segment dimension?

Hi Everyone!

I have started practicing dynamo recently… I managed to write a script for deleting dimensions less than a certain length.

The problem is I do not know how to remove parts from a multi segment dimension, as I can not figure out the way to breakdown the multi segment dimension and select parts I want to remove.

As shown in the printscreens I do not know what to do with getting dimension segments.

Please give me your thought.

Thanks

2 Likes

This is the full dynamo script I wrote

Hi @hosamelshazly92 and welcome!

A dimension contains an array of dimensionsegments.

But you can retrieve the values by Dimension.Value, like this:

Forgot to ask what you need to know before you can delete a segment. I just assumed that it was based on curtain value, lol.

Hi @CVestesen my warm greetings to you.

I am using Element.GetParameterValueByName node to filter dimensions and delete small ones.

In case of multi segment dimensions I get empty list for their parameters value, so I am looking for a way to pick specific segements as elements to delete them.

One more Thing, I think there is a differefence between getting parameter value for a dimension and getting value for it, it shows different numbers.

Thank you

Since your project is in metric, you need to convert from internal units (feet) to your display units (millimeters):

dims = UnwrapElement(IN[0])
segments = []
for dim in dims:
	seg_temp = dim.Segments
	segments.append(seg_temp)

OUT = segments

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import UnitUtils, DisplayUnitType

seg_lists = IN[0]
seg_values = []
dut_mm = DisplayUnitType.DUT_MILLIMETERS
for seg_list in seg_lists:
	value_temp = []
	if len(seg_list) > 0:
		for seg in seg_list:
			value = seg.Value
			value_converted = UnitUtils.ConvertFromInternalUnits(value, dut_mm)
			value_temp.append(value_converted)
	seg_values.append(value_temp)
	
OUT = seg_values

However, I don’t think you will be able to delete a single dimension from a multi-segment dimension as you are describing. While the DimensionSegment’s parent Dimension can be deleted (as a Dimension is an Element), the Revit API does not provide the ability to delete a particular segment. This is explained more in-depth by Jim Jia from Autodesk here.

2 Likes

Hi Hosam,

This is possible with the Genius Loci package which have a bunch of nodes for dimensioning.
You must indicate in the conditional statement the length to delete.
In the example below 1 meter :

x<1?
false:
true;

Delete dimensions less than a certain length.dyn (24.7 KB)

3 Likes

Hi… This is exactly what I was aking about.

Thank you

2 Likes