Distance Variable & UCS

Discussion in 'AutoCAD' started by tracihabergham, Nov 25, 2004.

  1. I have written a program which inserts totems at 2metre or less centres and prompts the user for the position of the totems. This works perfectly if the ucs is in its normal position but if the ucs is rotated then the distances go haywire!!

    I measure the distance from the first insertion point to the second insertion point and a loop ensures that this distance is less than 2m and if not prompts the user for a new insertion point less than 2m away from the initial insertion point. When the ucs is rotated it gets stuck in this loop (see code below).

    I don't know why so any help would be greatly appreciated.

    Thank you

    Traci

    (defun totemline ( / ) ; draws lines between totems and posts

    (setq dist1 3000)
    (while (> dist1 2000)
    (Princ "\nPlease input the next point : ")(princ)

    (command "_line" ins1 pause "")
    (setq ins3 ins1)
    (setq ins2 (cdr (assoc 11 (cdr (entget (entlast))))))
    (command "_dist" ins1 ins2)
    (setq dist1 (getvar "distance"))

    (if (> dist1 2000)
    (progn
    (command "_erase" (entlast) "")
    (princ "\nThis must be less than 2000mm")(princ)
    ); end progn
    );end if

    );end while

    ); ends totemline function
     
    tracihabergham, Nov 25, 2004
    #1
  2. tracihabergham

    Joe Burke Guest

    Traci,

    Since no one has replied, I'll venture a guess. You may need to trans any block
    insertion point from WCS to UCS. Like this, though I can't be sure, since what you
    posted doesn't indicate how the "ins1" var is assigned a value.

    (command "_line" (trans ins1 0 1) pause "")

    It has no effect when the coordinate system is WCS. In a rotated UCS, it translates
    the block insertion point to UCS. Which is typically needed when combining pick
    points (always UCS) with data that's expressed in terms of WCS. Like a block's
    insertion point.

    HTH. If not, ask more questions.

    Joe Burke
     
    Joe Burke, Nov 28, 2004
    #2
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.