% text to a line that is inclined.

Discussion in 'AutoCAD' started by hmsilva, Feb 15, 2005.

  1. hmsilva

    hmsilva Guest

    I am trying to assume % text to a line that is inclined.
    The drawing is in 2D…

    Is like this:
    Any ideas?

    Thanks to all future responses.

    Regards

    Henrique
     
    hmsilva, Feb 15, 2005
    #1
  2. hmsilva

    BillZ Guest

    The percent symbol is added by appending "%%%" to the string.

    Bill
     
    BillZ, Feb 15, 2005
    #2
  3. hmsilva

    Tom Smith Guest

    The percent symbol is added by appending "%%%" to the string.

    Huh?

    (strcat "5" "%%%%") => "5%%%%"
     
    Tom Smith, Feb 15, 2005
    #3
  4. hmsilva

    BillZ Guest

    Tom,

    I think we're talking about turning that value into a text entity.

    Command: (strcat "Hello" "%%%")
    "Hello%%%"

    (command "text" (getpoint) "1" "0" (strcat "Hello" "%%%"))

    Bill
     
    BillZ, Feb 15, 2005
    #4
  5. hmsilva

    hmsilva Guest

    I really need is to transform the line data to a percent value...

    Thanks...

    Henrique
     
    hmsilva, Feb 15, 2005
    #5
  6. hmsilva

    BillZ Guest

    Not sure if this is what you mean:

    Command: (setq H 37.00)
    37.0

    Command: (setq Total 124.00)
    124.0

    Command: (strcat (rtos (* (/ H Total) 100) 2 2) "%")
    "29.84%"


    Bill
     
    BillZ, Feb 15, 2005
    #6
  7. hmsilva

    Tom Smith Guest

    I really need is to transform the line data to a percent value...

    Assuming edata is the entity data returned from an entget,

    (defun percentslope (edata / p1 p2 dv dx dy)
    (setq
    p1 (trans (cdr (assoc 10 edata)) 0 1)
    p2 (trans (cdr (assoc 11 edata)) 0 1)
    dv (mapcar'- p2 p1)
    dx (car dv)
    dy (cadr dv))
    (if (zerop dx)
    "Vertical"
    (strcat (rtos (* 100 (/ dy dx)) 2 2) "%"))) ;change the decimal
    precision as needed
     
    Tom Smith, Feb 15, 2005
    #7
  8. hmsilva

    hmsilva Guest

    I need a lisp that I pick a line and i get the inclination in percent in the xy plane...

    Thanks anyway

    Henrique
     
    hmsilva, Feb 15, 2005
    #8
  9. hmsilva

    Tom Smith Guest

    I need a lisp that I pick a line and i get the inclination in percent in
    the xy plane...

    See my previous reply, plus this:

    (defun c:inclin (/ sset)
    (if (setq sset (ssget ":s:e" '((0 . "line"))))
    (princ (strcat "\n" (percentslope (entget (ssname sset 0))))))
    (princ))
     
    Tom Smith, Feb 15, 2005
    #9
  10. hmsilva

    hmsilva Guest

    Thanks a lot!

    Regards....

    Henrique
     
    hmsilva, Feb 15, 2005
    #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.