I just cant get it

Discussion in 'AutoCAD' started by Mack Attack, Sep 11, 2003.

  1. Mack Attack

    Mack Attack Guest

    I am trying to come up with a simple tail added to my section marker with a
    defined wider foot and length. I can't get it to stay at an orthoganal
    angle and the last length of the tail to work.
    Please help and thanks in advance

    (defun C:tail ( / ort cla sna pt1 pt2 pt3 dst dsc wd1 lng )

    (SETQ ORT (GETVAR "orthomode")) ;capture ortho mode
    (SETVAR "orthomode" 1) ;turn on ortho
    (SETQ CLA (GETVAR "clayer")) ;capture current layer
    (SETQ SNA (GETVAR "osmode")) ;capture osmode
    (SETVAR "osmode" 16) ;change osmode to quadrant only
    (SETVAR "plinewid" 0) ;set pline width to zero
    (command "layer" "m" "A-anno-symb" "c" "7" "" "") ;make or change to
    proper layer

    (SETQ pt1 (GETPOINT "\nPick first point:")) ;set first selection
    (SETQ pt2 (GETPOINT "\nSelect end point:")) ;set length of tail
    (SETQ dsc (GETVAR "dimscale")) ;capture dimscale value
    (SETQ wd1 (* 0.0625 dsc)) ;set width of pline
    (SETQ lng (* 0.1875 dsc)) ;set lenght of tail
    (progn
    (command "pline" pt1 pt2 "w" wd1 "" lng)
    )
    (SETVAR "orthomode" ORT)
    (SETVAR "clayer" CLA)
    (SETVAR "osmode" SNA)
    )
     
    Mack Attack, Sep 11, 2003
    #1

  2. without testing and the feeling, that I don't know how you really want the result to look like...

    change
    (command "pline" pt1 pt2 "w" wd1 "" lng)

    to

    (command "_pline" pt1 pt2 "_w" wd1 "" "_l" lng "")


    should produce something like
    -----=====

    if you want to specify the length, don't forget the "_LENGTH" option...

    should the second segment go just east:

    (setq pt3 (mapcar '+ pt2 (list lng 0.0 0.0)))

    (command "_pline" pt1 pt2 "_w" wd1 "" pt3 "")



    hth
     
    ruul morawetz, Sep 11, 2003
    #2
  3. still don't know exactly. again 2 possibilities for you to choose from:

    a) from pt1 to pt2 then 90 degrees CCW?

    (setq p3 (polar pt2 (+ (angle pt1 pt2) (* pi 0.5)) lng))
    (command "_pline" pt1 pt2 "_w" wd1 "" pt3 "")

    b) from pt1 to pt2 then horizontally to the east?
    if nothing of this suits your needs, please provide an image or clear description.
    ;^)
     
    ruul morawetz, Sep 12, 2003
    #3
  4. Mack Attack

    Mack Attack Guest

    OK after looking at my question I realize it was worded very bad. I can not
    seem to get the whole pline at a specified angle (i.e. 0, or 90). I can get
    the tail of the pline strait or perp to the main pline but the pline itself
    comes up at a weird angle.
    Again all help is greatly appreciated.
     
    Mack Attack, Sep 12, 2003
    #4
  5. Mack Attack

    Mark Propst Guest

    i haven't seen the rest of your code but
    (command "_pline" pt1 pt2 "_w" wd1 "" pt3 "")
    should be
    (command "_pline" "_non" pt1"_non" pt2 "_w" wd1 "" "_non" pt3 "")
    to avoid osnap problems
    ?
     
    Mark Propst, Sep 12, 2003
    #5
  6. Mack Attack

    Mack Attack Guest

    Here is my code as of today

    (defun C:ta ( / ort cla sna pt1 pt2 pt3 dst dsc wd1 lng zer )

    (SETQ ORT (GETVAR "orthomode")) ;capture ortho mode
    (SETVAR "orthomode" 1) ;turn on ortho
    (SETQ CLA (GETVAR "clayer")) ;capture current layer
    (SETQ SNA (GETVAR "osmode")) ;capture osmode
    (SETVAR "osmode" 16) ;change osmode to quadrant only
    (SETVAR "plinewid" 0) ;set pline width to zero
    (command "layer" "m" "A-anno-symb" "c" "7" "" "") ;make or change to
    proper layer

    (SETQ pt1 (GETPOINT "\nPick first point:")) ;set first selection
    (SETQ pt2 (GETPOINT "\nSelect end point:")) ;set length of tail
    (SETQ dsc (GETVAR "dimscale")) ;capture dimscale value
    (SETQ wd1 (* 0.0625 dsc)) ;set width of pline
    (SETQ lng (* 0.1875 dsc)) ;set lenght of tail
    (SETQ pt3 (polar pt2 (+ (angle pt1 pt2) (* pi 0.5)) lng))
    (command "_pline" pt1 pt2 "_w" wd1 "" "_l" lng "")

    (SETVAR "orthomode" ORT) ;returns the ortho to original state
    (SETVAR "clayer" CLA) ;returns the current layer to original state
    (SETVAR "osmode" SNA) ;returns the osnap to original state
    )


    I can not seem to get the whole pline at a specified angle (i.e. 0, or 90).
    I can get the tail of the pline strait or perp to the main pline but the
    pline itself comes up at a weird angle.
    Again all help is greatly appreciated.
     
    Mack Attack, Sep 12, 2003
    #6
  7. Mack Attack

    Mack Attack Guest

    I did like that suggestion and I have added since that post but I am still
    having the problem mentioned before
     
    Mack Attack, Sep 15, 2003
    #7
  8. On 15.09.2003 17:04 Mack Attack wrote:



    I did like that suggestion and I have added since that post but I am still having the problem mentioned before


    hmm. could you please describe what
    1) you want to click/enter/show on screen
    2) each input of yours shall affect

    from the comment of your code i guess you want to specify a point for  the pline placement.

    you ask for a 2nd point. comment says "distance".
    you took (getdist) and calculation of following points into consideration?

    you have ortho on, osmode set to QUAD, but changed the code that the routine doesn't use the osnap.
    ..
    if you enter
    10,10 and 10,0 you should get a vertical pline
    10,10 and 20,10 you should get a horizontal one.

    so i don't see a problem with this routine.
    waiting for you to show us ;-)



    "Mark Propst" <nonentityatplanetkcdotcom> wrote in message news:...



    you didn't like "_non" ? "Mack Attack" <> wrote in message news:...



    Here is my code as of today












    -- ruul wblocks don't exist
     
    ruul morawetz, Sep 15, 2003
    #8
  9. Mack Attack

    Mack Attack Guest

    I know I have sucked at trying to explain the problem but I think you understand what I am trying accomplish.  The fact that the ortho is on does not affect the finished line angle.  The fact that it uses the second pick point (as the final placement of the main line) there is nothing making this point 90 deg to the first pick point so whatever the angle is to the first pick point is the angle that the pline follows.



     



    I believe I need to take the distance from point1 and point2 and use it with the polar command but I can't seem to get work.  I know I'm missing something simple and trying to make it too complicated



     



    "ruul morawetz" <ruul_@_bigfoot.com> wrote in message news:...



    On 15.09.2003 17:04 Mack Attack wrote:



     
    hmm. could you please describe what
    1) you want to click/enter/show on screen
    2) each input of yours shall affect

    from the comment of your code i guess you want to specify a point for  the pline placement.

    you ask for a 2nd point. comment says "distance".
    you took (getdist) and calculation of following points into consideration?

    you have ortho on, osmode set to QUAD, but changed the code that the routine doesn't use the osnap.
    .
    if you enter
    10,10 and 10,0 you should get a vertical pline
    10,10 and 20,10 you should get a horizontal one.

    so i don't see a problem with this routine.
    waiting for you to show us ;-)
     
    Mack Attack, Sep 15, 2003
    #9
  10. aaaah, .....
    i didn't see you didn't specify the first point.
    sorry, some things i just assume and overlook

    try using p1 when asking for p2
    (setq p1 " First point: ")
    (setq p2 (getpoint " 2nd point: " p1))



    i also missed it ;-)
     
    ruul morawetz, Sep 15, 2003
    #10
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.