API: Model vs. World coordinates

Here is my problem:

I've been using face normals to figure out which way components are facing, then tweaking the tranformation matrix to get the result I want. It works, except when a part comes in with a coordinate system different from the one that I am working with. (ie: Both normals should be (0,1,0) according to the geometry on the screen, but the component still has the same normals,coords and geometry it had in the part file (0,0,-1).

I would like to work with everyting in world coordinates, so is there a way to go about doing this? I found GetCurrentCoordinateSystem name, but it returns an empty string.

I am not against solving the problem a different way, so if anyone has any tips on inserting and mating components - please let me know.

Thanks,

Brian

Reply to
Brian Vogel
Loading thread data ...

Component2::Transform, MathUtility::CreateVector and MathVector::MultiplyTransform are the APIs you need. check this group archive for some messages on this topic

If I understood correctly, you might prefer to create a mate, then delete it once the parts are in place...

Reply to
Philippe Guglielmetti

So from what I've read the transform of the component contains the transform in world coordinates. I am still unsure of the actual steps to get the Normal from the face into world coordinates. Is it as simple as just multiplying the world transform against a transform with the face normal as the location?

Well, I was just wondering if there were any better ways than what I am doing now. In cases of pre-made parts - I will used named faces (but a lot of times I'll have to search using particular conditions in the geometry)

Thanks,

Brian

Reply to
Brian Vogel

"Brian Vogel" wrote : a écrit dans le message de news:Xns950C92F7E840DBrianVogelnoplacecom@66.192.254.230...

right: Dim normal as SldWorks.MathVector Set normal=swApp.GetMathUtility.CreateVector(face.Normal) Set normal=normal.MultiplyTransform(component.Transform2) ' normal.ArrayData returns the normal in world coordinates

Maybe with mate references ? Currently API has only PartDoc::GetMateReferenceEntity, but I won't be surprised if a next version offers access to multiple mate references... ;-)

Philippe Guglielmetti -

formatting link

Reply to
Philippe Guglielmetti

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.