Revit API: How to Create Elements (Part 1) [RevitAPI + Python]

Sdílet
Vložit
  • čas přidán 9. 09. 2024

Komentáře • 48

  • @ErikFrits
    @ErikFrits  Před rokem +1

    📘 Master Getting Elements with Revit API +: Python (1$+)
    www.erikfrits.com/ebook

  • @mahmoudfawzy8354
    @mahmoudfawzy8354 Před rokem +2

    We find a huge amount of wonderful information in every video 💜💙💚

    • @ErikFrits
      @ErikFrits  Před rokem

      Thanks, that's awesome.
      Happy Coding!

  • @au2411
    @au2411 Před 8 měsíci +1

    Thank you very very much .. your videos are very informative .. May Allah guide you and give you from where you don't count

    • @ErikFrits
      @ErikFrits  Před 8 měsíci

      Thanks!
      Happy to help where I can ;)

  • @user-im3lm2eb9h
    @user-im3lm2eb9h Před 10 měsíci +1

    thank you this video is very helpful

  • @kslifter1
    @kslifter1 Před rokem +1

    Thanks for another great video, this helps navigating the Revit API site. It was a bit daunting the first time I visited.

    • @ErikFrits
      @ErikFrits  Před rokem

      Thanks Ian!
      It will feel more natural after you spend more time there. I hope I managed to fast track it a little ⏩

  • @ravinderkamboj9649
    @ravinderkamboj9649 Před rokem +1

    Very Usefull , Thank you for sharing

  • @bloproject242
    @bloproject242 Před rokem +1

    Thank you.

  • @madhusudhanrao4147
    @madhusudhanrao4147 Před rokem +1

    Sessions are very informative, I would suggest will you go little slowly to make understand to align with the common person's capability

    • @ErikFrits
      @ErikFrits  Před rokem

      Thanks.
      I think this video is quite slow in comparison to my others.
      I try to make my videos as short and concise as possible, but sometimes I overdo it with editing and it becomes a bit faster that I wanted to.
      Still learning how to do better videos ;)

  • @andreheynes9027
    @andreheynes9027 Před 8 měsíci +1

    Great Videos man. wish I could afford your course. Anyway I'm trying to place a beam using this code but I get this error. Exception : System.MissingMemberException: 'type' object has no attribute 'ValueProvider'.
    All I changed was in the last step before commit ..., StructuralType.Beam)

    • @ErikFrits
      @ErikFrits  Před 8 měsíci

      Hey,
      It's hard to debug without the code, but have a look here
      learnrevitapi.com/python-snippets
      Search for 'Create Beam'
      In general when we create elements it's about what type of element placement does family has. (Point Based, Line Based)

  • @parimalvala8742
    @parimalvala8742 Před rokem +1

    Thanks. Great Tutorial. Symbol = get_Type_by_name(' Placeholder - Type A') , I am bit confused there. How we get to know that we need to write "get_Type_by_name"

    • @ErikFrits
      @ErikFrits  Před rokem +1

      Timestamp in the video would be helpful since I made it long time ago.
      I think you reffer to my function to get all Types with matching name. In my case I wrote a function to get a type of element with exact match that I am writing there. So if my Type that I want to get had a name of 'RANDOM_NAME_ABC' then that's what I would need to write. Also if multiple families have this type, then I would get all of them, so need to account for that too.
      You can see code for this function also on my blog, but I am sure I showed it during the video as well.
      CZcams is blocking external links so search in google for : Revit API: Get Elements or Types by Type/Family name. There is article on my learnrevitapi website.

  • @camilosierraaranguren9994
    @camilosierraaranguren9994 Před 6 měsíci +1

    Hi Erik, i have a question... when i create the window i see an error "The symbol is not active" can you help me with this error?

    • @ErikFrits
      @ErikFrits  Před 6 měsíci

      in Revit API types have to be activated if they weren't used in the project before.
      FamilySymbol Class has Activate method.
      You can check if it was activated already with IsActive Property.
      You just call it on your type before you use it.
      Or as a dirty workaround, you can manually place an instance of that specific type in Revit and it will be activated. But I would recommend using Revit API, it's not complicated step!

  • @mohamedanany3832
    @mohamedanany3832 Před rokem +1

    very nice video, I just wondering if it possible to insert hosted element that will be host on link model ?!

    • @ErikFrits
      @ErikFrits  Před rokem

      If it's possible to do it manually in Revit, then most likely there is a way to do it with Revit API.
      I am not sure I would place hosted elements on elements in linked model. I imagine if you unload Revit link, you might encounter a lot of warnings/errors because of it.

    • @mohamedanany3832
      @mohamedanany3832 Před rokem

      @@ErikFrits I did it ! and Thanks alot Erik for interesting to help ❤️🙏

  • @iaconst4.0
    @iaconst4.0 Před rokem +1

    Nice! can we use sublime.text to program ? and can we use python's libraries in your code??

    • @ErikFrits
      @ErikFrits  Před rokem +1

      Yes, you can use any IDE, but process setting up Revit API Autocomplete will be different. So try to search if any guide on Sublime is available.
      Regarding libraries - There are plenty of useful packages already included in pyRevit environment and you can see them in pyRevit GitHub / site-packages folder. I always try to not use any other packages so people can follow my tutorials and code.
      You could also add your own packages, I would ask on pyRevit forum to see what's the best practice. Or just drop packages in site-packages folder (in AppData/pyRevit...) to test it, and then you probably could make it work if you place it in your lib folder.
      P.S. Remember, we never execute code in pyCharm/Sublime or any other IDE, it's used just for writing code, but it can only be executed from inside of Revit (RevitPythonShell, Dynamo, pyRevit...)

    • @iaconst4.0
      @iaconst4.0 Před rokem +1

      @@ErikFrits thanks a lot!! from Peruu!

  • @FelanaDiamondraRANDRIAMADISON

    Hey 👋Can you help me to create a sphere on revit

    • @ErikFrits
      @ErikFrits  Před rokem +1

      What do you mean?
      Are you trying to create a Sphere with DirectShape or you have a family of a sphere?

    • @FelanaDiamondraRANDRIAMADISON
      @FelanaDiamondraRANDRIAMADISON Před rokem

      @@ErikFrits I don't have a family of a sphere , but I've tried to create it with DirectShape

    • @ErikFrits
      @ErikFrits  Před rokem

      I used to have a script about creating DirectShapes, but I think I lost it when I accidentally deleted my development scripts...
      As far as I remember we first needed to create geometry itself, and then apply that geometry to a DirectShape instance to make it an actual object in Revit project. I used to play with boxes, but there should be a method for creating a sphere, at least I would expect it exists.
      I would also recommend looking into creating Component In-Place. Direct Shape are not very good elements to work with in Revit in my experience, so maybe it's worth exploring it as well.
      Happy Coding!

  • @toannghiale8064
    @toannghiale8064 Před rokem +1

    Hello,
    i watched your video, and i think maybe you can help me to solde my problem.
    my question about a plug-in for picking a family window and placing it on the wall of Revit by using an user interface, python and C#
    i'm facing this kind of error, : "Value cannot be null. Parameter name: symbol". in familysymbol, i try using methode NewFamilyInstance to pick one of the type window in revit that i insert before.
    Actually, I think that my error come from the win_type variable used to create the window family is null at this time.
    Do you know how to handle with this kind of error? i try several solutions but still not find the best.

    • @ErikFrits
      @ErikFrits  Před rokem

      HI Toan,
      It seems to me that you didn't get the right symbol. It tells you that symbol argument can not be null, meaning variable that you provided does not have a ValidObject.
      Try to print all your arguments before you create a window for debugging purposes. I am quite sure that you will notice that you are not getting any symbol.

    • @toannghiale8064
      @toannghiale8064 Před rokem +1

      @@ErikFrits hi, thanks for your response. i can finally find a solution for that.
      Actually, i'm facing another challenge.
      after selecting the wall, there is another UI displayed to choose the "number of instances to place" , where I wanted to add the 2 textbox height and width for modifying the dimensions of the windows according to the values entered by the user for the parameters "height" and "width" in "dimensions". Do you know what i mean?
      You think it's possible?

    • @ErikFrits
      @ErikFrits  Před rokem +1

      @@toannghiale8064 if you use pyRevit then have a look at rpw.FlexForm. It will allow you to quite esily make a form with custom components. You can just make a few TextBoxes to get user input.
      I have shown an example in the end of
      Randomize Parameter Values video
      czcams.com/video/aVS1v2DLoQc/video.html

    • @toannghiale8064
      @toannghiale8064 Před rokem +1

      @@ErikFrits great video, i really appreciate that.
      Actually, by regarding your video, i can modify some family parameter of windows but i'm facing now a problem that i can't use python to modify "built-in parameters" in window's family like "Height" and "Width". They are predefined in Revit and have a specific name and meaning.
      Can you have a solution for that?

    • @toannghiale8064
      @toannghiale8064 Před rokem +1

      @@ErikFrits hi
      czcams.com/video/BCbw-qHLqGc/video.html
      do you have the same video like this one but for python?

  • @FelanaDiamondraRANDRIAMADISON

    I am trying the same example when creating a wall using Wall.Create method but i got an error " ArgumentsInconsistentException : Curve length is too small for Revit's tolerance (as identified by Application.ShortCurveTolerance)"

    • @ErikFrits
      @ErikFrits  Před rokem +1

      It says that your curve is too short.
      Try to print your start and end points coordinates, so you might see an error in there.
      Maybe you using the same point as start and end ?

  • @toannghiale8064
    @toannghiale8064 Před rokem +1

    test COMMENT

    • @ErikFrits
      @ErikFrits  Před rokem +1

      test REPLY? 😅

    • @toannghiale8064
      @toannghiale8064 Před rokem +1

      @@ErikFrits I dont know why i can' comment in our last discusison with the link of github

    • @toannghiale8064
      @toannghiale8064 Před rokem +1

      Can i send it to you by email?

    • @ErikFrits
      @ErikFrits  Před rokem +1

      CZcams comment system is broken. I also often miss comments because I never get notifications...😪
      Send it in my LinkedIn, that woupd be easier and quicker.

    • @toannghiale8064
      @toannghiale8064 Před rokem +1

      i send you a messge in LinkedIn.