UCS and points?

Discussion in 'AutoCAD' started by GARYNTX, May 17, 2004.

  1. GARYNTX

    GARYNTX Guest

    if the ucs is rotated then some of my lisp routines will not work corectly.........especailly the ones in which an objects insertion point is needed. For example if I select a block and want to get the insertion point I would use
    (cdr (assoc 10 (entget (car (entsel))))). The point that is retrieved from this is different from where the block is located. Is there a way to retrieve from the actual location of the block relative to the ucs. In this particular drawing the ucs is rotated at 45 degrees and I have a block that is located at point (20 10 0) but the association code has (10 7.07107
    21.2132 0.0)
     
    GARYNTX, May 17, 2004
    #1
  2. GARYNTX

    Tom Smith Guest

    Use trans to translate from UCS to WCS.
     
    Tom Smith, May 17, 2004
    #2
  3. Or look into Help, type "points" into the Index, and see "converting between
    UCS and WCS". Might provide some helpful information.

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, May 17, 2004
    #3
  4. GARYNTX

    Tom Smith Guest

    Or look into Help, type "points" into the Index, and see "converting
    between
    Since he's asking about modifying lisp functions to work in varying
    coordinate systems, I assumed he'd want a lisp solution rather than a
    command-line CAL solution, or the inelegant approach of calling CAL from
    lisp

    To translate from UCS to WCS: (trans <point> 1 0)

    To translate from WCS to UCS: (trans <point> 0 1).
     
    Tom Smith, May 17, 2004
    #4
  5. Whoops... When you get to that help page by way of the Index, it's not
    obvious that it's a CAL subcommand.

    But I think there's some OTHER way of converting on the fly, back in the
    dark recesses of my memory, like putting some punctuation character before
    the point coordinates or something. I think the main idea was that when
    you're in a User Coordinate System, you can specify a point in the World
    Coordinate System location without changing to the WCS to do it. Since I
    haven't found it, I'm not sure whether it would work in a lisp routine or
    not. Anybody remember what that is?

    Kent Cooper, AIA

    ...
     
    Kent Cooper, AIA, May 17, 2004
    #5
  6. GARYNTX

    Doug Broad Guest

    Kent,
    The coordinate prefix for WCS is *.

    The trans function as Tom has explained is what is
    needed though.

    Regards,
    Doug
     
    Doug Broad, May 17, 2004
    #6
  7. GARYNTX

    Tom Smith Guest

    The coordinate prefix for WCS is *.

    Gosh, I don't think I ever knew that!

    The tricky part, to me, is keeping track of which things are kept in which
    coordinate system. Best I recall, in different situations I've used
    different strategies. Sometimes, I've translated every piece of info to WCS,
    done any necessary calcs, then translated the result back to UCS. Other
    times it's seemed easier to just switch to the WCS, do everything, then
    restore the UCS after I'm done.
     
    Tom Smith, May 18, 2004
    #7
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.