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

Re: Model Pattern vs Drafting Pattern

$
0
0

Hi  ,

try using the below code

FillPatternElement FPE;
FillPattern FP = FPE.GetFillPattern();
FillPatternTarget FPT = FP.Target;

FillPatterenTarget returns the type of fill pattern.

 

 

If this helped solve your problem please mark it as a solution, so other users can get this solution as well😊


Re: Schema Conflict when Loading a File

Re: Duplicate Cad Link

$
0
0
Well, I doubt that would work.
When we attach a second time the same CAD drawing, using the Revit user interface, it only creates 1 type and 2 instances. I would not expect the API to behave differently (and if it does, I'd consider it a bug and would NOT do that because it might be fixed in the future.....)
What do you mean with "handle the size of your CAD instances in AutoCAD"? We can't modify the AutoCAD drawing for 1 link and modify it for another. Once the drawing is modified, it applies to all Revit model linking it....

Re: Schema Conflict when Loading a File

$
0
0

This is the correct answer when “a vendor reuses software code in an add-in”, thereby produces an environment in which there are two schemes with the same Guid, doing different things. From what David writes, it sounds like we can exclude this possibility.

 

I cannot help much with the actual issue, but I can put more weight on the observation David made. For some reasons we recently got such messages every now and then for no obvious reason. Luckily these conflicts just produced the mentioned warning but otherwise caused no harm as far as I can tell.

Getting the Base and Survey point locations with respect to the Internal Origin

Re: Disabling Cast Shadows and Ambient Shadows

$
0
0

Nope, I have not received any news on this.

 

I asked again for you now.

 

If you are serious about this request, please also add it as an API wish to the Revit Idea Station and ensure it gets many votes.

 

Thank you!

 

Best regards,

 

Jeremy

 

Re: Duplicate Cad Link

$
0
0

Yes, you're right. Scale parameter of an ImportInstace is a family type that when you modify it, all the instances with the same type will change.

 

What I mentioned is just a workaround that is to create different dwg files according to how many scale values you use in the Revit file. In your case, you have 4 CADImportInstances with 4 scale values, then you'll have to create 4 dwg files which are CAD_LINK_V1_Scale1.dwg, CAD_LINK_V1_Scale2.dwg, CAD_LINK_V1_Scale3.dwg, and CAD_LINK_V1_Scale4.dwg.

 

When you want to replace V1 with V2, you also need 4 files CAD_LINK_V2_Scale1.dwg, CAD_LINK_V2_Scale2.dwg...etc.

It sounds crazy but it's doable.😅

Re: Duplicate Cad Link

$
0
0
Yes, it's doable in theory but not in the practical world, especially if the DWG's come from other Autodesk products, such as Plant3D, etc... as one would lose the database connection on those drawings. Also, for some of my customers, their DWG's are generated automatically from other products such as AutoPlant....
The thing that puzzles me in this whole story is that I can't see the reason why the instance scale parameter would be read-only. (not only for the CAD links, any other links too, even though I didn't check if the parameters is also read-only for other link types/instances)
Any chance we can introduce a bug against that, or at least, since it's most likely to be rejected as a bug, a change request?

Filtering Categories using Custom Exporter. Worked fine pre 2020

$
0
0

Hello All. 

 

I am having an issue using a custom exporter and could use some help. 

 

 

    //Loops through all the model categories, and exports elements in each category to a new file
            public async Task<int> ExportAllCategories(List<string> CategoriesToSkip, IProgress<ExporterProgress> progress, CancellationToken cancellationToken)
        {
            int CategoryCount = View3D.Document.Settings.Categories.Size;
            int CurrentCategoryIndex = 0;
            ExporterProgress OverallProgress = new ExporterProgress();
            foreach (Category category in View3D.Document.Settings.Categories)
            {
                if (cancellationToken.IsCancellationRequested)
                {
                    return -1;
                }
                CurrentCategoryIndex++;


                OverallProgress.CurrentFile = "Exporting " + category.Name;
                OverallProgress.PercentComplete = (int)((CurrentCategoryIndex / (float)CategoryCount) * 100);
                progress.Report(OverallProgress);
                await Task.Delay(1);
                //Only care about model categories
                if (category.CategoryType != CategoryType.Model)
                    continue;

                //Checks if category should be skipped
                if (CategoriesToSkip != null && CategoriesToSkip.Contains(category.Name))
                {
                    OverallProgress.CurrentFile = "Skipping " + category.Name;

                    continue;
                }

                //Revit Links Will be exported seperately
                if ((BuiltInCategory)category.Id.IntegerValue == BuiltInCategory.OST_RvtLinks)
                    continue;

                string FileName = MakeValidFileName(category.Name);
                 FileName += ".tmo";
                FileName = FileName.Replace(" ", string.Empty);


                ElementCategoryFilter filter = new ElementCategoryFilter(category.Id);
                FilteredElementCollector collector = new FilteredElementCollector(View3D.Document);
                ICollection<Element> items = collector.WherePasses(filter).WhereElementIsNotElementType().ToElements();
                List<ElementId> ElementsToExport = new List<ElementId>();

                foreach (Element e in items)
                {
                    if (e.CanBeHidden(View3D))
                    {
                        ElementsToExport.Add(e.Id);
                    }
                }
                if (ElementsToExport.Count != 0)
                {
                    UnHideElements(Document, ElementsToExport);
                    await Task.Delay(5);

                  //  ExportElements(ElementsToExport, FileName);
                    ExportViewToFile(FileName);


                    OverallProgress.CurrentFile = "Exported " + category.Name;
                    await Task.Delay(1);

                    HideElements(Document, ElementsToExport);


                    await Task.Delay(1);
                }

                //foreach (var RevitFile in ElementsInViewContext.DocumentSets)
                //{
                //    List<ElementId> ElementsToExport = new List<ElementId>();
                //    foreach (var elementid in RevitFile.Value.Distinct())
                //    {
                //        Element element = Document.GetElement(elementid);
                //        if (element.Category.Id == category.Id)
                //        {
                //            if (element.CanBeHidden(View3D))
                //            {
                //                ElementsToExport.Add(elementid);
                //            }
                //        }
                //    }

                //    if (ElementsToExport.Count != 0)
                //    {
                //        ExportElements(ElementsToExport, FileName);
                //        OverallProgress.CurrentFile = "Exported " + category.Name;

                //        await Task.Delay(1);
                //    }
                //}
            }
            return 0;
        }

The Custom exporter then exports to OBJ File format.

In 2020 some categories files are not exported. I don't think its due to the category switch. 

 

Has anything changed in the Revit API which could affect my material calls or mesh calls. 

I'm unsure how to debug this as some categories export fine and it works perfectly in previous Revit versions.

 

 

 

 

StructuralMaterialTypeFilter & Floors

$
0
0

Hi,

 

I'm trying to use a filter "StructuralMaterialTypeFilter([Structure].StructuralMaterialType.Concrete))" to retrieve only concrete elements within a certain FilteredElementCollector. 

 

It works fine with columns, but excludes every FLOOR (PassesFilter returns FALSE to concrete floors).

Code bellow: When I remove the last filter, floors are returned!

 

Anyone has a workaround?

 

Code:

Dim coll As FilteredElementCollector = New FilteredElementCollector(doc)

coll.Excluding(idsExclude) _
      .WherePasses(bbfilter) _
      .WhereElementIsNotElementType() _
      .WhereElementIsViewIndependent() _
      .WherePasses(New LogicalOrFilter(catFilter)) _
      .WherePasses(New [Structure].StructuralMaterialTypeFilter([Structure].StructuralMaterialType.Concrete))

 

Thanks

António

 

 

Re: Disabling Cast Shadows and Ambient Shadows

$
0
0

Tanks for the quick reply.

The need for the ability is somewhat important, but the change on the API won't solve my problem as many clients still use older versions of Revit.

 

I'm trying to think in a workaround for this issue, like storing a view template in the dll file is possible, but without success so far. Any suggestions that I can try?

 

In last case, I'll orient the user to turn on the ambient shadows for best results.

 

Cheers!

 

 

Re: Filtering Categories using Custom Exporter. Worked fine pre 2020

$
0
0

The exporter runs in a 3D view. In that view, the view settings will affect what is visible. Maybe something changed in that area?

 

Check out which 3D view is used by the exporter and see what it looks like in the user interface.

 

Possibly the same categories are missing there as well, and you can find an easy way to fix that.

 

I hope this helps.

 

Best regards,

  

Jeremy

 

Section - Far Clip Offset

$
0
0

Is there a way to have the Far Clip Offset show on Sheets? We have Coordination Sheets and I want to be able to show exactly how far the section is cutting. 

Create 3D model curve from List in project document

$
0
0

Hi everyone,

I need to create a smooth curve that goes through some points defined by List<XYZ>. These points are not in the same plane. I can create the curve in the family document using CurveByPoints like the following:

curveByPts = document.FamilyCreate.NewCurveByPoints(refPtsAr);

However, it does not seem there is a corresponding method for the project document. How can I create a 3D model curve in the project document?

Thanks,

Re: StructuralMaterialTypeFilter & Floors

$
0
0

If the structural material type filter prevents floor from being found, you can implement two separate filters:

 

  • One for non-floor elements including the structural material type filter
  • Another for the floor elements excluding the structural material type filter

 

You may have to filter for the desired floor material using other means.

 

The two filters may be combined into a single one in a final step using an additional Boolean LogicalOrFilter.

 

I hope this helps.

 

Cheers,

 

Jeremy

 


Flip Facing Without Showing the Arrow

$
0
0

Hello all, 
I think the answer is no but I want to ask. Is there a way to use flipFacing Method without allowing the user to see or click on the blue arrows? I want to control the facing side of a family through code but disallow someone from manually flipping this one particular family. 

 

I have checked the CanFlipFacing Property but until I place the blue arrow it remains false preventing flipFacing Method from exicuting.

 

Thank you for any help you are able to provide,

Steven

Re: Model Pattern vs Drafting Pattern

$
0
0

  that did the trick, thank you!👍

IndependentTag grabber code error: An internal error has occurred

$
0
0

I created a custom Python code that pulls the TagText from IndependentTags in the drawing:

 

# Import modules and clear references
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

# variables
doc = __revit__.ActiveUIDocument.Document

# Create a class to grab wall, from active doc,
# and filter out un-wanted types
tags_bin = (FilteredElementCollector(doc).
      OfClass(IndependentTag))

# Ittereate over tags and collect the names
list_tags = list() # variable to hold the strings
tags_bin = list(tags_bin)
for tags in tags_bin:
    temp = tags.TagText
    print(temp)
    list_tags.append(temp)

# pritn results
print(list_tags)

When I run the code, it grabs some of the TagTexts but then it gives me this error message.

 

python_pic2.PNG

 

Using Revit Lookup, an Add-in, I discovered that more than half of the IndependentTags has this error message with the TagText.

python_pic1.PNG

 

I had a friend of mine tried recreated it in C# and it still gives the same error message. Don't know how to fix this and any advice would be appreciated.

Running on Revit 2018.3 and using IronPython 2.7.7.

Advance Steel 2020 Extension help

$
0
0

can't find Advance Steel 2020 Extension help please

Re: Filtering Categories using Custom Exporter. Worked fine pre 2020

$
0
0

This is what is so strange, everything is visible in the view. 

Like I mentioned, some categories export without any issues. 

 

If I export the view without switching anything off using logic in post above. Nothing exports either. 

I get no errors in the custom exporter, but no textures/materials are saved, and no file is written. 

 

 

 

Viewing all 66830 articles
Browse latest View live


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