How do I rotate an object around an arbitrary pivot? - fabricjs

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.

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.

ArangoDb Web Graph visualization - Select node attributes

I'm using ArangoDb Graph web interface.
I have created a graph with nodes from different collections.
As each node collection has its own attribute set, is there any way to choose different labels to be shown?
there currently is no way to select the label attribute per vertex collection.
You may want to open a feature request via github, or take a look at https://github.com/arangodb/arangodb/blob/devel/js/apps/system/_admin/aardvark/APP/frontend/js/views/graphViewer.js#L693 - However, the used Sigma.js library has to support it in first place.
I was having the same problem before. But, after setting the start node, the labels appear correctly.
Otherwise, the arrows, as you can see in the picture, do not appear. I set documents and edges. I tried changing colors, types, label, and nothing.
The worst problem is that I can save the properties one thousand times and, if I close the graph open it again, it loses the changes. I tried to find a Python code to set the label, but nothing till now.
Maybe the number of edges (1,435,022)?

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.

UIA - AutomationElement doesn't return correct name when list view changes

I'm trying to read the contents of a "list view" using automation. The first time I navigate to it, I'm able to go from item to item, getting the correct text for each list item. However, when I display a different screen (which is apparently reusing this display object), the text on the screen is different, but automation gets the same text as the first set. From then on I can only get the text for the first view I looked at. It's like the text is being cached and I'm only able to look at the cached view. UISpy, however, seems to grab the right values every time, and if I use it while my automation is paused, I end up getting the right values.
In my automation, I use Find to grab the header, and walk the tree to the List View and get the text for each element. I thought if you used the Current property, you got the live data. Apparently I was mistaken. How do I either refresh the tree or get the REAL data?
Yes, the Current property on a certain AutomationElement will return its current, 'live', value. UIA will not cache anything automatically, you'll have to declare it yourself and explicitly access the Cached properties.
What's probably happening is that the new tree items you're seeing after selecting a different screen, are actually re-created (and that actually makes sense, UI-wise), not just updated. You could easily determine if this is the problem by selecting the first screen and writing down the tree items' RuntimeId property (you can see it in UI Spy). Then, select the second screen and check if the RuntimeId has changed. If it has, then it's just not the same object instance.
If this is the case, all you need to do is get the items again. It'll be easier to do this using AutomationElement.FindAll with a ClassName property condition.

How to draw a self-call in Dia?

I just started using Dia. I'm trying to build a sequence diagram. I would like to represent self-calls. How does one do that in Dia? I can't figure it out.
Thanks.
First place a UML Message object with it's base attached to your lifeline.
Then, double-click the arrow (or right-click, Properties), and change the Message Type drop-down field to Recursive, and you'll get something like this:
Now you can drag the green anchor point around to make the Message arrow look as you'd like. (A note of caution: it seems that with a Recursive Message object, you can ONLY select the object by clicking on it exactly where the green anchor point WOULD BE. I say "would be" because of course you can't actually see that green anchor point when the object isn't selected.)
If you like, you can create another UML Lifeline object, and place it overlapping the existing lifeline, like this:
This isn't ideal, though, because there isn't actually anything attached to this second lifeline. The Recursive Message object doesn't let you choose where to attach it's arrowhead, because it's automatically attached to the lifeline from which it originated. And because the second lifeline isn't attached to anything, if you go moving objects around it will get left behind. But, it does look pretty, if that's what you're after. :)
A self call(or any other association) in UML is better expressed using the standard association notation instead of the message one. In DIA, insert an association notation from the toolbox on the left and add it to your canvas. Then in order to have it connect a class recursively(to itself) double click it and click select "Autoroute" as no. This will enable you to shape the route yourself and wont constrain you to the automatic straight line that gets drawn when linking a class to itself.
You would end up with something like this(in this example its a representation of a Node in a linked list):

Resources