I have doors.
I have door tags
want to verify the whether particular tags present on that particular door?
I have doors.
I have door tags
want to verify the whether particular tags present on that particular door?
Hi
try using the below code
this code will highlight the elements which are not taggged
IList<ElementId> ElementsWithoutTag = new List<ElementId>(); foreach(Element e in new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).OfClass(typeof(FamilyInstance))) { if(new FilteredElementCollector(doc).OfClass(typeof(IndependentTag)).Cast<IndependentTag>().FirstOrDefault(q=>q.TaggedLocalElementId==e.Id)==null) { ElementsWithoutTag.Add(e.Id); } }
uidoc.Selection.SetElementIds(ElementsWithoutTag);
uidoc.RefreshActiveView();
If this helped solve your problem please mark it as solution, so other users can get this solutions as well
Thank you for your suggestion
I've looked into the topic and threads and I've struggled to find a straight forward solution to the Information component (Description, Keywords, etc.) of the Physical and Thermal assets.
Something that comes to mind?
Regards,
JMGP
Did you RTFM?
https://apidocs.co/apps/revit/2019/759306d1-5168-ef9a-91e4-494c7eff0b5d.htm
TaggedLocalElementId looks like it will do the job.
Cheers,
Jeremy
Also, you already asked this same question and received the same answer before:
You can collect door elements on one hand, and independent tag elements on the other.
From the independent tag, you can get the door using TaggedLocalElementId:
https://apidocs.co/apps/revit/2019/759306d1-5168-ef9a-91e4-494c7eff0b5d.htm
To get the tag from the door, you can invert this relationship:
http://thebuildingcoder.typepad.com/blog/2008/10/relationship-in.html
Cheers,
Jeremy
At that time i thought that answer is correct but actually answer is wrong.
He answered as tag contains same element id as that of tag.
but tags are different Id than the element ID
also he given tags we get like this
var doorTagsIds = new HashSet<ElementId>(collector.OfClass(typeof(IndependentTag)).OfCategory(BuiltInCategory.OST_DoorTags).OfType<IndependentTag>().Select(x => x.GetTaggedLocalElement()?.Id).Where(x => x != null));
by this not able to collect door tag it just collects id s of door only.
It collects all independent tags AND the element ids of the doors that they tag.
I found this in the remarks of SetSubSchemaGUID method:
"Fields of type Entity - subentities - need to specify their Schema. The framework will prevent subentities with incorrect schemas from being stored in the entity. Additionally, the access level of the subschema will be checked against the currently executing add-in and access to restricted subentities will be prevented."
I'm creating my sub-entities with a new Guid (or do I have to pass the main schema to the constructor?) and testing my add-in with Add-in Manager tool. Could this be part of the problem?
Here's how I created my schema:
Guid schemaGuid = new Guid("A10D426E-5899-45E6-979C-BAE987B564B5"); //Guid schemaGuid = Guid.NewGuid(); SchemaBuilder schemaBuilder = new SchemaBuilder(schemaGuid); // set read access //schemaBuilder.SetReadAccessLevel(AccessLevel.Public); // set write access //schemaBuilder.SetWriteAccessLevel(AccessLevel.Public); // set schema name schemaBuilder.SetSchemaName("CSDataItems"); // set documentation //schemaBuilder.SetDocumentation("Schema to hold construction schedule data items."); var mapField = schemaBuilder.AddMapField("MapField", typeof(string), typeof(Entity)); mapField.SetSubSchemaGUID(new Guid("90BA988E-BE74-46BE-A2E4-1F23367621CA")); mapField.SetDocumentation("Each item in this map is corresponding to one CSDataItem. The int will be ElementId of the element & the Entity will store the rest of data."); // register the schema schema = schemaBuilder.Finish();
This is an interesting idea, but can you elaborate how would you extract the solids from imported SAT file and iterate through them?
SAT file comes in as one element, so not how to filter for solids.
Thanks
have 150 revit files in a folder. I want to write c# console application that export schedules for each revit files in the folder.
I found some samples in the forums, but I couldnt make it work.
publicvoidPlot(string[] files){ExternalCommandData commandData;UIApplication uiApplication = commandData.Application;foreach(string file in files){Document document = uiApplication.OpenAndActivateDocument(@"C:\solar.rvt").Document;}}
Hi everyone,
I'm still working on the tool that will tag multiple categories of elements in multiple views. Same thing as Tag All but that will work on multiple views selected by the user.
The user will have an interface where to pick which categories to tag and with which tagging family:
Once the user selects category and family from the UI the main program "receives" the selection as a Dictionary<Category, Family>
The main program creates independent tags with the IndependentTag.Create(document, view, etc.) method, but then the next step would be to change the default independent tag family created by this method with the one selected by the user using the ChangeTypeId() method. This is what I can't figure out how to do.
Do I use the Family (selected by the user) or do I have to use the Type of the Family? How do I get the Types of the family in the first element collector?
This is the dictionary that I'm getting back:
Dictionary<Category, Family> selectedCatFam = new Dictionary<Category, Family>();
And then for tagging:
foreach (KeyValuePair<Category, Family> dictKV in TagCategories.selectedCatFam) { // Get all elements of selected categories IEnumerable<Element> elementsOfCat = new FilteredElementCollector(doc, current.Id).OfCategoryId(dictKV.Key.Id).ToElements(); foreach (Element e in elementsOfCat) { // Tag tag = IndependentTag.Create(doc, current.Id, elRef, true, tagMode, tagOrn, xyzLoc); // Change the type of tag tag.ChangeTypeId(dictKV.Value.GetTypeId()); } }
And then I get this error:
I see that I'm doing something wrong in the last bit when I do the ChangeTypeId, but I don't understand what would be the right way.
Any help?
Thanks,
Andrea
As in attached file dimension on the elements
some measured from centre of element which is denoted by dot.
Some are measured from end of element which is denoted by line..
how do we differentiate this using revit api?
May be problem is not in IFCExporter. Try to open generated IFC file and in 3D view properties change "display phase" (not sure, I'm using non english localization) to some else.
i have the same issue :(
Hello,
I'm trying to make a dockable pane that loads with my UIControlledApplication.
I've registered it on application startUp like this:
DockablePaneId dpid = new DockablePaneId(new Guid("D4B5A2D5-5726-4BD5-B3DB-688C48EFF7DB"));
application.RegisterDockablePane(dpid, "GPropreties", MyDockablePane as IDockablePaneProvider);
dp = application.GetDockablePane(dpid);
but I keeps failing on startup.
Any ideas where is the error?
Thanks
Hi,
family.GetTypeId() doesn't make sense - this methods only exists because Family class is derived from Element class.
To get a list of type IDs, call family.GetFamilySymbolIds() - there may be more than only one type per Family.
Revitalizer
Hi,
To get the solid(s) of your ImportInstance, you could have a closer look at these code samples:
https://forums.autodesk.com/t5/revit-api-forum/getting-beam-column-and-wall-geometry/m-p/8138893
Revitalizer
I am afraid that your +1 here in the forum will go unnoticed.
If you ensure that a wish list entry is present for this in the Revit Idea Station and add your votes for that, they will have real impact.
Cheers,
Jeremy
I will definitely be spending time to explore further.
Will be trying to make better use of the Filtered Element Collector
https://thebuildingcoder.typepad.com/blog/2011/06/no-multithreading-in-revit.html
At the same time to see if storing the necessary information through 1 single thread, and then implementing logical threads to further export the necessary data.
Will ping back here if successful, thanks Jeremy for the quick reply! :)