Please Follow the steps below to get the correct result:
1) Get the SolidWorks math vector object from your current normal: MathUtility::CreateVector.
2) Get the component of your face (Entity::GetComponent). Or any other method depending on your case.
3) Get the transformation of the component: IComponent2::Transform2
4) Multiple the transformation from #3 to the vector from #1. MathVector::MultiplyTransform.
5) Get the new vector coordinates: MathVector::ArrayData.
i going to try it like You described.
The confusing thing for me is point 4.
I added an assembly an a VBA-Macro.
Open the Test.sldasm und preselect a face before running the macro.
In the second last line there is the vector.
I would say the vector should always contain 0s and 1s and nothing else.
But there are also other values.
Cann you tell m what i am doing wrong?!
test.zip 3.3 MB
When I run it, it always returns only 1s and 0s. Except that due to math/rounding errors, sometimes 0 looks like 1.520569961E-16, which is just as good as 0.
thanks for the Information.
I going to investigate a little mir in the evening.
Hi Artem and Josh,
Thanks for your help.
I had one more mistake in my code: I dind't use the Face parameters for the createvector (i used 0, 0, 1).
I also didn't saw that there was the "E-16" at the end of the value.
So now i works fine.
Have a nice Weekend.
I would also recommend taking taking a look at some of the API examples in the help for a template for organizing your code for readability. It really helps debugging, and helps when others have to come behind you and decipher your code.
i know that the Code style in this example wasn't nice to check.
I just copied those lines together from the api help to check if its the right was or if i was on the wrong way.
Now that i know it is the right way i adapted the Code in a better way to read in my addin project.
Next time i habe a question i will provide Code that will be easier to read.
Artmen!! Always there to save the day! Thank you so much it helped me too!