Auto-Dimension from Walls

python

#1

Hi All,

Just a WIP incase anyone has a free Sunday and fancies a play with it! Otherwise I’ll get back on it on Monday…

Following the amazing work here:


I want a graph which will create individual dimensions (so I can check them against brick dimensions) and automatically create the dimension location lines.

So far I’ve got here… It’s nearly there, but rather than create a dim per ‘reference’ it’s creating a dim per line… It’s also doing something weird with the view… The created dims are in Revit but not appearing until I change their type.

Any assistance appreciated!

Cheers,

Mark

auto dim walls-14.dyn (38.9 KB)

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

#create a for loop to go through every index
b = IN[0]
elements = IN[1]
dim = 0
a = []

for x in range (0, len(b)):

	line = UnwrapElement(b[x]).GeometryCurve
	elementsRef = ReferenceArray()
	opt = Options()
	opt.ComputeReferences = True
	opt.IncludeNonVisibleObjects = True
	opt.View = doc.ActiveView
	for element in elements:
		elementsRef.Append(element)
	TransactionManager.Instance.EnsureInTransaction(doc)

	dim = doc.Create.NewDimension(doc.ActiveView, line, elementsRef).ToDSType(True)

	TransactionManager.Instance.TransactionTaskDone()
	d = dim
	a.extend ([d])

	OUT = a

Create dimensions
Getting Geometry of wall openings of walls at an angle
#2

Minor update, the springs.list.subpairs node is awesome!


#3

So this is where I’m leaving it for the moment… putting the python in a custom node let me work at level 2, so if I Pick a wall I get all the dimensions along it offset automatically.

If I get more time I’ll keep working on it…

Any assistance welcome!

Mark

DimWallsAuto-Chop.dyn (46.8 KB)
Dim.FromReference.dyf (5.1 KB)


How can i put aligned dimension and angular dimensions in floors?
#4

Just an update, I’ve got it working for multiple walls in active view and removed the need for a custom node by updating my python.

Thanks to all who’s work I have built upon,

Mark

It struggles with angled corners as you’d need a reference ‘point’ rather than plane, any suggestions welcome :slight_smile:
EDIT: It’s also using the angle of the wall to work out which should be dim’d, so I’d need to get only the wall faces which are vertical and not aligned to the location line, then pick the point closest to the location line which intersected the external face… simples… Getting the ‘point’ might be the easy bit!

DimWallsAuto-All.dyn (64.7 KB)


Python Dimension.Below = calculated value based on actual Dimension value(Maths)
#5

It is just an Idea that I haven’t tested. Can’t you take start and end of the wall as references?


#6

Hi :slight_smile:

Thanks for the response!

So… My dimension wouldn’t want to be from the End Point of the location line… Otherwise it would be too short…
image
Unfortunately the relationship between references and geometry seems very easily broken, I would need an actual point on the wall corner somehow…

I could make a dimension to a reference plane, but it wouldn’t be dynamic, or I could extract a corner point from the geometry of the wall, but it then loses it’s association.

Thanks again,

Mark