ADSK template create stamp API

ADSK template create stamp API

PSK_LiK
Explorer Explorer
533 Views
3 Replies
Message 1 of 4

ADSK template create stamp API

PSK_LiK
Explorer
Explorer

Good day, gentlemen, developers. Please tell me how to put stamps from the code?
I cannot find at least an example in any way.

I use the default template and have an ADSC template
And through the interface revita it is simple.
But I need the same thing only to do it from the code and fill it with my dataAutode.png

0 Likes
Accepted solutions (2)
534 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Use RevitLookup to analyse the differences in the database before and after adding the stamp manually through the use interface, as described in How to research to find a Revit API solution:

  

https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-onto...

  

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

PSK_LiK
Explorer
Explorer
Accepted solution

Dear Jeremy.

Of course I am using your LookUp plugin.

I just couldn't find a solution on my own.

Up to this point, I have studied and done everything myself. But here I need a little of your support.

 

I found what it is, it's RoomTag-> TagText but I can't change it, I just get it.

12.png

 

 

Also, if you look at the parameters of the element, you can see which family is used.

23.png

 

I published this post only because I myself cannot find a solution for 2 days.

As a solution, you can also take the fact to change the text inside the stamp through the code

 

 

 

ICollection<ElementId> SelectedElements = uidoc.Selection.GetElementIds();

using (Transaction trans = new Transaction(doc, "Change selected Elements Mark"))
            {
                trans.Start();
                int i = 1000;
                foreach (ElementId id in SelectedElements)
                {
                    Element elem = doc.GetElement(id); 
                    Room roomroom = elem as Room;
                    RoomTag requiredRoomTag = null;
                    if (roomroom != null)
                    {
                        FilteredElementCollector coll = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RoomTags).WhereElementIsNotElementType();
                        foreach (Element ee in coll)
                        {
                            RoomTag RT = ee as RoomTag;
                            Room r = RT.Room;
                            if (r.Name == roomroom.Name)
                            {
                                //Required roomtag
                                requiredRoomTag = RT;
                                SpatialElementTag SETag = RT;
                                    TaskDialog.Show("YES", RT.TagText);
                            }    
                        }
                    }
                }

                trans.Commit();
            }

 

 

P.S.Is it possible to change these values?

34.png

 

0 Likes
Message 4 of 4

PSK_LiK
Explorer
Explorer
Accepted solution

I found a solution to this problem. I just create a shared parameter. And then manually at the family pointing the fields to which you need to attach the value

0 Likes