Should I Always Translate Coords?

Discussion in 'AutoCAD' started by Oberer, Mar 4, 2005.

  1. Oberer

    Oberer Guest

    I tend to use my ucs quite often and notice that many LDD routines and some that i've written need the coords to be in the world ucs.

    So how do you safely program for drafters like me? That is, do you check the ucs, or translate the coords?

    Would it be safe for me to always include a line similar to:
    PickPoint = ThisDrawing.Utility.TranslateCoordinates(PickPoint, acWorld, acUCS, False)
     
    Oberer, Mar 4, 2005
    #1
  2. Points returned by GetPoint, GetEntity, Object Properties, etc are always
    in WCS, regardless of what the UCS is set to. The following simple example
    will show different values if you move the UCS around. The user is entering
    (0,0,0) in the current UCS, and the varPt() holds the equivalent WCS coords.

    Code:
    Sub test()
    Dim varPt As Variant
    varPt = ThisDrawing.Utility.GetPoint(, "Type 0,0,0 -->")
    MsgBox varPt(0) & ", " & varPt(1) & ", " & varPt(2)
    End Sub
    
    One annoying thing that I find is that the current UCS does affect entities
    that you add. For example, a circle created by the AddCircle method will be
    parallel to the UCS X-Y plane. But the coordinates that you give for its
    center are in WCS. This is just an ACAD VBA quirk that you have to learn to
    work around.

    I didn't really answer your specific question, but I would say that you have
    to just know what coordinates are going to be input to your routine, your
    textboxes, etc, and do a translation if necessary.

    James


    some that i've written need the coords to be in the world ucs.
    the ucs, or translate the coords?
    acUCS, False)
     
    James Belshan, Mar 4, 2005
    #2
  3. Oberer

    Oberer Guest

    I'm going to bump this again to further the discussion. What i'm really asking is why don't we all check the ucs?
    There are MANY LDD routines that refuse to check.
    Even something basic like autocad's "find" (at least in 2k2) is thrown off by not being in the world ucs.
     
    Oberer, Apr 8, 2005
    #3
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.