Place Adaptive component by points

Place Adaptive component by points

H.echeva
Advocate Advocate
1,078 Views
2 Replies
Message 1 of 3

Place Adaptive component by points

H.echeva
Advocate
Advocate

Hello,

 

I am trying to place a very simple adaptive component that has two adaptive points.

I managed to load the family and place and instance into the project. The problem is that this approach doesn't allow me to pick the desired points in the project. I want to be able to place the family by picking two points in 3D. I know that the  pickpoint method only works in the current workplane and I know that there are workarounds to set first the workplane. However, I want a simple approach where the user just picks two points in 3D.

 

One solution that I was thinking is to use the postcommand method, and use the command place component (I would place a temporary instance first so the component is the desired one). However, after placing the component I want to retrieve information about the location of this family and the postcommand approach wouldn't allow me to do this...(I think).

 

Probably  I could use an event as a trigger to capture that information but I think it is too complicated.

Can you think of a simpler approach?

 

Many thanks in advance.

 

0 Likes
1,079 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

You cannot pick points in 3D using normal input devices.

 

You have a 2D screen, and a 2D cursor.

 

You have no 3D input device, so you cannot pick a 3D point.

 

That is why a workplane is used. That enables to to pick points on the 2D workplane that has been located and oriented appropriately in 3D space.

  

Sorry if I misunderstand your question!

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

RPTHOMAS108
Mentor
Mentor

With adaptive components I generally place them (NewFamilyInstance) obtain their points and then relocate them. I've not found a way to do it by input of points directly but then I've not really investigated much.

 

AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance

AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds

Use those ElementIds ontained to get ReferencePoint objects

Then change each ReferencePoint.Position by assigning a new XYZ.

 

How you obtain those XYZ's is up to your imagination within the limits of how RevitAPI allows you to pick points. As Jeremy notes if you are picking points not associated with other elements then you need an active workplane.

 

I often prefer the computer program to be able to assume things to do the work for me. The point you are asking a user to pick is there a logical way to find them without picking e.g. columns at grid intersection command. If you are joining something between two elements and those two elements can only be joined one way via connectors could you instead pick two elements etc. i.e. picking points requires more precise concentration than picking objects anywhere on their larger surface area.

 

 

0 Likes