Current UCS Help

Discussion in 'AutoCAD' started by mgray, Aug 25, 2004.

  1. mgray

    mgray Guest

    I want to translate coordinates of a block insert from world to the current UCS. The problem is the current UCS is not named and in order to define it in VBA you have to name it can give it an origin, xvector, and yvector. I cant seem to get this information about the active ucs because it does not have a name.

    Any ideas for a work around? Or am I missing something?
     
    mgray, Aug 25, 2004
    #1
  2. If all you need to do is "tilt" it into the ucs, just set its NORMAL
    property - you can get that from any object already in the unnamed ucs

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Aug 26, 2004
    #2
  3. Does this work for you? Unnamed ones seem to show up as "_ACTIVEx" for me

    Code:
    Sub List_ActiveUCS()
    Dim currUCS As AcadUCS
    Dim varXvec As Variant
    Dim varOrigin As Variant
    Dim varYvec As Variant
    
    ' Return current UCS of active document
    Set currUCS = ThisDrawing.ActiveUCS
    MsgBox "The current UCS is " & currUCS.Name, vbInformation, "ActiveUCS
    Example"
    
    varOrigin = currUCS.origin
    varXvec = currUCS.XVector
    varYvec = currUCS.YVector
    
    MsgBox "Origin: " & varOrigin(0) & ", " & varOrigin(1) & ", " & varOrigin(2)
    MsgBox "xVec: " & varXvec(0) & ", " & varXvec(1) & ", " & varXvec(2)
    MsgBox "yVec: " & varYvec(0) & ", " & varYvec(1) & ", " & varYvec(2)
    
    End Sub
    
     
    James Belshan, Aug 26, 2004
    #3
  4. mgray

    mgray Guest

    That is about what I was trying to do but I get
    a runtime error 'Null Object Id' when I run it at

    Set currUCS = ThisDrawing.ActiveUCS

    If the UCS is saved with a name it work fine but no one here ever saves UCSs. Mine does not show up at "_Activex".

    Any idea why?
     
    mgray, Aug 27, 2004
    #4
  5. hmmmm... i dunno.

    I made a UCS with "UCS NEW " and then just rotated about axes. That's when
    I got one named "_Active1".

    Could you use GetVariable to get the UCS system variables? I realize that
    still wouldn't get you access to the UCS methods like TranslateCoordinates.

    James
     
    James Belshan, Aug 27, 2004
    #5
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.