dtext woes

Discussion in 'AutoCAD' started by johnhatfield, Aug 5, 2004.

  1. johnhatfield

    johnhatfield Guest

    Can anyone tell me why this does not work correctly?

    Acac2002

    The routine asks the user to pick a top center point as the start point of the dtext and then after the user selects that point, the actual start point is then moved south of the actual pick point. Thing is, that the routine checks and stores the osmode status and turns osmode off before picking the start point. This is not good if the user has an osmode selected and then the routine turns it off. So, I took out the turning off of the osmode. If there is an osmode and it is not turned off, the dtext does not get moved, but if the osmode is either turned off by the routine or there was no osmode set, then the dtext gets moved. Any ideas?

    I picked this code up from various posts in these groups and pieced it together for my use.

    ;;;;;;;;;;
    (defun DTR (A)
    (* PI (/ A 180.0))
    )
    ;;;;;;;;;;
    (defun C:MDT( / OSM OTHM SNM DIMSC SPA SPB)
    (setq OSM(getvar "OSMODE"))
    (setvar "OSMODE" 0)
    (setq OTHM(getvar "ORTHOMODE"))
    (setvar "ORTHOMODE" 0)
    (setq SNM(getvar "SNAPMODE"))
    (setvar "SNAPMODE" 0)
    (setq DIMSC(getvar "DIMSCALE"))
    (setq SPA(getpoint "\n Pick the TOP CENTER point: "))
    (setq SPB(polar SPA (DTR 270.0) (* DIMSC 0.09375000)))
    (command "._dtext" "_J" "_TC" SPB (* DIMSC 0.09375000) "0.00000000")
    (setvar "OSMODE" OSM)
    (setvar "ORTHOMODE" OTHM)
    (setvar "SNAPMODE" SNM)
    (princ)
    )

    Thanks in advance.

    John Hatfield
     
    johnhatfield, Aug 5, 2004
    #1
  2. johnhatfield

    coachball8 Guest

    I'm guessing here because I had my own problems with polar this morning, but I would think that whether or not the start point of the text got moved would depend more on the dimscale than the osnap setting.
    (setq SPB(polar SPA (DTR 270.0) (* DIMSC 0.09375000)))
    This line takes the selected point and moves it a distance of .09375 multiplied by the dimscale. At least I think that's what's happening. HTH
     
    coachball8, Aug 5, 2004
    #2
  3. johnhatfield

    T.Willey Guest

    (defun C:MDT( / OSM OTHM SNM DIMSC SPA SPB)
    (setq OTHM(getvar "ORTHOMODE"))
    (setvar "ORTHOMODE" 0)
    (setq SNM(getvar "SNAPMODE"))
    (setvar "SNAPMODE" 0)
    (setq DIMSC(getvar "DIMSCALE"))
    (setq SPA(getpoint "\n Pick the TOP CENTER point: "))
    (setq OSM(getvar "OSMODE")) <- move to after getpoint
    (setvar "OSMODE" 0) <- move to after getpoint
    (setq SPB(polar SPA (DTR 270.0) (* DIMSC 0.09375000)))
    (command "._dtext" "_J" "_TC" SPB (* DIMSC 0.09375000) "0.00000000")
    (setvar "OSMODE" OSM)
    (setvar "ORTHOMODE" OTHM)
    (setvar "SNAPMODE" SNM)
    (princ)
    )

    I just moved some things... but it seems to work fine. Now the osnape won't turn off until after the user picks there point.

    Tim
     
    T.Willey, Aug 5, 2004
    #3
  4. Take out all the OSMode code and just use this:

    (command "._dtext" "_J" "_TC" "_Non" SPB (* DIMSC 0.09375000) 0.0)


    --
    R. Robert Bell


    Can anyone tell me why this does not work correctly?

    Acac2002

    The routine asks the user to pick a top center point as the start point of
    the dtext and then after the user selects that point, the actual start point
    is then moved south of the actual pick point. Thing is, that the routine
    checks and stores the osmode status and turns osmode off before picking the
    start point. This is not good if the user has an osmode selected and then
    the routine turns it off. So, I took out the turning off of the osmode. If
    there is an osmode and it is not turned off, the dtext does not get moved,
    but if the osmode is either turned off by the routine or there was no osmode
    set, then the dtext gets moved. Any ideas?

    I picked this code up from various posts in these groups and pieced it
    together for my use.

    ;;;;;;;;;;
    (defun DTR (A)
    (* PI (/ A 180.0))
    )
    ;;;;;;;;;;
    (defun C:MDT( / OSM OTHM SNM DIMSC SPA SPB)
    (setq OSM(getvar "OSMODE"))
    (setvar "OSMODE" 0)
    (setq OTHM(getvar "ORTHOMODE"))
    (setvar "ORTHOMODE" 0)
    (setq SNM(getvar "SNAPMODE"))
    (setvar "SNAPMODE" 0)
    (setq DIMSC(getvar "DIMSCALE"))
    (setq SPA(getpoint "\n Pick the TOP CENTER point: "))
    (setq SPB(polar SPA (DTR 270.0) (* DIMSC 0.09375000)))
    (command "._dtext" "_J" "_TC" SPB (* DIMSC 0.09375000) "0.00000000")
    (setvar "OSMODE" OSM)
    (setvar "ORTHOMODE" OTHM)
    (setvar "SNAPMODE" SNM)
    (princ)
    )

    Thanks in advance.

    John Hatfield
     
    R. Robert Bell, Aug 5, 2004
    #4
  5. When osnaps are on the text is being placed at the snap point. Try

    (command "._dtext" "_J" "_TC" "_none" SPB (* DIMSC 0.09375000)
    "0.00000000")


    --
    Ken Alexander
    Acad2004
    Windows XP

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    point of the dtext and then after the user selects that point, the
    actual start point is then moved south of the actual pick point. Thing
    is, that the routine checks and stores the osmode status and turns
    osmode off before picking the start point. This is not good if the
    user has an osmode selected and then the routine turns it off. So, I
    took out the turning off of the osmode. If there is an osmode and it
    is not turned off, the dtext does not get moved, but if the osmode is
    either turned off by the routine or there was no osmode set, then the
    dtext gets moved. Any ideas?
     
    Ken Alexander, Aug 5, 2004
    #5
  6. johnhatfield

    johnhatfield Guest

    Tim,

    Thanks. That works fine now. I guess the polar function is affected by osnaps.

    Have a great day.

    John Hatfield
     
    johnhatfield, Aug 5, 2004
    #6
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.