Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

% text to a line that is inclined.

9 REPLIES 9
Reply
Message 1 of 10
hmsilva
273 Views, 9 Replies

% text to a line that is inclined.

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

Is like this:

>Delta Y / delta X = H1
>H1 x 100 = (text)%)

Any ideas?

Thanks to all future responses.

Regards

Henrique

EESignature

9 REPLIES 9
Message 2 of 10
BillZ
in reply to: hmsilva

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

Bill
Message 3 of 10
Anonymous
in reply to: hmsilva

> The percent symbol is added by appending "%%%" to the string. Huh? (strcat "5" "%%%%") => "5%%%%"
Message 4 of 10
BillZ
in reply to: hmsilva

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
Message 5 of 10
hmsilva
in reply to: hmsilva

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

Thanks...

Henrique

EESignature

Message 6 of 10
BillZ
in reply to: hmsilva

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
Message 7 of 10
Anonymous
in reply to: hmsilva

> 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
Message 8 of 10
hmsilva
in reply to: hmsilva

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

Thanks anyway

Henrique

EESignature

Message 9 of 10
Anonymous
in reply to: hmsilva

> 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))
Message 10 of 10
hmsilva
in reply to: hmsilva

Thanks a lot!

Regards....

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost