API: Model vs. World coordinates

Discussion in 'SolidWorks' started by Brian Vogel, Jun 18, 2004.

  1. Brian Vogel

    Brian Vogel Guest

    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
     
    Brian Vogel, Jun 18, 2004
    #1
  2. 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...
     
    Philippe Guglielmetti, Jun 18, 2004
    #2
  3. Brian Vogel

    Brian Vogel Guest

    Component2::Transform, MathUtility::CreateVector and
    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
     
    Brian Vogel, Jun 18, 2004
    #3
  4. :
    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 - www.dynabits.com
     
    Philippe Guglielmetti, Jun 19, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.