Angle, direction, orientation ...?

Angle, direction, orientation ...?

Anonymous
Not applicable
1,659 Views
5 Replies
Message 1 of 6

Angle, direction, orientation ...?

Anonymous
Not applicable

 

I would like to know the right way to do it.

I would like to insert an accessory (again 😁) by giving two points for the orientation and the connector of my accessory

How to orient my accessory by two given points.

Foto.PNG

 If anyone can help me, it will be cool

0 Likes
1,660 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

I assume that by 'accessory' you mean a point-based family instance.

 

In that case, the family instance Location property will be a LocationPoint:

 

https://www.revitapidocs.com/2020/0a36b1c4-f112-38f6-7b14-d572ea11584b.htm

 

You could set the location point origin to the first point and then use the second insertion point to define the rotation angle.

 

This depends on where the origin is defined on your family definition, by the way.

 

Probably the easiest choice would be to define the family so that point 1 is the origin and point 2 is on the X axis with Y and Z equal to zero.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 6

ahmed.errazak
Enthusiast
Enthusiast

thanks,

No, only on the points, most I get from the supplier and everyone makes them in their own way
i wanted neutral point that have nothing to do with that accessorie

0 Likes
Message 4 of 6

prasannamurumkar
Advocate
Advocate

 

Not sure understood question correct.

 

 

1.suppsoe  two points  are their.

2.calculate relative vector between point.

3.calculate angle between relative vector and the axis about which want to rotate.

4.the use rotate api.(give angle which is calculated)

 

0 Likes
Message 5 of 6

ahmed.errazak
Enthusiast
Enthusiast

Yes with Revit when I click on point 1 towards point 2 it returns 0 degrees
but if I click on point 3 towards point 4 it also returns 0 degrees

Angle.PNG

 

here is what I use to return the angles:
Dim Vector As XYZ = EndPoint.Subtract (StartPoint) .Normalize
Dim Angle as double = Vector.AngleTo (XYZ.BasisX)

 

I don't know how to make a subroutine so that it returns the angle defined by the second point

0 Likes
Message 6 of 6

jeremytammik
Autodesk
Autodesk

Maybe your start and end points are in the wrong coordinate space, e.g., symbol geometry == family definition, not the instance geometry == model.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes