how to rotate a FamilyInstance around 3 axes

how to rotate a FamilyInstance around 3 axes

dirk.neethling
Advocate Advocate
2,387 Views
7 Replies
Message 1 of 8

how to rotate a FamilyInstance around 3 axes

dirk.neethling
Advocate
Advocate

Can anyone please show me how to rotate a FamilyInstance derived from Metric Generic Model.rft about the 3 axes?

 

0 Likes
2,388 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

 

Hi dirk,

 

You can use like this

 

Let say familyinstance =fin

 

 1st  : Get Family Instance Location point (LP)

 2nd  : Now create unbound line according to direction(X,Y,Z) Like.
   
     XBasis=Line.Create(LP, fin.GetTransform().BasisX)
     YBasis=Line.Create(LP, fin.GetTransform().BasisY)
     ZBasis=Line.Create(LP, fin.GetTransform().BasisZ)

 

 3rd : Rotate Element
   
     ElementTransformUtils.RotateElement(document, element.Id, XBasis,Angle)
     ElementTransformUtils.RotateElement(document, element.Id, YBasis,Angle)
     ElementTransformUtils.RotateElement(document, element.Id, ZBasis,Angle)

 

Note: Can you explain more about "derived from Metric Generic"

 

This may help you

Message 3 of 8

dirk.neethling
Advocate
Advocate

 "derived from Metric Generic" just means I use the "Metric Generic Model.rft" template to generate the Family.

0 Likes
Message 4 of 8

Anonymous
Not applicable
Oh,

I think you derived metrices for rotation.

I hope this will solve your issue.
0 Likes
Message 5 of 8

paulight
Observer
Observer

Singh,

 

Your code lines are simple and good.  What program are you coding in?

Thanks!

0 Likes
Message 6 of 8

ivo.lafeber
Advocate
Advocate
where do you get the Angle which is used in ElementTransformUtils.RotateElement(document, element.Id, XBasis,Angle) ?
0 Likes
Message 7 of 8

jeremy_tammik
Alumni
Alumni

where do you get the Angle... ?

  

I would guess from the same place as you, when you ask how to rotate a FamilyInstance around 3 axes... What rotation? Which axes?

  

Neither the question nor the answer specify any details, so the answer matches the question well.

    

Orientation in 3D space requires you to provide some pretty specify input in order to be able to discuss it at all, cf.,

    

  

 

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

sragan
Collaborator
Collaborator

Not really a programming comment, but let's also not forget 3D rotations are not commutative.  

 

Rotating around one axis and then another is not necessarily the same as rotating around the second axis and then the first.

 

It's almost like adding 2+3+4 and then adding 2+4+3 and getting different answers.

 

 

 

 

0 Likes