Need higher Entget precision

Discussion in 'AutoCAD' started by honeyman, Jan 24, 2005.

  1. honeyman

    honeyman Guest

    Hi,

    I am using entget to get the insertion point and rotation of a xref to copy to another xref. The problem is that the insertion point is in UTM coords so it is very large. The actual insertion point (from the properties tab with percision set to highest) is x=-2663.56774171 y=-5999728.69268053

    When using entget, I get this: (10 -2663.57 -5.99973e+006 228.653) for group code 10 with is the insertion point.

    This is causing significant differences when I use these values for the new xref, in both the x which is rounded to 2 decimal places, and y which is off almost 2.0 meters.

    Is there any way to get higher precision (my units presicion -LUPREC- is already set to highest and no change)?

    If not, is there any other way I can get the insertion point through LISP?

    Thanks,
     
    honeyman, Jan 24, 2005
    #1
  2. honeyman

    Rad_Cadder Guest

    Hi,
    You might look at TRANS
    (trans pt from to [disp])

    Pretty sure this will take care of your problem.
     
    Rad_Cadder, Jan 24, 2005
    #2
  3. You are getting the best you can already.
    Entget does not round off like you think, its only the display of the return value that is rounded.
    If you get the group 10 code:
    (setq 10GRP (cdr (assoc 10 (entget (car (entsel))))))

    Then display the full values:
    (rtos (car 10grp) 2 16)
    (rtos (cadr 10grp) 2 16)
    (rtos (caddr 10grp) 2 16)

    you will see that they are not rounded.
    If you are getting errors from your routine, its probably because angles are involved.
    The LUPREC has no effect on programattic things like lisp, only on command line displayed items.

    honeyman <>
    |>Hi,
    |>
    |>I am using entget to get the insertion point and rotation of a xref to copy to another xref. The problem is that the insertion point is in UTM coords so it is very large. The actual insertion point (from the properties tab with percision set to highest) is x=-2663.56774171 y=-5999728.69268053
    |>
    |>When using entget, I get this: (10 -2663.57 -5.99973e+006 228.653) for group code 10 with is the insertion point.
    |>
    |>This is causing significant differences when I use these values for the new xref, in both the x which is rounded to 2 decimal places, and y which is off almost 2.0 meters.
    |>
    |>Is there any way to get higher precision (my units presicion -LUPREC- is already set to highest and no change)?
    |>
    |>If not, is there any other way I can get the insertion point through LISP?
    |>
    |>Thanks,

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Jan 24, 2005
    #3
  4. interesting idea, any reason why that would have higher precision than using other math commands like polar?

    Rad_Cadder <>
    |>Hi,
    |>You might look at TRANS
    |>(trans pt from to [disp])
    |>
    |>Pretty sure this will take care of your problem.

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Jan 24, 2005
    #4
  5. honeyman

    Jeff Mishler Guest

    How are you passing the values now? Autocad stores ALL coordinates to 15
    significant digits, whether you can see them in your listing, or not.

    Command: (setq ent (entget (car (entsel))))

    Select object: ((-1 . <Entity name: 400f7250>) (0 . "LINE") (330 . <Entity
    name: 400f2cc0>) (5 . "4542") (100 . "AcDbEntity") (67 . 0) (410 . "Model")
    (8
    .. "S") (100 . "AcDbLine") (10 1.78801e+006 269370.0 0.0) (11 1.78846e+006
    269366.0 0.0) (210 0.0 0.0 1.0))

    Command: (setq x (cadr (assoc 10 ent)))
    1.78801e+006

    Command: (setq y (caddr (assoc 10 ent)))
    269370.0

    Command: (setq z (cadddr (assoc 10 ent)))
    0.0

    Command: (mapcar '(lambda (x) (rtos x 2 16)) (list x y z))
    ("1788012.123654163" "269369.6163435830" "0.000000000000000")
     
    Jeff Mishler, Jan 24, 2005
    #5
  6. honeyman

    honeyman Guest

    I was passing the values by using:

    (setq basexref (entget (car (entsel "Pick xref with correct insertion: "))))
    (setq baseins (assoc 10 basexref))
    (setq baserot (assoc 50 basexref))
    (setq modxref (entget (car (entsel "Pick xref to paste insertion to: "))))
    (setq modxref (subst baseins (assoc 10 modxref) modxref))
    (setq modxref (subst baserot (assoc 50 modxref) modxref))
    (entmod modxref)

    Thanks for all your replies. So it looks like I will have to extract the values to a string, and then use those values for my new entity list? Seems like a round-about way of doing it, but if it works...

    Thanks again.
     
    honeyman, Jan 24, 2005
    #6
  7. honeyman

    Jeff Mishler Guest

    No, the real->string->real is NOT what you want. The way you were doing it
    should work correctly.

    Check this: After modifying the XREF with your code, do an entget on the
    modified object. Then do a (rtos (cadr (assoc 10 ent)) 2 16) on both of the
    Xrefs.....you should get identical values.
     
    Jeff Mishler, Jan 24, 2005
    #7
  8. honeyman

    honeyman Guest

    Ok strange.

    I just ran my lisp again, and it seems to have worked much better now, even though I have NOT changed it.

    Any idea why?

    Thanks again.
     
    honeyman, Jan 24, 2005
    #8
  9. make sure your osnaps or snap settings are not hijacking your point.

    honeyman <>
    |>Ok strange.
    |>
    |>I just ran my lisp again, and it seems to have worked much better now, even though I have NOT changed it.
    |>
    |>Any idea why?
    |>
    |>Thanks again.

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Jan 24, 2005
    #9
  10. honeyman

    honeyman Guest

    I don't see how that is possible. I am changing the entity data, which should have nothing to do with osnaps or snap.

    Well, it worked for the moment, so I will revisit it when I need to use it again.

    Thanks
     
    honeyman, Feb 8, 2005
    #10
  11. honeyman

    ecable Guest

    I ran into this the other day with a routine to insert blocks with attributes rotated to zero.
    The user had osnaps on and the variable osnapcoord set to 0
    (Running osnaps override keyboard entry)
    You can capture the osnapcoord variable cange it to 2 then set it back if ou want.
    Hope that helps.
     
    ecable, Feb 8, 2005
    #11
  12. honeyman

    honeyman Guest

    Ok, again, (and sorry if I seem frustrated) but I am changing the entity data. Take a look at the routine in my post above. I take the insertion point from the entity data of one object and then put that into another object's entityd data and used entmod to update it. Osnaps cannot interfere with anything (to my understanding) since there is no user pick points, no user keyboard entries, nothing to cause this.

    I just tried it again, and I am still getting a difference.
    I get this values
    Origional Xref
    X=-2663.5677
    Y=-5999728.6927
    Angle=359d58'31.8068"

    New Xref
    X=-2663.5677 (this works)
    Y=-5999728.6883 (THIS DOESN'T)
    Angle=359d58'31.8068" (this also works)

    This is using the same lisp routine I have in my previous post.

    So, any suggestions?

    Thanks,
     
    honeyman, Feb 9, 2005
    #12
  13. honeyman

    Jeff Mishler Guest

    Would you care to email me you're subject drawings and complete lisp
    routine? I have tried and tried to duplicate this behaviour without success.
    I am really curious as to what could be causing this.....if the files are
    too large, please email me direct and I'll give you an FTP site you could
    post them to.
     
    Jeff Mishler, Feb 9, 2005
    #13
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.