Revit API - Copy a Face from the project into a family - revit-api

I have a Revit Face, think of a RuledFace with holes, or NurbsSurface, maybe. I need a copy of that Face in a new family document.
Currently, I'm tesselating/triangulating the face and put those triangles into my family, which kind of works, but I have these intermediate edges between the triangles, which is very bad in my scenario.
I could not find a way to create e.g. a BRepBuilder with the exact information of the Face element.

The easiest way to transfer geometry from one Revit document to another is by using the copy and paste functionality provided by the CopyElements method. Examples of using it are provided in the Revit SDK samples DuplicateViews and GenericStructuralConnection.

Related

How to find Ramp landing space and Intermediate landings in Revit API?

I am trying to find Landing Spaces as well as Intermediate Landings for Ramps using Revit API, for a few of my models. So far I have tried to find Start and Endpoints of the ramp using location parameters as mentioned in the following blog space (How to find start/end of ramp in revit, perhaps with sketches?) , but it seems that this parameter is unavailable in the models I am trying to use.
 I tried to explore any other way using Revit API functionalities but with no visible success so far. Also, I am new to Revit Api's and as such have a limited understanding of what features are available in API.
Can someone help me Identify Ramp Landings or Ramp endpoints?
Ramp Location
Ramp Property Pallete
I see three possible approaches:
Location
Sketch
Geometry
Using the Location property, casting it LocationCurve and grabbing the endpoints from that as suggested in the other discussion you link to would be the optimal solution.
Another approach mentioned in that thread is to use the sketch defining the ramp to determine its start and end points. Getting hold of the sketch elements is not completely trivial, but absolutely doable, as explained in The Building Coder discussions on
Stable Reference Relationships
Retrieving and Snooping Dependent Elements
If all else fails, the final alternative would be to grab and analyse the ramp geometry to deduce the required information from that.

Revit API wall Thickness using Revit api 2020

I am working at revit api to get walls of special room this is the part i have completed with Projecting rays technique. This is the main point that i am unable to do Wall thickness. Is there any way i can extract wall thickness. i am using revit 2020.
Thank you
You can only get the wall width via the WallType of the wall.
On top of that, Revit will give you the width in its native unit (usually the imperial system). It is possible to convert it easily with the UnitUtils class. Documentation here
The first step is to get the WallType. To do that, you have to retrieve the type ElementId via GetTypeId(), then the element via document.GetElement(), and finally cast it to WallType.
From the type, we obtain the width in Revit native units, which we convert into milimeters via the UnitUnits class.
Here is a code snippet:
WallType wallType = document.GetElement(wall.GetTypeId()) as WallType;
double nativeWitdh = wallType.Width;
double milimeterWidth = UnitUtils.ConvertFromInternalUnits(nativeWitdh,DisplayUnitType.DUT_MILLIMETERS);
Best regards,
François
Sure, very easy.
Use the WallType Width property.
You could very easily have answered this question by yourself, either by searching the Internet or by exploring the wall and its properties using RevitLookup.
Please perform some minimal research for yourself before asking a question and making others do the work for you.
Here is some more advice on researching how to solve a Revit API programming task.

"Split Wall" using Revit API

I have a wall and have to split it using Revit API. I have placement points as an input and need to split the wall based on those points. Do we have any command to achieve this using Revit API?
Any help would be greatly appreciated.
No there is no direct method for that. You'll have to make a copy of your wall with ElementTransformUtils.CopyElement method, then move one point of the original and one point of the copy to the location of your split point. To move the points, you have to create and assign a new curve to the wall location:
((LocationCurve)wall.Location).Curve = newCurve;
What do you mean by split wall? You can split certain family instances, such as beams, columns, etc. using the FamilyInstance.Split method. That does not apply to walls, however. You can split faces on a wall to apply different materials. For that, please refer to the FaceSplitter class.

Best and optimized way to create web based Interactive Choropleth Map

I am going to build an interactive Choropleth map for Bangladesh. The goal of this project is to build a map system and populate different type of data. I read the documentations of the Openlayers, Leaflet and D3. I need some advice to find the right path. The solution must be optimized enough.
The map i am going to create will be something like the following http://nasirkhan.github.io/bangladesh-gis/asset/base_files/bd_admin_3.html. It is prepared based on leaflet js. But it is not mandatory to work with this library. I tried with Leaflet because it is easy to use and found the expected solution within a very short time.
The requirement of the project is to prepare a Choropleth map where i can display the related data. for example i have to show the population of all the divisions of Bangladesh. at the same time there should be some options so that i can show the literacy rate, male-female ratio and so on.
the solution i am working now have some issues. like the load time is huge and if i want to load the 2nd dataset then i have to load the same huge geolocation data, how can i optimize or avoid this situation?
Leaflet has a layers control feature. If you cut down your data to just what is required, split it into different layers and allow the user to select that layers they are interested in viewing that might cut down on the loading of the data. Another option is to simplify the shape of the polygons.

Looking for a good web framework for data visualization

Just wondering if anyone can point me to a good web framework for displaying large-scaled network
Need the ability to display only a small portion of the network, but allowing the possibility to drill down on certain node/portion of the network interactively.
Optionally the ability to allow interactive editing of the network/graph; e.g., connecting nodes or breaking edges.
The simpler the better!
There's our library, mxGraph. If you want open source you could try JIT or D3.
I had similar requirements and I tested about four libraries including d3 and infoVis/JIT.
I was using force-directed layout in both d3 and infoVis.
Both of them are quite close but I ended up choosing infoVis/JIT because I had some problems in d3, solutions of which were not easy.
1: When you have a graph with many nodes in d3, the graph will keep moving/animating for quite longer time. I found that it was because d3 graph animates per tick. I found some solutions here and in forums but it was not easy to solve this problem and they did not work for me.
2: Once the graph is rendered, if you try and drag a node, the whole graph would move and animate itself. Whereas my requirement was to be able to drag and position individual nodes independently, keeping the graph as it is, so that user can re-arrange nodes if he/she wants to. I could not find any simple solution for this one in d3.
Both of these problems were solved in infoVis/JIT.
#"Need the ability to display only a small portion of the network, but allowing the possibility to drill down on certain node/portion of the network interactively."
I have implemented this functionality using infoVis.

Resources