Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Siemens PLM Community
- NX Customization and Programming
- NX Programming & Customization Forum
- Orientation matrix for inserting fastener into a h...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-03-2016 10:51 AM

Hello everyone!

I'm trying to insert fasteners into holes using NX Open. As far as the base point is concerned, it is fine. But I'm struggling with orienting fasteners correctly to insert them into randomly oriented holes. I understand that one way is to calculate the orientation matrix from two vectors - fastener axis vector and hole axis vector. But I discovered that I quite forgot all those maths topics. Is there any ready C# (or maybe VB) algorithm that does exactly that?

6 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-03-2016 10:24 PM

Best option is to find the seating faces on the hole as well as the fastener, get their face normals and orient your fastener normal opposite to the hole seating face normal.

I guess you would want to create assembly constraints between the hole and fastener. I would suggest you record a journal and modify the code to suit your requirement.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-04-2016 12:10 AM - edited 04-04-2016 01:41 AM

*"and orient your fastener normal opposite to the hole seating face normal."*

That's exactly the question - how is the orientation matrix computed? The journal won't give you the answer. This is the maths problem.

I can create assembly constraints, but it's optional in the application that I'm making. Also, that is the extra operation that has cairries overhead. I believe it's quite costly in terms of time to use assembly contraints - and then delete them - merely to orient components. In this case orientation matrix must be used.

Or correct me if I am wrong. I'm not 100% getting NX Open orientation matrix at the moment. Is there more info on it somewhere in the docs?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-04-2016 04:27 PM - edited 04-04-2016 04:44 PM

I have some python code that does something similar. I made another post on how to set up numpy with NX Open. Feel free to pm me if there is anything unclear.

check here for the methods/attributes that will give you your fastener/hole vectors. It's likely that NX will return the vectors in a list or a tuple

#use numpy to turn your vectors into matrices

fastener_array=numpy.array(fastener_vector)

hole_array=numpy.array(hole_vector)

dot_product=numpy.dot(fastener_array,hole_array) #assuming that fastener_array and hole_array are unit vectors of length 1 if dot_product==1.0: #insert whatever you want your code to do below

alternatively, you could use the cross product

cross_product=numpy.cross(fastener_array,hole_array) cross_norm=la.norm(cross_product) #if normalized cross product =0, then vectors are parallel if cross_norm==0.0:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-04-2016 11:50 PM

yamada

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-09-2016 05:40 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-11-2016 03:37 PM

*theUFSession.Csys.AskMatrixOfObject*. It was of the wrong orientation for my purpose - components were upside down - so I had to find a way to rotate it in a correct position. The solution came from the example called "*rotate selected component about its own x axis*" in the Solution center. So this problem is solved for me.

Follow Siemens PLM Software

© 2017 Siemens Product Lifecycle Management Software Inc