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

parking space parameters issue

$
0
0

Hello, I would like to ask for advise, I am trying to retrieve parameter from parking space. 

I collect them like 

 

                ElementCategoryFilter filter = new ElementCategoryFilter(BuiltInCategory.OST_Parking);
                FilteredElementCollector collector = new FilteredElementCollector(this._uiDocument.Document);
                collector.WherePasses(filter);
                    foreach (var item in collector)
                    {
                        FamilyInstance parkingInstance = item as FamilyInstance;

                        if (parkingInstance != null)
                        {
//Get parameter
} }

I can get, location, level, bounding box as usual. But my issue is when I want to get the width and the length. 

 

According to their rotation(as you can see in the pic) , width and length will vary in case of using bounding box.

if I get length and width using trigonometry I could fix the issue. 

If it would be impossible to get them. How could I delimit the parking space?

DifferentBB.png

 


Re: How to place a Pipe flange using Revit API

$
0
0

so this is a problem that can be address in many ways, but first:
1)did your Pipe Accessory have the same parameter signed to connectors?
Revit will force you some times to keep same DN of Accessory as Pipe.

2)don't use none in Pipe Routing Preference, it not only look silly but can cause problems later

 

 

A) You can simply create instance and connect them with pies and fitting connector.

B) your way would work only if you would get the same effect as a user

 

there is no easy solution for this.

Re: How can I launch my plugin from the surface edit mode?

Get all geometry elements from a mass

$
0
0

Hi,

 

I am using this method to translate Mass families inside of Revit into solid objects so that I can use this with the ExtrusionAnalyzer.Create() method. The method takes in 3 arguments: a solid, and plane, and an XYZ vector. I am able to successfully translate a Mass that contains 1 geometry element into a solid, but the problem arises when I am trying to convert a Mass with multiple geometry elements into a list of solids. When I do this, it seems that revit is having a problem with reading the geomery data and corrupts it when converting it into a solid. I am suspecting this because when I am doing this, I get an error thrown saying that the Extrusion Analyzer failed.

 

Here is my method for converting a Revit Mass into a Solid:

 

        public static List<Solid> GetSolids(Element element, Options geoOptions)
        {
            //    Create the solids list
            List<Solid> solids = new List<Solid>();
            //    Return if selection is not a mass element
            if (element.Category.Name != "Mass")
            {
                return solids;
            }


            // Get geometry element of the selected element
            GeometryElement geoEle = element.get_Geometry(geoOptions);

            // Get geometry object
            foreach (var subEle in geoEle)
            {
                Solid solid = subEle as Solid;
                if (solid != null)
                {
                    solids.Add(solid);
                }
            }
            return solids;
        }

It  was working fine when I add it to a list by doing listName.Add(GetSolids(massName, options).First(), but the problem arises when I do listName.AddRange(GetSolids(massName, options).

 

Any ideas as to how I would solve this issue? I am happy to provide more code should it be needed.

 

Thanks

 

 

Error: Internal setting is required by Revit and has been deleted

$
0
0

Hi all, 

 

I've had a search and I couldn't find any answers to this either here or using Google, but sorry if this topic is a repeat of another thread. 

 

I've written a script that uses Revit's PerformanceAdviser to purge a document, but it seems to also be attempting to delete Revit's internal settings. Has anyone come up against this before? 

 

Ideally I'd like to skip over deleting these, as it just causes Revit to crash. 

Any assistance would be appreciated, 
Thanks, 

 

Oliver

Re: Get all geometry elements from a mass

$
0
0

I seem to have fixed it by adding another check after casting the geometry object as a solid, so I am checking in the if statement if the solid is not null and if solid.Faces.IsEmpty is false. More testing is needed to check for sure that this is accurate though.

Re: Cannot Load External Tools - No 'External Tools' button on Add-Ins ribbon

$
0
0

Hi there!

I have the same problem and I'm still unable to solve it, although I tried all instructions ...

I installed Revit 2020 and Visual Studio 2019 and I follow the instructions here:

http://help.autodesk.com/view/RVT/2020/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Introduction_Getting_Started_Walkthrough_Hello_World_html

the addins directory in my computer seems to be :

D:\Program Files\Autodesk\Revit 2020\AddIns

so, I put the manifest file there, but I can't see External Tools in add-in tab, 

I'm really frustrated:-( , Can anybody help ? 

Re: Editing Calculated Value Formula

$
0
0

I think the ScheduleField is different than the SchedulableField, where ScheduleField includes the Calculated Values, correct me if I'm wrong.

 

I'm not interested in editing the value, but rather the formula. It seems like it's not possible, however, unless there's something else I'm missing.

 

Thanks for the reply, Jeremy.


Automatically Connect Load to Panel

$
0
0

I have an electrical load with 9 connectors and would like to automatically connect each of them to a panel by having the user select the load and panel.  My current approach is to create an electrical system for each connector and set the panel.  I am able to create electrical systems, however when I use the SelectPanel method and pass in the panel, I am given the error "The panel and circuit do not match".

 

The panel and load are the same voltage and both have the same number of phases.  I am able to manually connect them (Select load, click Power, ect...) without any problems, so why am I getting an error here?  Here is the snippet of code in which I create the electrical system for one connector and attempt to select the panel (load and panel are both FamilyInstance types):

 

TransactionManager.Instance.EnsureInTransaction(doc)
newElectricalSystem = Autodesk.Revit.DB.Electrical.ElectricalSystem
loadConnectorIterator = load.MEPModel.ConnectorManager.UnusedConnectors.ForwardIterator()
loadConnectorIterator.MoveNext()
loadConnector = loadConnectorIterator.Current
circuit = newElectricalSystem.Create(loadConnector, ElectricalSystemType.PowerCircuit)
TransactionManager.Instance.TransactionTaskDone()
circuit.SelectPanel(panel)

 

I am using Revit 2019 and coding in Python using Dynamo

Re: Returning Fabrication ITM Item Properties

$
0
0

I have looked and gone through the basic material, now i'm starting to dive in and getting a little overwhelmed, for some reason i cant seem to figure out how to return custom project parameters. I'm getting the hang of return shared and revit set parameters.

text editor

$
0
0

Why won't Autodesk add a decent word processor to Revit? 

Transferring an old Revit File to a newer version

$
0
0

Hi, I have been working a Revit file at my school, which runs on an earlier version of Revit, and I am trying to download the file I have been working on to my home laptop. I emailed myself the document but when I try to open the file I receive an error message regarding the older file type,

"The file was saved in a later version of Revit and cannot be retrieved in this version"  

I'm not sure what version my school is running on, but I am using 2017 Student. 

Is it possible to upgrade the model somehow? I know normally when downloading different custom models sometimes you have to "upgrade the model" but this option has not been made available to me. 

 

how to calculate formwork of floor

$
0
0

Hi everyone

I want to calculate shuttering of building which is named formwork.in order to do that i have to sum all faces of building which use concrete.my problem is when i calculate floor shuttering. I must sum area of all faces of floor except upper face of element.how can i do that? 

unload worksets in a linked model

$
0
0

Hi

I am looking into creating a tool that would unload the shared levels and grids workset in each of the linked models. Every variation i have tried the model spins but no changes happens to the linked model. Can someone point me inthe right direction if possible.

 

using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.ApplicationServices;
using System.Collections.Generic;
using System.Linq;


namespace ProjectSetup
{
    [TransactionAttribute(TransactionMode.Manual)]
    [RegenerationAttribute(RegenerationOption.Manual)]
    public class CmdLinkWorkset : IExternalCommand
    {
        
        public Result Execute(ExternalCommandData extCmdData, ref string msg, ElementSet elmtSet)
        {
            UIApplication uiapp = extCmdData.Application;
            UIDocument uiDoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uiDoc.Document;

            try
            {
            RevitLinkType RvtLinkType = null;    
            List<WorksetId> lstWkSet_Close = new List<WorksetId>();
            FilteredElementCollector links = new FilteredElementCollector(doc).OfClass(typeof(RevitLinkType));

            foreach (Document modeldoc in app.Documents)
                {
                   
                    foreach (Element elmnt in links)
                    {
                        RvtLinkType = elmnt as RevitLinkType;
                    }


                    WorksetConfiguration wk = new WorksetConfiguration();
                    ModelPath _modelpath = modeldoc.GetWorksharingCentralModelPath();
                    WorksetTable _worksetTable = modeldoc.GetWorksetTable();
                    IList<WorksetPreview> lstPreview = WorksharingUtils.GetUserWorksetInfo(_modelpath);

                    foreach (WorksetPreview item in lstPreview)
                    {
                        Workset wkset = _worksetTable.GetWorkset(item.Id);
                        if(item.Name== "Shared Levels and Grids"|| item.Name== "1/4 SCOPEBOX AND MATCHLINE"|| item.Name == "1/8 SCOPEBOX AND MATCHLINE")
                        {
                            if (wkset.IsOpen)
                            {
                                lstWkSet_Close.Add(wkset.Id);
                                
                            }
                        }
                    }
                    wk.Close(lstWkSet_Close);
                    RvtLinkType.LoadFrom(_modelpath, wk);
                    
                }

            }
            catch (Exception e)
            {
                msg = e.Message;
                return Result.Failed;
            }
            return Result.Succeeded;
        }
    }
}

Re: Transferring an old Revit File to a newer version


Re: text editor

$
0
0

Please note that this discussion forum is dedicated to programming Revit using the Revit API.
 
Therefore, you cannot expect an answer to a question such as yours relating to installation, product usage or end user support issues here.
 
You should try one of the non-API Revit product support discussion forums instead for that:
  
https://forums.autodesk.com/t5/revit-api-forum/this-forum-is-for-revit-api-programming-questions-not-for/td-p/5607765
  
The people there are much better equipped to answer your question than us programming nerds.

 

In this case, however, your request is not a question, is it, but a request.

 

Hence, it is better suited for the Revit Idea station:

 

https://forums.autodesk.com/t5/revit-ideas/idb-p/302
  
I hope this clarifies.
 
Thank you for your cooperation and understanding.
 
Best regards,
 
Jeremy

 

Re: Get all geometry elements from a mass

$
0
0

Dear Mohsen,

 

Thank you for your query and congratulations on moving one step further with it.

 

I implemented code a while back to collect all solids from certain family instances, unite them into one single solid, and process that with an extrusion analyser to obtain a projection of the 3D shape into a 2D boundary curve in the XY plane:

 

https://thebuildingcoder.typepad.com/blog/2013/04/extrusion-analyser-and-plan-view-boundaries.html

 

That sounds quite similar to what you are trying to do.

 

I hope this helps.

 

Best regards,

 

Jeremy

 

Re: Error: Internal setting is required by Revit and has been deleted

$
0
0

Dear Oliver,

  

Are you doing anything programmatically, or just using the standard Revit user interface?
  
If you are not doing anything programmatically, this is not the best place to ask such a question.

 

Please note that this discussion forum is dedicated to programming Revit using the Revit API.
 
Therefore, you cannot expect an answer to a question such as yours relating to installation, product usage or end user support issues here.
 
You should try one of the non-API Revit product support discussion forums instead for that:
 
https://forums.autodesk.com/t5/revit-api-forum/this-forum-is-for-revit-api-programming-questions-not-for/td-p/5607765
 
The people there are much better equipped to answer your question than us programming nerds.
  
I hope this clarifies.
 
Thank you for your cooperation and understanding.
 
Best regards,
 
Jeremy

 

Re: Array of Boxes (FilledRegion)

$
0
0

Hi,

 

There are different approaches to achieve this, i believe.


For example, you can create some local variables to store the x- and y-coordinate for each filled region.


Then, with the increment operator you can create something similar as shown in your picture.

 

I hope this is useful for you.

 

   int counter = 0;                          
    int x = 0;
    int y = 0;
 
    foreach (FilledRegionType frt in fillRegionTypes)
    {                                    
        List<CurveLoop> profileloops = new List<CurveLoop>();
    
        XYZ[] points = new XYZ[5];
        points[0] = new XYZ(0.00.00.0);
        points[1] = new XYZ(10.00.00.0);
        points[2] = new XYZ(10.010.00.0);
        points[3] = new XYZ(0.010.00.0);
        points[4] = new XYZ0.00.00.0 );
        
        CurveLoop profileloop = new CurveLoop();
         
        x = counter% + 1;
        y = counter/ + 1;
        
        XYZ pos = new XYZ(2.0 * x * 10.0, -2.0 * y * 10.00);

        pos += new XYZ(000);
        
        for (int i = 0; i < 4; i++)
        {
            Line line = Line.CreateBound(points[i].Add(pos), points[(i + 1)%4].Add(pos));
            profileloop.Append(line);
        }
                                
        profileloops.Add(profileloop);
        ElementId activeViewId = doc.ActiveView.Id;
        
        FilledRegion filledRegion = FilledRegion.Create(doc, frt.Id, activeViewId, profileloops);

        counter ++;

Re: Question About Computer Needed to Run Revit

Viewing all 66916 articles
Browse latest View live


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