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

Re: Drive Geometry with "INSTANCE_SILL_HEIGHT_PARAM" in window and doo

$
0
0

Dear Jakob,

 

Thank you and congratulations for bringing your question out of our private email communication out here into the public forum.

 

Are you asking whether you can set the value of that parameter on a selected family instance after it has been inserted into the BIM project?

 

If so, the answer is yes, and it is one of the first and simplest tasks that is covered right at the beginning of the tutorial material pointed to by the instructions on getting started with the Revit API:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

Here is a snippet of sample code showing how to retrieve an element from its element id, get the parameter associated with a built-in parameter enum such as INSTANCE_SILL_HEIGHT_PARAM, and set its value:

 

https://thebuildingcoder.typepad.com/blog/2019/06/accelerator-dash-pattern-fix-element-rotation-and-phase.html#5

 

There are many, many more samples where that one came from.

 

You might also want to check out a tutorial specifically on setting parameters in Revit. Here is the first one that happened to come up right now:

 

https://spiderinnet.typepad.com/blog/2011/04/parameter-of-revit-api-1-builtinparameter.html

 

By the way, here is another recent interesting question that is vaguely related to yours, althopugh a bit more specific and complex:

 

https://forums.autodesk.com/t5/revit-api-forum/how-to-set-window-family-sill-height-instance-parameter-editable/td-p/9130421

  

Cheers,

  

Jeremy

  


Re: Generate Views from Rooms.

$
0
0

I have no idea what they do internally, but are we not already well on track to achieve all that you need?

 

Re: Retrieve Dimension Style by name using python

$
0
0

on the other hand, you can use .Name attribute with Revit FamilyInstance and Element.

i guess the attribute is not used for the same reason on ElementType, because if just for setting.

Only one instance addin plugin

$
0
0

How can I protect run only one instance of addin plugin?

If user run Revit 2018 and Revit 2019 on same PC...need protect only one instance.

About set filter rules... (revit2018)

$
0
0

1.PNG2.PNG

 

Hello, I am a beginner of REVIT API.
Recently I have been writing a code that applies the filter rules in a short time.

Works well if only one filter rule is applied, such as the first capture.

However, the code for implementing a second capture, for example, does not work.

If a user-defined level exists, the user has created a code to add filter rules for it.

Is there a problem with my code?

thank you.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 private ParameterFilterElement Pvt_CreateFloorLevelFilter( Document doc, string filterName, double value )
    {
      ParameterFilterElement filter = null;
 
      ICollection<ElementId> categories = new List<ElementId>();
      categories.Add( new ElementId( BuiltInCategory.OST_Floors ) );
 
      // Level Offset Value Paramter
      ElementId param1 = new ElementId( BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM );
 
      // Level Parameter
      ElementId param2 = new ElementId( BuiltInParameter.LEVEL_PARAM );
 
      // Level of user select
      Level targetLevel = _form.Transfer_SelectedLevel();
 
      var miliValue = UnitControl.Millimeters_To_Feet( value );
 
      IList<FilterRule> rules = new List<FilterRule>();
 
      // Set rule Level Offset
      FilterRule rule1 = ParameterFilterRuleFactory.CreateEqualsRule( param1, miliValue, Double_Epsilon );
      rules.Add( rule1 );
   
      // If there's user selected Level, add it  
      if ( targetLevel != null )
      {
        FilterRule rule2 = ParameterFilterRuleFactory.CreateEqualsRule( param2, targetLevel.Id );
        rules.Add( rule2 );
        filter = ParameterFilterElement.Create( doc, filterName, categories, rules );
        return filter;
      }
      // If there's no user selected Level, apply only this rule
      else
      {
        filter = ParameterFilterElement.Create( doc, filterName, categories, rules );
        return filter;
      }
    }
cs

 

Sometimes  Use Rebar API SetHookOritentation methond is invalid

$
0
0

 

When using the Revit project of the structural template, there is no problem creating reinforcement.

 

When using the Revit project of the building template, the created rebar cannot change the hook direction (SetHookOrientation is invalid), There is another problem, the created rebar plus the hook will produce many rebar shape family types.  Did anyone else find out?

What should I do?

Revit API - C# - Sun and shadow setting - calculating sun direction

$
0
0

Hi all,

I'm using the example code from Jeremy Tammik to calculate the sun directions for a year period through Revit API. https://thebuildingcoder.typepad.com/blog/2013/06/sun-direction-shadow-calculation-and-wizard-update.html

 

So I basically loop it in order to get the whole year 8760 hour's sun direction.

 

However, when I export the data to excel, the data seems not right. the vector for sun direction stays the same for many hours, which is not right. I double-checked the Activeframe time. It is correct. 

 

Below is my code (with visual studio version attached) and the attached image is part of my data, which shows the problem. Thank you!

 

sdsd.png

 

 

            Autodesk.Revit.DB.Document doc = uiapp.ActiveUIDocument.Document;

            Autodesk.Revit.DB.View view = doc.ActiveView;

            SunAndShadowSettings sunsetting = view.SunAndShadowSettings;

            Transaction transun = new Transaction(doc);

            transun.Start("sun1");

            IList<DateTime> datetime = new List<DateTime>();

            IList<DateTime> activeframe = new List<DateTime>();

            //create list of 0 to 23
            IList<double> timesss = test3.EnumerableUtilities.RangePython(0, 24, 1).ToList();

            IList<XYZ> revitsun = new List<XYZ>();
            DateTime StartDate = new DateTime (2018,1,1);
            DateTime EndDate = new DateTime(2018,12,31);

            foreach (DateTime days in EachDay(StartDate, EndDate))
            {
                
                datetime.Add(days);
            }

            foreach (var dat in datetime )
            {
                DateTime datee = dat;
                int year = dat.Year;
                int month = dat.Month;
                int date = dat.Day;

                foreach (var da in timesss)
                {
                    double ti = da;
                    DateTime sunstart = DateTime.SpecifyKind(new DateTime(year,month,date), DateTimeKind.Utc);

                    sunsetting.SunAndShadowType = SunAndShadowType.StillImage;


                    sunsetting.StartDateAndTime = sunstart.AddHours(ti);

                    if (sunsetting.IsTimeIntervalValid(SunStudyTimeInterval.Hour)) // check that this interval is valid for this SunAndShadowType

                        sunsetting.TimeInterval = SunStudyTimeInterval.Hour;

                    // check for validity of start and end times
                    if (!(sunsetting.IsAfterStartDateAndTime(sunsetting.EndDateAndTime)
                        && sunsetting.IsBeforeEndDateAndTime(sunsetting.StartDateAndTime)))
                        TaskDialog.Show("Error", "Start and End dates are invalid");


                    // Set the initial direction of the sun at ground level (like sunrise level)
                    XYZ initialDirection = XYZ.BasisY;

                    DateTime time = sunsetting.GetFrameTime(sunsetting.ActiveFrame);

                    activeframe.Add(time);
                    //string frametime = time.ToString();

                    

                    // Get the altitude of the sun from the sun settings
                    double altitude = sunsetting.GetFrameAltitude(
                      sunsetting.ActiveFrame);

                    // Create a transform along the X axis based on the altitude of the sun
                    Transform altitudeRotation = Transform
                          .CreateRotation(XYZ.BasisX, altitude);

                    // Create a rotation vector for the direction of the altitude of the sun
                    XYZ altitudeDirection = altitudeRotation
                          .OfVector(initialDirection);

                    // Get the azimuth from the sun settings of the scene
                    double azimuth = sunsetting.GetFrameAzimuth(
                      sunsetting.ActiveFrame);

                    // Correct the value of the actual azimuth with true north

                    // Get the true north angle of the project
                    Element projectInfoElement
                      = new FilteredElementCollector(doc)
                        .OfCategory(BuiltInCategory.OST_ProjectBasePoint)
                        .FirstElement();

                    BuiltInParameter bipAtn
                      = BuiltInParameter.BASEPOINT_ANGLETON_PARAM;

                    Parameter patn = projectInfoElement.get_Parameter(
                      bipAtn);

                    double trueNorthAngle = patn.AsDouble();

                    // Add the true north angle to the azimuth
                    double actualAzimuth = 2 * Math.PI - azimuth + trueNorthAngle;

                    // Create a rotation vector around the Z axis
                    Transform azimuthRotation = Transform
                      .CreateRotation(XYZ.BasisZ, actualAzimuth);

                    // Finally, calculate the direction of the sun
                    XYZ sunDirection = azimuthRotation.OfVector(
                          altitudeDirection);

                    revitsun.Add(sunDirection);

                    string countsundirection = sunDirection.ToString();
                }
            }

Re: Create inclined dimension between 2 parallel planes

$
0
0

Hi  thanks for replying. I could not really understand on how to implement that. Can you give me an code sample. It would really help.

 

Thanks.

 


Can't install Revit 2020

$
0
0

I downloaded the Student's Revit 2020 version, but I can't install it, i try more time. The system notified a fail 1603. 

Help me.

Re: About set filter rules... (revit2018)

$
0
0

It was solved by using "SCHEDULE_LEVEL_PARAM" instead of "LEVEL_PARAM".
Thank you.

 

 

Duct system

$
0
0

Hello

I block on the creation of a Duct system

for piping it's

-> SystemPipe = Plumbing.PipingSystemType.Create(Doc, MEPSystemClassification.OtherPipe, "SystemPipe")

 

But for ductsystem there is a problem, I can not finish it

-> SystemDuct = Mechanical.MechanicalSystem.Create(Doc, MEPSystemClassification.OtherAir, "SystemDuct")

 

Someone knows which way I need to go? ☹️

回复: Abort Pickobject()

$
0
0

Many thanks for your solution! It works perfectly!

catch 22 - generating floor from CurveChain

$
0
0

Hello,

I want to generate a floor from a subface of a room, mostly it works like a charme but I managed to get one situation where I have the following problem:

New Floor method throws the error that the provided curve is not a closed loop, and guess what this is true. (which is funny because I get the profile Curve from a face)

So i decided to simply close the Curve, but than trying to add the line to close the curve I get an error that the curve I am trying to add is to short.


So I can't generate a floor because there is a gap, but I can't close the gap because it is too small?

import rhino into revit

$
0
0

Guys Can you help me out , I have a rhino (.3dm) geometry model . What is the procedure to convert this Rhino model into Revit model ?

 

 

Re: import rhino into revit

$
0
0

Unfortunately, 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: Duct system

$
0
0

It is unclear what you are trying to achieve.

 

On one hand, you mention PipingSystemType.

 

On the other, MechanicalSystem, not MechanicalSystemType.

 

A system is different from a system type.

 

Please clarify exactly what you want to achieve for yourself, first of all, before discussing this any further.

 

I suggest you work through the end user interface first to build an appropriate sample model and analyse that, its elements, their properties, relationships and classes, e.g., using RevitLookup.

 

Re: Only one instance addin plugin

$
0
0

What is 'protect run'?

 

What do you mean by 'protect'?

 

Re: Revit API - C# - Sun and shadow setting - calculating sun direction

$
0
0

Please execute the same analysis manually through the user interface.

 

What results do you see there?

 

Re: Sometimes  Use Rebar API SetHookOritentation methond is invalid

$
0
0

Can you achieve what you are trying to do manually through the user interface in the project based on the building template? 

 

Place family instance into RVT file

$
0
0

Hi,

I have a problem with placing family instance into rvt project file using Design Automation,

I tested that solution localy with design automation debugger and it worked fine. I recieving nullReference error when I try to get Family symbol by 

var list = new FilteredElementCollector(Document)
               .OfClass(typeof(FamilySymbol));

 

 

Viewing all 66787 articles
Browse latest View live


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