Is there a way to modify connected walls, such as the walls in a house, using the Revit API? - revit-api

I am trying to modify a house, such as the length/height of a particular house using the Revit API. I have successfully modified an individual wall and also a selected wall among many other in the same project, by referencing the id of the wall. The same type of referencing that is by id of the wall, if done to walls in a house, does not cause any change in the dimensions. I am assuming it is due to the walls being connected.
Is there a different way of referencing connected walls? Nonetheless, how can I modify the walls in a house using the Revit API?
Below is the code for modifying walls using their ID, although it does not apply to connected walls.
if (wall.Id.IntegerValue.Equals(355391) || wall.Id.IntegerValue.Equals(355351))
{
wallLocation = wall.Location as LocationCurve;
XYZ pt1 = wallLocation.Curve.GetEndPoint(0);
XYZ pt2 = wallLocation.Curve.GetEndPoint(1);
pt2 = pt2.Add(new XYZ(inputParameters.Width, 0, 0));
Line newWallLine = Line.CreateBound(pt1, pt2);
wallLocation.Curve = newWallLine;
}

Based on my experience, Tampering with walls specifically will lead to many problems like walls unjoin, misallocation, Annotations being deleted and of course, too many Revit Warnings that, for the most part, can't be handled.
My advice - or in this case it may be an answer - forget about modifying walls location using Revit API, Try creating walls from scratch if that will help.

Related

Follow Solver - To follow on Z Axis Only

I am working on a project which shows navigation from one point to another in Hololens. I am trying to create this application via MRTK2.
I have created a navigator Arrow and I want it to follow the user Head only on Z- Axis. It should Restrict any movement on the X and Y axis.
For this, I have attached Follow Solver to Object and have Added tracked Target type to Head.
Also, I have attached Move Axis COnstraint Script to restrict movement on the X and Y axis.
But When I play scenes, Object position and rotation values are changed. Something like below.
It works from the script when I calculate the camera position and Update the arrow position.
straightarrow.transform.position = new Vector3(straightarrowpos.x, straightarrowpos.y, camposition.z + 2.623f);
Is there any way this can be handled via Solvers instead of updating the position via script?
Mayank Pande
The constraints and Constraint manager provided by MRTK are currently only applicable to Bounds control and Object manipulator, please refer to Constraint manager - MRTK 2 | Microsoft Learn. Existing solvers cannot meet your needs, but you can create a new solver, please refer to Solver overview - MRTK 2 | Microsoft Learn.

Direct Shape Import material quirk, Material Color is invalid via API until material is edited via UI

- Testing in Revit 2017
- Dynamo Python node (/ revit lookup / any API call)
Description
I would like to query a material's Color Property. This material is an automatically generated material from a Rhino 3dm(DirectShape Import). The Color property should be the layer color and this holds true when looking in the material browser and how its rendered. However, querying it via the Revit API results in an invalid color property.
The color parameter stored in a material from a direct shape is not properly initialized/errors out until you actively use the ui material browser and modify the material. Until then, using the API (u can test this with revit lookup) to get the material color return an invalid color, making retrieving the rgb value not possible
However edit the material via the Ui, such as editing the surface pattern or color...This somehow refreshes the color parameter and allows one to use the revit API to read the color parameter afterward.
Things I've tried thus far
+ Updating another property (such as surface pattern / color) via the API, doesn't do the same as when updating via the UI material browser
+ Doc.Regenerate() after updating the property. (No changes)
+ tried getting built in parameter'doc.GetElement(ElementId(28736714)).Parameter[BuiltInParameter.MATERIAL_PARAM_COLOR].AsValueString()' returns blank.
+ tried saving document after updating misc. property via api, doesn't change anything.
Ideas
+ reading the solids and faces , somehow translating them to brep geometry and recreating the direct shape. in this way one can assign the material IDs to each face. however, geometry faces as far as i know cannot be converted into brep builder faces.
Visual Explanation
Visual PDF explanation of the problem can be seen here: https://www.docdroid.net/n2j9Auy/170628-color-direct-shape-material-quirk.pdf.html
You might want to ask this same question in the official Dynamo forum as well, since that is monitored actively by the Autodesk Dynamo guys, who are in closer contact with the Revit development team:
https://forum.dynamobim.com/

How can I activate (display) a view using Revit API?

I am trying to activate a view using Revit API. What I want to do exactly is to prompt the user to select some walls, but when the user is asked that, he can't switch views to select more walls (everything is greyed out at that point).
So the view I want to activate (by that I mean, I want this view to be actually shown on screen) already exist, and I can access its Id.
I have seen threads about creating, browsing, filtering views, but nothing on activating it... It's a Floor Plan view.
So far I can access its associated ViewPlan object, and associated parameters (name, Id, ..).
Is it possible to do ?
Thanks a lot !
Arnaud.
I think the most preferred way is the UIDocument.RequestViewChange() method. The tricky part about this is that unless you've designed your application to be modeless with external events or idling, it may not actually happen until later when control returns back to Revit from your addin.
(There's also setting the UIDocument.ActiveView property - not positive if this has different constraints).
The other way that I have done it historically is through the use of the UIDocument.ShowElements() command. The trick here is that you don't have control of the exact view - but if you can figure out the elements that appear only in that view, you can generally make it happen (even if you have to do a separate query to get a bunch of elements that are only in the given floorplan view).
Good Luck!
I think the solution to your problem may be:
commandData.Application.ActiveUIDocument.ActiveView = View;
The ActiveView is a property and it has {get and set} options.
ActiveView has only a get accessor, what Mostafa suggests will not work.
I have used the RequestViewChange() method with a modal dialog and have not had problems so far.

Node + Google Street View: How to check if a Street View is available in a certain radius

I'm trying to use Node and Google Street View together (Google doesn't officially support this). However, one of the things I noticed about Street View is that if you supply it with a point that doesn't have a Street View... it doesn't do anything...
I would like to use Node to reference the Google Maps API (Street View specifically) to find a point within a radius that has a Street View.
I saw a few packages like: https://github.com/moshen/node-googlemaps
but the docs aren't all that helpful. I know this API can be used to generate an image of a Street View, but I'm looking to find a point so that I can send it to a client so that they can display an interactive Street View (Street View Service).
Is any of this at all possible? This may have been worded a little bit weirdly... any questions just let me know!
Thanks!
I think this sample provided just that: https://developers.google.com/maps/documentation/javascript/examples/streetview-service
on init, they add a on click listener with sv.getPanoramaByLocation(event.latLng, 50, processSVData);, which let the street view search a point with data within 50m of the given point, then call the processSVData. Within the call back, they check if there is any points returned by checking if (status == google.maps.StreetViewStatus.OK), if so, the location that contains a street view is return in data.location.pano, which is what they used to add a marker.
I think you should be able to do the same thing in the back end too.

How do I rotate an object around an arbitrary pivot?

I want to implement physical draggable behavior - when an object is dragged by a certain point the whole object "follows" that point - sort like the balls here: http://www.mrdoob.com/projects/chromeexperiments/ball-pool/
Now in order to do that, I need to set the touch-point (when the user clicks the object in order to drag it) as the rotation center.
I havn't found a relevant property in fabric.js objects to achieve that, I tried using groups as pivots but I failed miserably. Would appreciate a pointer in the right direction.

Resources