How to fill lowerText in dimensions?


)
2020-07-29_16h28_32

Hello,

I want to fill this text into the dimension LowerCase, like in the pic. - manuel it works well!
I just want to put a text lower in the dimension. The script does not read my for loop, why?
Actualy my test works very fine.

I happy about any help!

KR

Andreas

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

    doc = DocumentManager.Instance.CurrentDBDocument

    dimensions = UnwrapElement(IN[0])
    text = IN[1]

    TransactionManager.Instance.EnsureInTransaction(doc)

     results = []

    for dim in dimensions:
      dim.Above = str(text)
      results.append(dim)

    TransactionManager.Instance.TransactionTaskDone()

    OUT = results

There was a problem with iteration.

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

dimensions = UnwrapElement(IN[0])
text = IN[1]

if not hasattr(dimensions,"__iter__"):
	dimensions =[dimensions]
else:
	dimensions = dimensions

TransactionManager.Instance.EnsureInTransaction(doc)

results = []

for dim in dimensions:
	dim.Above = str(text)
	results.append(dim)

TransactionManager.Instance.TransactionTaskDone()

OUT = results

Now it has to work :slight_smile:

i found this, actually i do not understand

 dimensions = UnwrapElement(IN[0])
 text = IN[1]

 TransactionManager.Instance.EnsureInTransaction(doc)

 results = []

    for dim in dimensions:
         numOfSegs = dim.NumberOfSegments
 if numOfSegs > 0:
	for num in range(numOfSegs):
		dim.Segments[num].Above = str(text)
		results.append(dim)
else:
	dim.Above = str(text)
	results.append(dim)

TransactionManager.Instance.TransactionTaskDone()

OUT = results

I updated the code. It works now. You should add this one before you start:

if not hasattr(dimensions,"__iter__"):
	dimensions =[dimensions]
else:
	dimensions = dimensions
1 Like

YES Dude it does! how do i the lower case?

is it just

dim.Segments[num].Lower = str(text)
for dim in dimensions:
	dim.Above = str(text.lower())
	results.append(dim)

The correct funtion is lower()

2020-07-29_17h46_36
i mean the text should be under the value
2020-07-29_17h47_34

Ach so, you mean “Unterhalb”
You should use then “Below” instead of “Above”

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

dimensions = UnwrapElement(IN[0])
text = IN[1]

if not hasattr(dimensions,"__iter__"):
	dimensions =[dimensions]
else:
	dimensions = dimensions

TransactionManager.Instance.EnsureInTransaction(doc)

results = []

for dim in dimensions:
	dim.Below = str(text)
	results.append(dim)

TransactionManager.Instance.TransactionTaskDone()

OUT = results
2 Likes

Ja genau mein deutsch ist besser als mein englisch

ThankYou thats a big step… because i have to put the doorhights as strings to the related dimension, thats my next task! …actualy where did you get the vocabolary is this just Python or API stuff also?

1 Like

If you have Revit 2021, you can upgrade to Revit 2021.1 and get a bunch of new nodes, including this one :slight_smile:

1 Like

I have just your presentation from Linkedin :slight_smile: … …we work on 2018.3

1 Like

Ah cool, then Python is the way to go! :smiley:

Do you know that website?
That dim.Below was API Stuff.
https://www.revitapidocs.com/2020/

2 Likes

I know it, but actualy i have to find out to deal with it. I installed lookUp Table and also use dir(), but it is still hart to find exampels from real projects.

API is just the vocabolary. How to speak with is the challange