Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Position of elbow for varying length rebar tags

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
miguelmachadoecosta
705 Views, 8 Replies

Position of elbow for varying length rebar tags

I'm creating tags for rebars:

 

newIndTag = IndependentTag.Create(doc, vista.Id, New Reference(rebar), True, TagMode.TM_ADDBY_CATEGORY, TagOrientation.Horizontal, New XYZ(0, 0, 0))

 

Then I'm defining the position of the elbow. It is working for every tag except those referencing rebars with variable length. For those I'm getting an error saying that "the reference is not currently tagged":

error1.png

 

I tried all these options and I'm getting the same error for all of them:

option 1:

 

newIndTag.SetLeaderElbow(New Reference(rebar), position)

 

option 2:

 

newIndTag.SetLeaderElbow(newIndTag.GetTaggedReferences.First, position)

 

option 3:

 

Dim rebar As Rebar = DirectCast(doc.GetElement(newIndTag.GetTaggedElementIds().First.HostElementId), Rebar)
newIndTag.SetLeaderElbow(New Reference(rebar), position)

 

option 4:

 

Dim rebar As Rebar = DirectCast(doc.GetElement(newIndTag.GetTaggedLocalElementIds().First), Rebar)
newIndTag.SetLeaderElbow(New Reference(rebar), position)

 

option 5:

 

newIndTag.SetLeaderElbow(New Reference(newIndTag.GetTaggedLocalElements.First), position)

 

With Revit Lookup if I try to check the list of tagged references of a manually created tag for varying length rebar I also get an error saying "object reference not set to an instance of an object":

error2.png

 

I suppose this behaviour isn't normal. Is there a way I can create tags for varying length rebars while also defining the elbow position? I suppose I have to find another way of getting the reference Revit is using for these tags.


Thanks in advance.

8 REPLIES 8
Message 2 of 9

Yup, doesn't sound normal.

 

Can you produce a minimal reproducible case for the development team to analyse?

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

I went ahead and asked them whether they have any advice, so maybe we can wait and see what they suggest first.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 9

They did indeed reply as I suspected they would:

 

Can you please provide a minimal reproducible case and a sample Revit file?

 

Also, it would be helpful to know which Revit version is the customer using, because the tag's API underwent some significant changes last year.

  

Thank you!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 4 of 9

Hi @jeremy_tammik,

 

Thank you for you reply.

 

Please find attached a project file with a wall, a beam and two rebars, with a macro called "test" embedded that should be run in the detail view.

 

One rebar has variable length, the other doesn't. You can see that only the variable one causes the error.

 

While making this minimal project I realised that if I purge the other type of the tag family the error doesn't occur, but the elbow isn't placed either.

 

I left two tags, for both rebars. You can check that if you select the upper one the "Select Host" but is greyed out, while for the other isn't:

greyedout.png

 

You can also check that with Revit Lookup you get the error that I illustrated in my first post only for the upper tag.

 

I'm testing with Revit 2022.1.

Message 5 of 9

@jeremy_tammik, did you get any feedback from the development team?

 

Thank you

Message 6 of 9

Yes, I did. They say:

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 7 of 9

Thank you @jeremy_tammik. I already tested and I can confirm that it works for now.

 

I hadn't think of using the deprecated property. When the new major version is released I'll update for the new method.

 

I'll also be looking forward for the subelements implementation. It may at least simplify a few thing when obtaining geometries.

Message 8 of 9

I submitted a development ticket REVIT-183943 [Error setting elbow on tag of varying length rebar] for you reporting this problem.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 9 of 9

Thank you. I'll keep an eye on future release notes.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report