Quantcast
Channel: All Revit API Forum posts
Viewing all 67020 articles
Browse latest View live

how to gets relation of element with its tag or its label?

$
0
0

I have doors.

I have door tags

want to verify the whether  particular tags present on that  particular door?

 


Re: how to verify label on element using revit api?

$
0
0

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 wellSmiley Happy

 

Re: Units on the elements, that conform the assets of materials

$
0
0

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

Re: how to gets relation of element with its tag or its label?

Re: how to gets relation of element with its tag or its label?

Re: i want to check whether tag is present on door by api how should i checked?

Re: how to gets relation of element with its tag or its label?

$
0
0

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.

Re: how to gets relation of element with its tag or its label?

$
0
0

It collects all independent tags AND the element ids of the doors that they tag.

 


Re: Creating new Entity stops the external event handler

$
0
0

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();

 

Re: Explode SAT/DWG after import

$
0
0

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

read and export schedules multiple revit file using c# api

$
0
0

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;}}

 

 

Change Tagging Family

$
0
0

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:

TagMultipleUI.PNG

 

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:

TagMultipleError.PNG

 

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

Re: how do we verify using revit api whether element is dimensioned or not?

$
0
0

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?

 

Re: IFC Export using Document.Export not working

$
0
0

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.

Re: Unable to get climate data


Register Dockable Pane

$
0
0

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

Re: Change Tagging Family

$
0
0

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

Re: Explode SAT/DWG after import

Re: Explode SAT/DWG after import

$
0
0

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

 

Re: CustomExport, how to speed up Export Time?

$
0
0

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! :)

Viewing all 67020 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>